devtools cannot preview cache_storage Response objects with a VARY header
Reported by
se...@fullstory.com,
Sep 28
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36 Steps to reproduce the problem: 1. Create a synthetic Response. (i.e. using "const response = new Response(...)"). 2. Add it to a Cache.(i.e. using "cache.put(request, response)") 3. Look at the Cache Storage entry in Dev Tools. What is the expected behavior? You should be able to see the contents of the Response's body in the Preview. What went wrong? The Preview is always empty. Did this work before? N/A Chrome version: 69.0.3497.100 Channel: stable OS Version: OS X 10.13.6 Flash Version: Having this fixed would definitely make it easier to work with the Cache Storage APIs; right now I sometimes need to manually write JavaScript code in the console to pull things out of the cache and see their contents.
,
Sep 28
,
Sep 28
Whoops, sorry about that. I see now that I failed to construct a minimal test case. Here's one that reproduces the problem:
```
async function test() {
await caches.delete('foo');
var cache = await caches.open('foo');
var request = new Request('/', {
headers: {
'Accept': '*/*',
},
});
var response = new Response('hello', {
headers: {
'Vary': 'Accept',
},
});
await cache.put(request, response);
}
test();
```
This shows "Nothing to preview" in Dev Tools. Removing either the 'Accept' header from the request or the 'Vary' header from the response fixes the problem, and I can preview the cache entry just fine.
So it looks like the issue actually involves the 'Vary' header. I can't figure out how to update the issue title, unfortunately.
,
Sep 28
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
,
Sep 28
Not sure, but perhaps this is related to this existing issue: https://bugs.chromium.org/p/chromium/issues/detail?id=831557
,
Sep 28
Thank you. I think the problem is that the devtools front end queries the cache without any headers: https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/resources/ServiceWorkerCacheViews.js?l=321&rcl=2e5cf2b466005da06c1f6c9e5379ce19ff7f7626 Since the Response specifies a VARY header it means the devtools request does not match and you don't get any content. The InspectorCacheStorageAgent::requestCachedResponse() needs to allow headers to be passed and then devtools needs to pass them. This would be nice to fix, but its probably not time critical. So marking as a P3. I'm going to take this, but I probably won't get to it for a few weeks.
,
Sep 28
To help me figure out how to fix this, here is the CL where the feature was added: https://chromium-review.googlesource.com/c/chromium/src/+/560602
,
Sep 28
Thanks for tackling this!
,
Oct 1
,
Dec 3
What's the status of this?
,
Dec 4
Sorry, this fell off my radar. The main thing that needs to be fixed here is to pass headers across the c++/devtools boundary so a proper match can be made. Another, lamer, fix would be to set ignoreVary on the match and rely on the fact that cache_storage doesn't actually store more than one response per request URL right now. Thats a bug that will be fixed in cache_storage at some point, though, so it would be better to include the headers in the request instead.
,
Dec 4
|
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by wanderview@chromium.org
, Sep 28Labels: Needs-Feedback
111 KB
111 KB View Download
112 KB
112 KB View Download