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

Allow modification of window attributes with scriptlets #9496

Closed
antonok-edm opened this issue Apr 28, 2020 · 1 comment · Fixed by brave/brave-core#5402
Closed

Allow modification of window attributes with scriptlets #9496

antonok-edm opened this issue Apr 28, 2020 · 1 comment · Fixed by brave/brave-core#5402

Comments

@antonok-edm
Copy link
Collaborator

Currently, the implementation of scriptlet injection for cosmetic filters is done using the insertScript API, which is sandboxed from the main page. As a result, scriptlets that rely on intercepting method calls on the global window object don't do anything.

uBlock Origin's implementation injects scriptlets by creating a global script HTML element with the scriptlet as the text content, inserting it to the DOM, and immediately removing it after execution. This approach should provide better compatibility.

@srirambv
Copy link
Contributor

srirambv commented May 11, 2020

Verification passed on

Brave 1.9.62 Chromium: 81.0.4044.138 (Official Build) dev (64-bit)
Revision 8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{# 999}
OS Linux
  • Verified Paid promotion links are shown on current release build 1.8.95
    image
  • Verified Paid Promotion links are removed on 1.9.62
    image

Verification passed on

Brave | 1.9.62 Chromium: 81.0.4044.138 (Official Build) dev (64-bit)
-- | --
Revision | 8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999}
OS | Windows 10 OS Version 1803 (Build 17134.1006)

Verified passed with

Brave | 1.9.62 Chromium: 81.0.4044.138 (Official Build) dev (64-bit)
-- | --
Revision | 8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999}
OS | macOS Version 10.14.6 (Build 18G3020)

Using 1.8.95, confirmed I see the Promotional links:
Screen Shot 2020-05-11 at 1 23 28 PM

Using 1.9.x, confirmed no Promotional links:
Screen Shot 2020-05-11 at 1 24 37 PM

@rebron rebron changed the title Cosmetic filter scriptlet injection fails to modify window attributes Allow modification of window attributes with scriptlets May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment