AdguardTeam / AdguardTeam/Scriptlets
Add new scriptlet — 'trusted-set-object-defineproperty'
- 主要語言
- JavaScript
- 星號
- 195
- 分支
- 33
- PR 合併指標
- 30 天內沒有已合併 PR
描述
### 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

[^1]: https://github.com/AdguardTeam/AdguardFilters/pull/135052
### Proposed Syntax
```adblock
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.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。