Bug 42051 - browser cache and webkit cache used for resources listed as fallback and/or network in cache manifest file.
Summary: browser cache and webkit cache used for resources listed as fallback and/or n...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://htmltest.freetzi.com/fallback/...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-11 18:35 PDT by Lyon Chen
Modified: 2010-07-13 10:41 PDT (History)
4 users (show)

See Also:


Attachments
patch for 42051 (4.35 KB, patch)
2010-07-11 18:42 PDT, Lyon Chen
no flags Details | Formatted Diff | Diff
patch for 42051 (5.71 KB, patch)
2010-07-11 21:54 PDT, Lyon Chen
ap: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lyon Chen 2010-07-11 18:35:33 PDT
When loading resources listed in fallback and/or network sections in a cache manifest file, we use webkit cache and browser cache, which could result in wrong resource used when online status changed during a browser session:

Steps to reproduce:
1. load http://htmltest.freetzi.com/fallback/index.html;
2. the image should display "online";
3. remove all network connection;
4. open a new tab and load http://htmltest.freetzi.com/fallback/index.html;
5. the image should display "offline", but it shows "online".

The reason is when we loading online.gif for the new tab, it doesn't check whether it's a fallback resource before we load it from webkit cache.

Another aspect of this issue is, we can also load fallback/network resources from browser cache, so we also need to make every load of fallback/network resources with cache policy of CachePolicyReload/ReloadIgnoringCacheData.
Comment 1 Lyon Chen 2010-07-11 18:42:36 PDT
Created attachment 61184 [details]
patch for 42051
Comment 2 Lyon Chen 2010-07-11 21:54:24 PDT
Created attachment 61190 [details]
patch for 42051

Updated with dummy implementation of ApplicationCacheHost::isFallbackOrNetworkResource() for Chromium port, which don't need it except for compiling purpose.
Comment 3 Alexey Proskuryakov 2010-07-12 11:52:15 PDT
Say, there is an offline app for an image gallery, and it loads images from network, having the URLs in NETWORK section. Surely we don't want to bypass network loader cache for these, and the behavior you describe is better than the alternative.

When I last looked at the spec, it didn't say that we should bypass caches. If you think that would be a better behavior, it should probably be incorporated in the spec first.
Comment 4 Lyon Chen 2010-07-12 12:18:13 PDT
(In reply to comment #3)
> When I last looked at the spec, it didn't say that we should bypass caches. If you think that would be a better behavior, it should probably be incorporated in the spec first.

Yeah, I agree there's no specific mentioning bypass user agent specific caches like webkit cache and webkit client application cache in the spec, but I do think without bypassing all these caches, we will give these web applications a wrong information that it's still online, while it is not, as shown my reproduce steps listed above.
Comment 5 Alexey Proskuryakov 2010-07-12 12:29:17 PDT
A Web application can always serve the resource with pragma no-store to prevent caching if that's the way it discovers the "online" state.

Re-reading comment 3, I think that it can be misread, so to avoid confusion, my position is that the current behavior is preferable.

If you would like to change it, I think that the best thing to do would be to e-mail WHATWG or W3C HTMLWG mailing list, asking for a clarification and a possible spec change.
Comment 6 Lyon Chen 2010-07-12 12:42:59 PDT
(In reply to comment #5)
> If you would like to change it, I think that the best thing to do would be to e-mail WHATWG or W3C HTMLWG mailing list, asking for a clarification and a possible spec change.

Good suggestion, will ask for clarification on this.
Comment 7 Lyon Chen 2010-07-13 10:25:28 PDT
(In reply to comment #6)

Based on comments above by Alexey Proskuryakov, and comments in webkit-dev and whatwg@lists.whatwg.org, I agree this bug is not valid. Offline web application should use cache-control if they want to make sure the resources in fallback list are from original server.