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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 17 03:12:19 PDT 2021


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

            Bug ID: 225861
           Summary: Content Blocker: add a new action type - "scriptlet"
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: am at adguard.com

Popular content blockers like AdGuard, uBlock Origin, and others provide an option to run simple scripts on a website. The list of scripts that can be used is short and limited in what can be done to the page, but still, this is crucial to block ads on some websites.

The overall number of the "scriptlet" rules: almost 3000 in AdGuard filters and over 6000 in uBlock filters.

The most pressing issue we have due to the lack of scriptlets functionality provided by Safari is Youtube ads. We have to use a pretty limited approach and basically block all short videos. This does block ads, but there may be false positives and overall it hurts user experience.

Here's how YT ads are tackled with the help of scriptlet rules:

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

Scriptlets libraries are rather huge:
https://github.com/gorhill/uBlock/wiki/Resources-Library
https://github.com/AdguardTeam/Scriptlets

However, it would be great if Safari provided at least the very basic ones.

Here's the list of scriptlets which cover ~80% of existing rules:

1. "set-constant" - https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#set-constant
2. "json-prune" - https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#json-prune
3. "abort-current-inline-script" - https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-current-inline-script
4. "abort-on-property-read" - https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-read
5. "abort-on-property-write" - https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#abort-on-property-write

-- 
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/20210517/8f0707d7/attachment.htm>


More information about the webkit-unassigned mailing list