Closed Bug 1744611 Opened 4 years ago Closed 1 year ago

HTTP Response Header: `Clear-Site-Data: "cache"` should flush in-page assets (JS/CSS) from the cache

Categories

(Toolkit :: Data Sanitization, enhancement, P3)

Firefox 91
enhancement

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: stephen.cunliffe, Assigned: manuel)

References

Details

Attachments

(1 file, 1 external file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

In trying to overcome an unrelated aggressive caching bug in a competitor browser I created a test page to send an HTTP Response Header: Clear-Site-Data: "cache" to flush the cache in the end user's browser (while maintaining cookies to keep a session alive)

This works fine in Chromium based browsers, but doesn't flush in-page assets (JS/CSS) from the cache in Firefox. (Works as expected in Chrome/Chromium Edge)

Actual results:

Requests to clear the site data cache were not honored, sub-content on the page (JS/CSS) continued to pull from the cache vs. fetch new resources.

Expected results:

HTTP cache for the specified domain should have been cleared (cookies, localStorage, etc. to remain untouched)

Composing a minimal test case to exhibit this bug, will upload shortly.

The Bugbug bot thinks this bug should belong to the 'Toolkit::Data Sanitization' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Data Sanitization
Product: Firefox → Toolkit

Load the attached test case index.php file in the browser on localhost AND/OR an HTTPS server.

With the attached test case, you can reload the page several times via the link or "Reload Page" button. Note that the server time reported (in the yellow box) remains the same from when it was loaded vs. the "executed" time that update to whenever the page is loaded.

Now press the "Reload Page (and FORCE CACHE CLEAR)" button... the page will reload with an extra param that sets the Clear cache header... then does a 302 redirect to load the page clean (w/o the param)

The browser should reload the linked JavaScript file from the server (after wiping the cache) and thus the server time should update to "now".

Test in Chromium: Works
Test in Firefox: Fails

Bug 1671182 disabled cache clearing via the Clear-Site-Data header.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
See Also: → 1671182
Blocks: 1838506

Restoring bug due to plan to restore Clear-Site-Data: cache header support.

Severity: -- → N/A
Status: RESOLVED → REOPENED
Type: defect → enhancement
Ever confirmed: true
Priority: -- → P3
Resolution: WONTFIX → ---
Summary: HTTP Response Header: `Clear-Site-Data: "cache"` doesn't flush in-page assets (JS/CSS) from the cache → HTTP Response Header: `Clear-Site-Data: "cache"` should flush in-page assets (JS/CSS) from the cache

This should take Bug 1730197 into consideration when implementing.

See Also: → 1730197
See Also: → 1972881

This changes the "ClearByPrincipal" of caches to the way it is used in
the Clear-Site-Data: "cache" code path for networking cache.

Same site (same origin attributes) and same origin.

Could warant IsSamePartitionAndOrigin function in nsIPrincipal. If so,
could be done in a follow-up.

Pernosco session used to debug (+print debugging): https://pernos.co/debug/5A3ixkTk_VXfoht9I1vg2g/index.html

Assignee: nobody → manuel
Status: REOPENED → ASSIGNED
Blocks: 1973209
Pushed by mbucher@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/8f7333075d1c https://hg.mozilla.org/integration/autoland/rev/def0d97874c0 Clear-Site-Data: "cache": Also clear CSS and Image cache r=emilio,anti-tracking-reviewers,timhuang
Pushed by smolnar@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0dbb349df4bb https://hg.mozilla.org/integration/autoland/rev/4521b7fbd3f6 Revert "Bug 1744611 - Clear-Site-Data: "cache": Also clear CSS and Image cache r=emilio,anti-tracking-reviewers,timhuang" for causing bc failures @ browser_css_cache.js

Related test cases need to be adjusted.

Flags: needinfo?(manuel)
Pushed by mbucher@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9f4ee9a5c0e5 https://hg.mozilla.org/integration/autoland/rev/470a75f966da Clear-Site-Data: "cache": Also clear CSS and Image cache r=emilio,anti-tracking-reviewers,timhuang
Status: ASSIGNED → RESOLVED
Closed: 4 years ago → 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
See Also: → 1713088
Blocks: 1713088
See Also: 1713088 →
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: