New issue
Advanced search Search tips

Issue 893438 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 26
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

HEAD Request Invalidates Cache

Project Member Reported by seanzarrin@google.com, Oct 9

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. Instantiate an image in Javascript and assign it a src
2. Issue a HEAD request to the same image url
3. Instantiate a second image and assign it the same src

See jsfiddle here: https://jsfiddle.net/3qgk6yrc/

What is the expected behavior?
Instantiating the second image should not have triggered a second request.

What went wrong?
The HEAD request somehow invalidates the cache. The second image that is instantiated triggers an additional request (but it should have been able to use cache). With the HEAD request removed, cache is used as expected.

See jsfiddle with HEAD request removed: https://jsfiddle.net/3qgk6yrc/

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 69.0.3497.100  Channel: stable
OS Version: OS X 10.13.6
Flash Version: 

This seems to work as expected in Firefox.
 
Components: -Blink>Image Blink>Network>XHR
Status: Untriaged (was: Unconfirmed)
Presumably this is because the XHR request is of the "raw" type, pushes the "image" type out and then again require a reload for the next image request.
Owner: yhirano@chromium.org
Status: Assigned (was: Untriaged)
+yhirano, is this the expected behaviour?
Components: Blink>Loader
The second image request in Comment #0 seems to hit Disk Cache (tested on 69.0.3497.95 Chromeos) and thus no network requests are sent.

Perhaps, by skipping MemoryCache::Remove() for RawResources (which aren't added to MemoryCache) at
https://codesearch.chromium.org/chromium/src/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc?type=cs&sq=package:chromium&g=0&l=869
will make the image request at Step 3 hit the MemoryCache.

However, this causes the following behavior:
If we have three requests to the same URL:
1. image request => fetched from network, got Payload1.
1.5 the content of the URL is updated on the server.
2. XHR GET => fetched from network, got different Payload2.
3. image request -> hit MemoryCache, and therefore got Payload1.
After this, image requests will get Payload1 while XHRs will get Payload2.
Is this inconsistent, or an acceptable cache behavior?

Comment 4 Deleted

Labels: -Needs-Feedback
I'm not sure if it's a good behavior but I think it's an acceptable behavior and I'm leaning to closing this bug as WONTFIX. seanzarrin@, can you tell me why the expected behavior in the issue description is important for you?
Labels: Needs-Feedback
I reported the issue since the behavior was not what I would have expected, but the impact does not seem too high.
Status: WontFix (was: Assigned)

Sign in to add a comment