AdguardTeam / AdguardTeam/Scriptlets

Improve logging in scriptlets — save reference to console

Offen
#546 0 Kommentare 1 Reaktion 1 zugewiesene Person Beansprucht von @maximtop Auf GitHub ansehen
enhancement Priority: P4
Vorherrschende Sprache
JavaScript
Sterne
195
Forks
33
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.