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

Collapse frames with blocked content #14825

Closed
antonok-edm opened this issue Mar 18, 2021 · 3 comments · Fixed by brave/brave-core#9144
Closed

Collapse frames with blocked content #14825

antonok-edm opened this issue Mar 18, 2021 · 3 comments · Fixed by brave/brave-core#9144

Comments

@antonok-edm
Copy link
Collaborator

uBlock Origin has some code that causes frames whose sources are blocked to be collapsed.

It appears that this works by generating a randomized alphanumeric string on each page load and adding it as an attribute to each blocked iframe element, and also injecting a CSS rule designed to block any element with that attribute.

e.g. when loading the following HTML:

<html>
    <body>
        <iframe src="https://1-1ads.com/test.html"></iframe>
        <iframe src="https://101com.com/test.html"></iframe>
    </body>
</html>

With default Brave Shields configuration, the frames show a broken page (or suspicious document warning on 1.23.x with this PR).

When loading in uBlock Origin, the frames are invisible. When inspecting the page in the devtools console, the same random attribute is assigned to both (ex. <iframe src="https://101com.com/test.html" tr5x7y7vs>), and a [tr5x7y7vs] { display: none !important; } stylesheet is added to the page.

@stephendonner
Copy link

stephendonner commented Jun 22, 2021

Verified PASSED using the testplan at brave/brave-core#9144 with

Brave 1.28.20 Chromium: 91.0.4472.114 (Official Build) nightly (x86_64)
Revision 4bb19460e8d88c3446b360b0df8fd991fee49c0b-refs/branch-heads/4472@{#1496}
OS macOS Version 11.4 (Build 20F71)

Pre-requisite:

  1. saved HTML locally from the 1st snippet in Collapse HTML elements with blocked image/iframe requests brave-core#9144 as issue14825-testcase.html
  2. mkdir issue14825
  3. cd issue14825
  4. mv ~/Desktop/issue14825-testcase.html .
  5. from /Users/stephendonner/Desktop/issue14825
    stephendonner@Stephens-MacBook-Pro issue14825 % python3 -m http.server Serving HTTP on :: port 8000 (http://[::]:8000/) ... ::1 - - [22/Jun/2021 10:50:22] "GET /issue14825-testcase.html HTTP/1.1" 200 -

Steps:

  1. loaded http://localhost:8000/issue14825-testcase.html with default Shields
  2. confirmed only the example.com iframe loaded
  3. set Allow all trackers & ads in Shields, and reloaded http://localhost:8000/issue14825-testcase.html
  4. confirmed only the 2nd and 3rd frames -- 123freeavatars.com and example.com -- loaded
  5. via brave://flags, set #brave-adblock-collapse-blocked-elements to Disabled and relaunched Brave
  6. confirmed I saw 3 <iframe>s but only example.com loaded its content
Steps 1 & 2 Steps 3 & 4 Steps 5 & 6
Screen Shot 2021-06-22 at 10 53 01 AM Screen Shot 2021-06-22 at 12 21 13 PM Screen Shot 2021-06-22 at 10 54 44 AM

Verification passed on

Brave 1.28.92 Chromium: 92.0.4515.107 (Official Build) beta (64-bit)
Revision 87a818b10553a07434ea9e2b6dccf3cbe7895134-refs/branch-heads/4515@{#1634}
OS Ubuntu 18.04 LTS

Verified test plan from brave/brave-core#9144

image image image image

Verification passed on

Brave | 1.28.92 Chromium: 92.0.4515.107 (Official Build) beta (64-bit)
-- | --
Revision | 87a818b10553a07434ea9e2b6dccf3cbe7895134-refs/branch-heads/4515@{#1634}
OS | Windows 10 OS Version 2004 (Build 19041.1110)

Verified test plan from brave/brave-core#9144

image image image image

@srirambv
Copy link
Contributor

srirambv commented Aug 3, 2021

Verification passed on Oppo R5 with Android 11 running 1.28.99 x64 build

image image

Verification passed on Oppo R5 with Android 11 running 1.28.99 x64 build

image image

@LaurenWags
Copy link
Member

Changing to release-notes/exclude per discussion with @antonok-edm, this will be covered in the release notes with #14960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment