Open Bug 1660611 Opened 4 years ago Updated 3 years ago

Subresources of stylesheets (images / @import / ...) don't get revalidated if the image comes from the memory cache (was: Expires/Cache-Control header is not respected when set on a imported css file)

Categories

(Core :: CSS Parsing and Computation, defect, P3)

Firefox 81
defect

Tracking

()

People

(Reporter: a7a.i.nt, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36

Steps to reproduce:

when a cached css file (Cache-Control:max-age=3600000) imports another one (b) the expires header from b is not respected.
This also is the case when setting bs max-age or even no-cache.

Actual results:

cached version of b is used, even through it is expired

Expected results:

b should have been reloaded when it got expired/ max-age was reached

Type: enhancement → defect

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

So this is a bit tricky to fix... The underlying issue is that the memory cache is keeping the stylesheet alive, and that keeps alive all the imported stylesheets, including the one that's expired.

Do you know if this is a regression? If so this is probably one from bug 1599160...

A quick but non-ideal fix would be to basically make SheetLoadData::mExpirationTime be the minimum expiration time of all stylesheets in the subtree, or such. That wouldn't be amazing because that'd make us re-parse all the stylesheets in that subtree, but maybe it's fine.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

Hmm, I suspect this is technically also an issue for CSS images and such...

Interestingly, in Chrome even shift-reload won't stop the cached subresource from getting used (in Firefox you can at least do that...).

WebKit behaves as I'd expect I think.... Looking at the source they explicitly have a bunch of code to support this. Not a great fan of that approach, ideally we'd trigger loads for the individual subresources if we need to revalidate them. That's potentially even more complex though.

Summary: Expires/Cache-Control header is not respected when set on a imported css file → Subresources of stylesheets (images / @import / ...) don't get revalidated if the image comes from the memory cache (was: Expires/Cache-Control header is not respected when set on a imported css file)
Regressed by: 1599160
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: