Scriptlets icon indicating copy to clipboard operation
Scriptlets copied to clipboard

Fix 'abort-on-stack-trace' — do not assign 'window' to property which was not set

Open AdamWr opened this issue 5 months ago • 0 comments

Currently when a rule like this is used:

example.com#%#//scriptlet('abort-on-stack-trace', 'foo.bar', 'whatever')

then foo is set to window, but it should be undefined.

Screenshot Image

I'm not sure, but perhaps here: https://github.com/AdguardTeam/Scriptlets/blob/3ba245f96237915bbff6fe80c7400b03c0f5014d/src/scriptlets/abort-on-stack-trace.js#L94-L106 we could change it to:

        if (chain) {
            base = owner[prop];
            const setter = (a) => {
            [...]

Related issue - https://github.com/AdguardTeam/AdguardFilters/issues/209732

AdamWr avatar Jul 20 '25 13:07 AdamWr