Skip to content

Improve logging in scriptlets — save reference to console #546

Description

@AdamWr

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

Steps to reproduce:

  1. Add to user rules:
example.org#%#//scriptlet('prevent-setTimeout')
example.org#%#//scriptlet('log-on-stack-trace', 'document.querySelectorAll')
  1. Go to - https://example.org/
  2. Run in console:
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions