New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 831557 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocked on:
issue 756796



Sign in to add a comment

cache.keys() doesn't properly ignore Vary header

Reported by filipb...@filipbech.dk, Apr 11 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce the problem:
1. load a script from a script[type=module]
2. add the request+response to cache from the fetch-event in sw
3. cache.keys() doesn't contain it (+ doesn't show in devtools) but cache.match(request) works 

What is the expected behavior?
cache.keys() + devtools should show it

What went wrong?
it doesn't

Did this work before? N/A 

Chrome version: 65.0.3325.181  Channel: stable
OS Version: OS X 10.13.4
Flash Version:
 
Screen Shot 2018-04-11 at 14.08.04.png
343 KB View Download
 Issue 831558  has been merged into this issue.
Components: -Blink Blink>ServiceWorker

Comment 3 by mek@chromium.org, Apr 11 2018

Components: Blink>Storage>CacheStorage
Labels: Needs-Triage-M65
Cc: sindhu.chelamcherla@chromium.org
Labels: Needs-Feedback Triaged-ET
@Reporter: Please provide sample URL/test file to test this issue from TE end. Any further information on reproducing the issue would help in further triaging of the issue.

Thanks!
After a couple of more hours debugging, it seems to be a problem with the host... 

I put a repro up on github, but there it actually works. 
source: https://github.com/filipbech/filipbech.github.io/tree/master/demos/cache-keys
demo: https://filipbech.github.io/demos/cache-keys/

I tried two different local webservers where one works, and the other doesn't. (I screenshotted the response-headers, as I guess thats the only thing that is changed by that). 

I don't know if you still want to reproduce it, but my example doesn't work if you run it with this local server.. https://www.npmjs.com/package/local-web-server
doesnt-work.png
237 KB View Download
works.png
231 KB View Download
Project Member

Comment 7 by sheriffbot@chromium.org, Apr 12 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by mek@chromium.org, Apr 12 2018

Cc: jkarlin@chromium.org jsb...@chromium.org
Labels: Hotlist-Interop
Status: Available (was: Unconfirmed)
That does seem to be a bug in our Cache implementation. 
Implementation bug details:
CacheStorageDispatcherHost::CacheImpl::Keys always creates a non-null request, even if the javascript code never passed a request to indicate it wants all the keys.
Since this request will have an empty url, our "query" code will ignore the url and return "all" the requests, except that it still tries to validate the Vary header (which as you might have noticed is the main difference between the working and non-working cases).

So a work-around would be to pass ignoreVary=true to keys(), and a solution would be for our implementation to not try to check the vary header if we have no request to compare it to (or maybe fix our keys implementation to not try to pass a request to our query implementation if no request was passed in in javascript).

Comment 9 by mek@chromium.org, Apr 12 2018

Summary: cache.keys() doesn't properly ignore Vary header (was: cache.keys() + Native modules)
Thanks for digging in Marijn. Seems like the fix is to make the mojo interface take an optional request and not pass a request if there isn't one. 
Components: -Blink>ServiceWorker
Owner: wanderview@chromium.org
Started looking at this by writing a WPT:

https://chromium-review.googlesource.com/c/chromium/src/+/1156886
Blockedon: 756796
There is a deeper problem here.  It seems the simple cache backend does not actually store multiple entries for the same URL and different VARY headers.  See:

https://bugs.chromium.org/p/chromium/issues/detail?id=756796#c3
Status: Assigned (was: Available)

Sign in to add a comment