Open Bug 1806476 Opened 3 years ago Updated 7 months ago

webRequest.filterResponseData does not work when navigating from the "new" blank page, breaking uBlock Origin HTML filtering

Categories

(WebExtensions :: Request Handling, defect, P2)

Firefox 108
defect

Tracking

(firefox-esr102 unaffected, firefox108 wontfix, firefox109+ wontfix, firefox110 wontfix, firefox111 wontfix, firefox112 wontfix)

ASSIGNED
Tracking Status
firefox-esr102 --- unaffected
firefox108 --- wontfix
firefox109 + wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix

People

(Reporter: gwarser, Assigned: rpl, NeedInfo)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [addons-jira])

This should remove cookie consent dialog from Google search page in European region, so if you are outside, use VPN.

  • set browser Home Page / New Tab to be blank
  • install uBlock Origin'
  • add google.com##^script:has-text(cookieUpdateConsentUrl) to "My filters"
  • clear browsing data
  • close browser
  • open browser
  • type or "paste and go" https://www.google.com/ in address bar

Expected:

Google page with input box.
There is no script element with cookieUpdateConsentUrl text in source.

Actual:

Consent dialog. script element with cookieUpdateConsentUrl text in source.

Reload page - dialog disappears. Script element is removed.

Bisected to:

36:56.35 INFO: Running autoland build built on 2022-11-04 15:16:50.808000, revision 2e7abeda
37:04.02 INFO: Launching /tmp/tmpw_al3ul3/firefox/firefox
37:04.02 INFO: Application command: /tmp/tmpw_al3ul3/firefox/firefox --allow-downgrade -profile /tmp/tmpbpmiuqvk.mozrunner
37:04.02 INFO: application_buildid: 20221101204539
37:04.02 INFO: application_changeset: 2e7abedae4a01ba3fefaa93462b5211824e5c947
37:04.02 INFO: application_name: Firefox
37:04.02 INFO: application_repository: https://hg.mozilla.org/integration/autoland
37:04.02 INFO: application_version: 108.0a1
Was this integration build good, bad, or broken? (type 'good', 'bad', 'skip', 'retry', 'back' or 'exit' and press Enter): bad
37:17.29 INFO: Narrowed integration regression window from [d6b82b3d, 6654b5c9] (3 builds) to [d6b82b3d, 2e7abeda] (2 builds) (~1 steps left)
37:17.29 INFO: No more integration revisions, bisection finished.
37:17.29 INFO: Last good revision: d6b82b3d655959b256be143218b86ee28d9fe06a
37:17.29 INFO: First bad revision: 2e7abedae4a01ba3fefaa93462b5211824e5c947
37:17.29 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=d6b82b3d655959b256be143218b86ee28d9fe06a&tochange=2e7abedae4a01ba3fefaa93462b5211824e5c947

[rdk@on ~]$ 

https://bugzilla.mozilla.org/show_bug.cgi?id=1676492

Status: UNCONFIRMED → NEW
Component: Toolbars and Customization → Request Handling
Ever confirmed: true
Product: Firefox → WebExtensions
Regressed by: 1676492
Version: unspecified → Firefox 108

Set release status flags based on info from the regressing bug 1676492

:enndeakin, since you are the author of the regressor, bug 1676492, could you take a look? Also, could you set the severity field?

For more information, please visit auto_nag documentation.

Flags: needinfo?(enndeakin)

We agreed that this is something we need to investigate sooner rather than later, needinfo-ing myself as a reminder.

Assignee: nobody → lgreco
Status: NEW → ASSIGNED
Flags: needinfo?(lgreco)
Whiteboard: [addons-jira]
Severity: -- → S2
Flags: needinfo?(lgreco)
Priority: -- → P1
Flags: needinfo?(lgreco)
Flags: needinfo?(enndeakin)

I managed to look a little bit more deeply into this, the STR can reproduce the issue consistently and I verified that:

That seems to be due to the fact that the browser element for the new about:newtab blank page ends up to be remote="false" and that seems to be happening because:

Checking what the chrome registry canLoadURLRemotely and mustLoadURLRemotely are returning for "chrome://browser/content/blanktab.html" from the BrowserConsole confirm that is false in both cases and so expected that mozilla::dom::IsolationBehaviorForURI would be returning IsolationBehavior::Parent .

This doesn't happen for about:welcome, etc. , I guess because those are not translating to a chrome url and so they are getting loaded in privilegeabout child processes, and so the browser element is remote="true".

Hey Neal,
does the sequence describe above match what you would expect to happen given the details provided?

I was also wondering if loading "chrome://browser/content/blanktab.html" in the parent process is something that have been done on purpose or we may have missed to set flags to make sure we allowed it to switch the browser to remote="true"?

Flags: needinfo?(lgreco) → needinfo?(enndeakin)

FYI there is some existing discussion on this other bug about extensions broken by this change: bug 1800995.

