AdguardTeam / Scriptlets

AdGuard scriptlets library
GNU General Public License v3.0
138 stars 27 forks source link

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

Open piquark6046 opened 3 months ago

piquark6046 commented 3 months ago

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](https://github.com/AdguardTeam/Scriptlets/assets/98787049/ad805881-50cf-4153-b4e6-eb8f18f88806)

Proposed Syntax

example.org#%#//scriptlet('trusted-set-object-defineproperty', [NonFunctionalBoolean [, ReturnAs [, FilledWith [, stack]]]])

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

piquark6046 commented 3 months ago

https://github.com/uBlockOrigin/uBlock-issues/discussions/3196#discussion-6460516