Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new scriptlet — 'trusted-set-object-defineproperty' #421

Open
piquark6046 opened this issue Apr 4, 2024 · 1 comment
Open

Add new scriptlet — 'trusted-set-object-defineproperty' #421

piquark6046 opened this issue Apr 4, 2024 · 1 comment
Assignees

Comments

@piquark6046
Copy link
Member

piquark6046 commented Apr 4, 2024

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

Screenshot from 2024-04-04 20-41-00

Proposed Syntax

example.org#%#//scriptlet('trusted-set-object-defineproperty', [NonFunctionalBoolean [, ReturnAs [, FilledWith [, stack]]]])
  • NonFunctionalBoolean — Non-functional comparative text like Object.entries.name === 'entries'. _Inbound (inbound argument for the mocked functions) and _Outbound (Reflect.apply result of the object.defineproperty or object.defineproperties) should be revealed in the non-functional comparative text to compare.
  • ReturnAs — Like value argument of set-constant scriptlet, a returned value instead of the actual outbound result.
  • FilledWith — (boolean) If it is true and the actual outbound result is Object, all entries of the object will be filled with ReturnAs. Otherwise, FilledWith argument will be ignored.

Usage with no arguments will log inbound arguments and outbound result to browser console.

Footnotes

  1. https://github.com/AdguardTeam/AdguardFilters/pull/135052

@piquark6046 piquark6046 changed the title Add new scriptlet — 'trusted-prune-object-defineproperty' Add new scriptlet — 'trusted-set-object-defineproperty' Apr 4, 2024
@piquark6046
Copy link
Member Author

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

No branches or pull requests

3 participants