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
JustOff committed Feb 25, 2020
1 parent fa19c4e commit 9b01b50
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions assets/resources/resources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ abort-current-inline-script.js application/javascript
desc.get instanceof Function === false
) {
value = owner[prop];
desc = undefined;
}
var magic = String.fromCharCode(Date.now() % 26 + 97) +
Math.floor(Math.random() * 982451653 + 982451653).toString(36);
Expand All @@ -1503,11 +1504,17 @@ abort-current-inline-script.js application/javascript
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;
}
}
});
var oe = window.onerror;
Expand Down

3 comments on commit 9b01b50

@THEtomaso
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JustOff:
Is this fix really needed for the Legacy branch?
Didn't gorhill submit this fix only to work around issues related to this change (which is NOT included in uBO Legacy)?:
gorhill/uBlock@1a85717

@JustOff
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is always good to have a scriptlet running in a more smart way.

@JustOff
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the mentioned change was included here as well.

Please sign in to comment.