See Also: → 1800995

Hi Gijs,
This regressions seems to be breaking adblocking on the first load on a new tab if the new tab url is set to the new blank tab url,
in comment 3 I added some details I gathered while investigating this, but there are some doubts about what I've observed that I wanted to confirm with someone that has some more direct knowledge about those internals so that then we can agree on how to fix the regression properly (as a side note. I haven't double-checked yet if Bug 1800995 is due to the exact same underlying behavior described in comment 3, but it is not unlikely that may be the case).

I noticed that you have reviewed the patch that introduced the new blank tab page, would you be able to help us answering the questions at the bottom of comment 3 if Neal is currently too busy to take a look into that? (or redirect the needinfo to someone that may have some time to look into that)

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #5)

Hi Gijs,
This regressions seems to be breaking adblocking on the first load on a new tab if the new tab url is set to the new blank tab url,
in comment 3 I added some details I gathered while investigating this, but there are some doubts about what I've observed that I wanted to confirm with someone that has some more direct knowledge about those internals so that then we can agree on how to fix the regression properly (as a side note. I haven't double-checked yet if Bug 1800995 is due to the exact same underlying behavior described in comment 3, but it is not unlikely that may be the case).

I noticed that you have reviewed the patch that introduced the new blank tab page, would you be able to help us answering the questions at the bottom of comment 3 if Neal is currently too busy to take a look into that? (or redirect the needinfo to someone that may have some time to look into that)

Mostly I'm confused. On current nightly if I set it to blank new tab pages, open a new tab, and evaluate gBrowser.selectedBrowser.isRemoteBrowser it says true.

So I don't understand why you're finding the tab loading in the parent process. That shouldn't be happening, and doesn't seem to for me.

bug 1800995 appears to be related to whether webextension code can run on a page with privileged API access, so that sounds different to the root cause you have so far - but then, I'm confused about that root cause so 🤷‍♂️

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(lgreco)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #3)

Checking what the chrome registry canLoadURLRemotely and mustLoadURLRemotely are returning for "chrome://browser/content/blanktab.html" from the BrowserConsole confirm that is false in both cases and so expected that mozilla::dom::IsolationBehaviorForURI would be returning IsolationBehavior::Parent .

This doesn't happen for about:welcome, etc. , I guess because those are not translating to a chrome url and so they are getting loaded in privilegeabout child processes, and so the browser element is remote="true".

FWIW for this thing, AIUI chrome URIs never return true for those APIs, but about URIs do, even if they point to chrome ones, e.g. E10SUtils.getRemoteTypeForURI("about:certviewer", true, true) returns web, even though it points to a chrome URI.

(Fundamentally, it seems bad that the remoteness of the current page would impact whether we can run webextension code for a subsequent pageload, irrespective of what blank tabs are doing. So I feel like I'm missing something here, I just don't understand what it is, from comment 3)

(In reply to :Gijs (he/him) from comment #6)

...
Mostly I'm confused. On current nightly if I set it to blank new tab pages, open a new tab, and evaluate gBrowser.selectedBrowser.isRemoteBrowser it says true.

So I don't understand why you're finding the tab loading in the parent process. That shouldn't be happening, and doesn't seem to for me.

Based on what I recall (and unfortunately I missed to mention that explicitly in comment 3) the part of the STR about restarting the browser was necessary to be able to hit the issue, which is making me thing that there may be something different in the way the first blank tab was getting loaded that may be worth digging into.

Did you also restarted the browser when you tried to trigger this issue locally?

I'm going to also give it another try to refresh my memory and double-check if anything changed in that behavior in the meantime.

Flags: needinfo?(lgreco)

(In reply to Luca Greco [:rpl] [:luca] [:lgreco] from comment #9)

Did you also restarted the browser when you tried to trigger this issue locally?

To be clear, I haven't tried to trigger the full issue. But yes, even after restarting the browser isRemoteBrowser is true, and remoteType on the browser says privilegedabout, for (blank) new tabs. If I instead load about:config, which is intentionally loaded in the parent, then isRemoteBrowser is false, and remoteType is null.

Is there any progress on the investigation? Could we have something for the 110 planned dot release? Thanks

Is that really a P1/S2?

Flags: needinfo?(mixedpuppy)

(In reply to Pascal Chevrel:pascalc from comment #12)

Is that really a P1/S2?

We initially set it to P1/S2 because it looks like a legit regression and we wanted to prioritize better assessing the impact for the user.

Given that the setting that would make the issue to be hit is an opt-in setting and that it seems to affect only the first load in the new blank tab, S4 should be a more reasovable severity level (and P2 as the priority, given that we still want to pinpoint what is the actual underlying issue).

Severity: S2 → S4
Flags: needinfo?(mixedpuppy)
Priority: P1 → P2

Any progress here?

See Also: → 1982934
You need to log in before you can comment on or make changes to this bug.