[Webkit-unassigned] [Bug 225861] Content Blocker: add a new action type - "scriptlet"

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 21 03:12:48 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=225861

--- Comment #3 from Andrey Meshkov <am at adguard.com> ---
(In reply to Maciej Stachowiak from comment #1)
> I know this is a lot to ask, but can you give some examples of cases where
> each of these top 5 script rules are used AdGuard or uBlock filters, ideally
> with some explanation of why the rules are necessary and how they accomplish
> their goal?

Here are some examples. Please let me know if you need more.

`youtube.com,youtube-nocookie.com##+js(json-prune, [].playerResponse.adPlacements [].playerResponse.playerAds playerResponse.adPlacements playerResponse.playerAds adPlacements playerAds)`

YouTube loads video metadata JSON alongside ads metadata in a single request. This rule removes parts of the JSON that contain ads meta.

Note, that json-prune scriptlet overrides two functions in order to intercept those JSON's:

* `JSON.parse`
* `Response.prototype.json`

`youtube.com,youtube-nocookie.com##+js(set, ytInitialPlayerResponse.adPlacements, undefined)`

When you load a YouTube page with a video for the first time, there's a JSON object `ytInitialPlayerResponse` initialized inside an inline script. This object contains ads metadata which this rule removes.

`[many domains...]#%#//scriptlet("abort-on-property-write", "_pop")`

Aborts a popular script for popup domains. They use random domains and this scriptlet takes care of it for good even when domain is not blocked yet.

Example: gledajcrtace.xyz

`[many domains...]#%#//scriptlet("abort-on-property-read", "BetterJsPop")`

Aborts another very popular script to show popup ads. Usually, used as an inline script.

Example: https://upvideo.to/v/jfiqnfdkwqpd

`dobreprogramy.pl,open.fm,abczdrowie.pl,www.o2.pl,parenting.pl,fotoblogia.pl,gadzetomania.pl,komorkomania.pl,autocentrum.pl,autokult.pl,pudelek.pl,wiadomosci.wp.pl,moto.wp.pl,pogoda.wp.pl,fitness.wp.pl,turystyka.wp.pl,wroclaw.wp.pl,wawalove.wp.pl,opinie.wp.pl,tech.wp.pl,sportowefakty.wp.pl,kobieta.wp.pl,finanse.wp.pl#%#//scriptlet("abort-on-property-write", "Object.prototype.callBids")`

Aborts an ad script on wp.pl domains. wp.pl uses random domains to serve ads and has random names of classes/ids elements, so it's not possible to block these ads requests/hide ads using common cosmetic rules.

`[many domains...]#%#//scriptlet("set-constant", "puShown", "true")`

Prevents popups/popunders from showing on many Turkish (not only, but mainly) websites. Sometimes it's an inline script, sometimes it's not, and sometimes it's a script with a random path.

Example (NSFW): filmkuzusu.com

`videox24.com#%#//scriptlet("json-prune", "MU_ads")`

Disables ads by removing "MU_ads" flag from the JSON loaded from iplay.videox24.com/api/api_movie.php?... URL.
Blocking ad URLs instead will either break the player or make user wait for the ad duration.

Example (NSFW): http://iplay.videox24.com/player?id=5350

`tvn24.pl#%#//scriptlet("json-prune", "playlist.movie.advertising.ad_server")`

Prevents video ads without breaking the player. Video player is initialized in an inline script (look for "window.VideoManager.initVideo") with ads metadata passed as a string. json-prune removes a part of this metadata.

Example: https://fakty.tvn24.pl/

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210521/d4f31b57/attachment-0001.htm>


More information about the webkit-unassigned mailing list