Scriptlets
Scriptlets copied to clipboard
Add new scriptlet — 'trusted-set-object-defineproperty'
Introduction
Since Netflix uses Object.defineProperty to define functions related to advertisement ^1, it seems that new scriptlet setting inbound and outbound of Object.defineProperty and Object.defineProperties is required for the advanced filtering quality.
Also, bundlers and transpilers like Babel often use Object.defineProperty to emulate certain ES6+ features in a way that's compatible with older JavaScript environments as GitHub Copilot said.
Screenshot
Proposed Syntax
example.org#%#//scriptlet('trusted-set-object-defineproperty', [NonFunctionalBoolean [, ReturnAs [, FilledWith [, stack]]]])
-
NonFunctionalBoolean— Non-functional comparative text likeObject.entries.name === 'entries'._Inbound(inbound argument for the mocked functions) and_Outbound(Reflect.applyresult of theobject.definepropertyorobject.defineproperties) should be revealed in the non-functional comparative text to compare. -
ReturnAs— Likevalueargument ofset-constantscriptlet, a returned value instead of the actual outbound result. -
FilledWith— (boolean) If it is true and the actual outbound result isObject, all entries of the object will be filled withReturnAs. Otherwise,FilledWithargument will be ignored.
Usage with no arguments will log inbound arguments and outbound result to browser console.
https://github.com/uBlockOrigin/uBlock-issues/discussions/3196#discussion-6460516