Closed
Bug 1206298
Opened 10 years ago
Closed 10 years ago
Image returned by browser even though removed from SW cache.
Categories
(Core :: DOM: Service Workers, defect)
Core
DOM: Service Workers
Tracking
()
RESOLVED
FIXED
mozilla44
People
(Reporter: marcosc, Assigned: ehsan.akhgari)
References
Details
(Whiteboard: [see comment 5])
Attachments
(2 files, 1 obsolete file)
6.35 KB,
patch
|
mcmanus
:
review+
|
Details | Diff | Splinter Review |
9.65 KB,
patch
|
jdm
:
review+
|
Details | Diff | Splinter Review |
I am adding an image to a SW cache that has a `Cache-Control: max-age=1`, so I expect it to expire. However, when I request that image again 5+ seconds later, the image still shows up.
I am expecting the image to have been destroyed from the cache.
Reporter | ||
Updated•10 years ago
|
Blocks: ServiceWorkers-v1
Comment 1•10 years ago
|
||
Skimming the SW spec, I don't see anything that deals specifically with headers for cached responses. https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#cache-lifetimes also suggests that this behaviour is per spec.
Reporter | ||
Comment 2•10 years ago
|
||
That the cache doesn't self-manage based on HTTP cache directives kinda sucks:( Will take that up with the spec people.
However, I am explicitly removing the image from the cache before attempting to reload it. So, I would expect trying to load the image to fail (I know the image is actually in the image cache, not HTTP cache - just looking it at it from author expectation).
Wondering what others think should happen here?
Should this be blocking v1?
Comment 4•10 years ago
|
||
I'm going to say this shouldn't block our shipping of SW and that if the spec needs to change we can fix it when it does (and in conjunction with other UAs shipping SW at that time).
Marcos, obviously feel free to disagree :)
Assignee | ||
Comment 5•10 years ago
|
||
I think comment 1 is missing the fact that Marcos was talking about setting the Cache-Control max-age header. Josh, can you please confirm?
Looking at the imagelib code, we do get the max age of the cache entry: <http://mxr.mozilla.org/mozilla-central/source/image/imgRequest.cpp#597>. That timestamp seems to be initialized in nsHttpChannel::UpdateExpirationTime() which is called from nsHttpChannel::InitCacheEntry(), but as far as I can tell, we bypass calling that function (which is normally called from ContinuteProcessNormal) in the case of cache entries for synthesized content.
If my analysis is correct, I think this needs to block v1, otherwise the cache entries will have an inconsistent state and I am not sure what other things it will break.
Flags: needinfo?(josh)
Comment 6•10 years ago
|
||
Cache API does not look at http cache headers by design. You have to write the eviction code yourself. If you want http cache semantics, then just rely on the http cache.
Implementing an auto-remove feature for Cache API is something that was proposed in v2 of Anne's storage spec. Specifically, the cache boxes.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(josh)
Resolution: --- → INVALID
Updated•10 years ago
|
No longer blocks: ServiceWorkers-postv1
Comment 7•10 years ago
|
||
Ehsan pointed out in person that this is more complicated than it first appears. Specifically, the image cache (separate from the HTTP cache) checks the cache headers on the HTTP response but isn't able to find them from our synthesized responses.
Assignee | ||
Updated•10 years ago
|
Whiteboard: [see comment 5]
Assignee | ||
Updated•10 years ago
|
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8677698 -
Flags: review?(mcmanus)
Assignee | ||
Comment 10•10 years ago
|
||
Attachment #8677699 -
Flags: review?(josh)
Assignee | ||
Comment 11•10 years ago
|
||
Sorry, the todo_is() calls in the previous patch should have been is().
Attachment #8677700 -
Flags: review?(josh)
Assignee | ||
Updated•10 years ago
|
Attachment #8677699 -
Attachment is obsolete: true
Attachment #8677699 -
Flags: review?(josh)
Comment 12•10 years ago
|
||
Comment on attachment 8677698 [details] [diff] [review]
Part 1: Update the expiration time on the fake cache entry object for an intercepted request in the non-e10s case
Review of attachment 8677698 [details] [diff] [review]:
-----------------------------------------------------------------
thanks!
Attachment #8677698 -
Flags: review?(mcmanus) → review+
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ehsan
Assignee | ||
Comment 13•10 years ago
|
||
Josh: ping?
Updated•10 years ago
|
Attachment #8677700 -
Flags: review?(josh) → review+
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a5f81cb4dcd7
https://hg.mozilla.org/mozilla-central/rev/c6c7c4323490
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•