New issue
Advanced search Search tips

Issue 890359 link

Starred by 2 users

Issue metadata

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



Sign in to add a comment

devtools cannot preview cache_storage Response objects with a VARY header

Reported by se...@fullstory.com, Sep 28

Issue description

UserAgent: 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.
 
Cc: wanderview@chromium.org
Labels: Needs-Feedback
I can't reproduce this on chromeos or linux.  See the attached screenshots.

Are your synthetic responses getting a content-type header set?  Does setting an appropriate header help?
synthetic-console.png
111 KB View Download
synthetic-applications.png
112 KB View Download
Components: Blink>Storage>CacheStorage
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.
Project Member

Comment 4 by sheriffbot@chromium.org, Sep 28

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
Not sure, but perhaps this is related to this existing issue:

https://bugs.chromium.org/p/chromium/issues/detail?id=831557
Labels: -Pri-2 Pri-3
Status: Assigned (was: Unconfirmed)
Summary: devtools cannot preview cache_storage Response objects with a VARY header (was: The preview for Cache Storage entries from synthetic Responses is empty)
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.
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
Thanks for tackling this!
Owner: wanderview@chromium.org
What's the status of this?
Owner: ----
Status: Available (was: Assigned)
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.
Owner: hhli@chromium.org
Status: Assigned (was: Available)

Sign in to add a comment