Skip to content

Commit

Permalink
Allow re-entrance in abort-current-inline-script
Browse files Browse the repository at this point in the history
Related feedback:
- DandelionSprout/adfilt#7 (comment)

If a property is already trapped with a getter/setter,
propagate to these after validation succeed.
  • Loading branch information
gorhill committed Feb 24, 2020
1 parent 60348c4 commit 034c915
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@
if ( owner instanceof Object === false ) { return; }
}
let value;
const desc = Object.getOwnPropertyDescriptor(owner, prop);
let desc = Object.getOwnPropertyDescriptor(owner, prop);
if (
desc instanceof Object === false ||
desc.get instanceof Function === false
) {
value = owner[prop];
desc = undefined;
}
const magic = String.fromCharCode(Date.now() % 26 + 97) +
Math.floor(Math.random() * 982451653 + 982451653).toString(36);
Expand All @@ -79,11 +80,17 @@
Object.defineProperty(owner, prop, {
get: function() {
validate();
return value;
return desc instanceof Object
? desc.get()
: value;
},
set: function(a) {
validate();
value = a;
if ( desc instanceof Object ) {
desc.set(a);
} else {
value = a;
}
}
});
const oe = window.onerror;
Expand Down

0 comments on commit 034c915

Please sign in to comment.