AdguardTeam / AdguardTeam/Scriptlets

Improve logging in scriptlets — save reference to console

オープン
#546 コメント 0 件 リアクション 1 件 担当者 1 名 @maximtop が担当を希望しています GitHub で見る
enhancement Priority: P4
主要言語
JavaScript
スター
195
フォーク
33
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently if website overrides `console.log` or other properties then logging does not work.

Steps to reproduce:
1. Add to user rules:
```adblock
example.org#%#//scriptlet('prevent-setTimeout')
example.org#%#//scriptlet('log-on-stack-trace', 'document.querySelectorAll')
```
2. Go to - https://example.org/
3. Run in console:
```js
const noopFunc = ()=>{};
console.log = console.table = noopFunc;
setTimeout(()=>{const ads = {};});
const adblock = ()=>{ document.querySelectorAll('p'); };
adblock();
```

Scriptlets should log information to console.
There is nothing in console because `console.log` and `console.table` have been overridden.

Screenshot

Image


It works fine if `console.log = console.table = noopFunc;` is commented out.

Screenshot

Image

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。