Closed Bug 1657575 Opened 6 years ago Closed 1 year ago

webRequest.handlerBehaviorChanged should clear caches, including stylesheet cache

Categories

(WebExtensions :: Request Handling, defect, P2)

defect

Tracking

(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox79 wontfix, firefox80 wontfix, firefox81 wontfix, firefox138 verified)

VERIFIED FIXED
138 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox79 --- wontfix
firefox80 --- wontfix
firefox81 --- wontfix
firefox138 --- verified

People

(Reporter: evilpies, Assigned: arai)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Steps to reproduce:

  1. Open the ABP menu
  2. Click the cog wheel
  3. Go to Advanced
  4. Scroll down My Filter List
  • Add the filter ||testpages.adblockplus.org/testfiles/image_exception/*
  • Reload the tab with the testpage
  • "This should be a green element." should have a green background instead of red.

This test works before bug 1599160. It also works on Chrome with the ABP extension.

Flags: needinfo?(emilio)

It seems like the single rule in <link rel="stylesheet" href="/testfiles/image_exception/stylesheet.css?1125569188"> that changes the background to red still applies after blocking.

This is working as expected I think. We have no way to know that something has changed that makes a webrequest hook return a different result...

Maybe we should expose some API to allow clearing the caches or something so that ABP can call it or what not, but otherwise...

This already happened before my patch if you don't reload the page and instead add the stylesheet dynamically in the same document. It'd load fine instead of getting blocked for the same reason.

Flags: needinfo?(emilio)

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

Maybe we should expose some API to allow clearing the caches or something so that ABP can call it

Well, such an API exists already and is called by Adblock Plus, see webRequest.handlerBehaviorChanged.

It's no-op code...

Moving WebExtensions.

Component: CSS Parsing and Computation → General
Product: Core → WebExtensions

Lol

Summary: Stylesheet caching broke Adblock Plus test → webRequest.handlerBehaviorChanged should clear caches, including stylehseet cache

(In reply to sebastian.noack from comment #4)

Maybe we should expose some API to allow clearing the caches or something so that ABP can call it

Well, such an API exists already and is called by Adblock Plus, see webRequest.handlerBehaviorChanged.

eh, that's a pretty elaborate description (in the mdn API doc page) for a method that is currently a no-op.

we should also fix the compatibility table (in the mdn/browser-compat-data github repo), given that it is listing this method as supported in Firefox starting from Firefox 45 (and Firefox for Android 48): https://github.com/mdn/browser-compat-data/blob/a45c3de062d0d70ddeacc6181a11cde18ee51519/webextensions/api/webRequest.json#L981-L996

Calling this a regression is a bit of a stretch. Caching improvements broke something, but the underlying cause is pre-existing.

Keywords: regression
No longer regressed by: 1599160
Summary: webRequest.handlerBehaviorChanged should clear caches, including stylehseet cache → webRequest.handlerBehaviorChanged should clear caches, including stylesheet cache
Severity: -- → S3
Component: General → Request Handling
Priority: -- → P2
See Also: → 1694939
Blocks: 1694939
See Also: 1694939
See Also: → 1633189
See Also: → 1946348
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
See Also: → 1948808
See Also: → 1949623
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/eaba679789d9 Add webRequest.handlerBehaviorChanged. r=extension-reviewers,desktop-theme-reviewers,emilio,robwu
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch

Verified as Fixed. Tested on the latest Nightly (138.0a1/20250304213504) under Windows 11 and Ubuntu 24.04 LTS.

Upon reloading the tab with the test page as per the STR from Comment 0, the background of the element changes from red to green as expected, confirming the fix.

Note that since the initial Comment 0, some things have changed in regards to the test page URL and the filter to use:

Other than these minor changes, everything else in the STR is correct.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: