[Webkit-unassigned] [Bug 97044] New: Inconsistent caching of local resources

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 18 14:22:21 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=97044

           Summary: Inconsistent caching of local resources
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Page Loading
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: fmalita at chromium.org


Created an attachment (id=164622)
 --> (https://bugs.webkit.org/attachment.cgi?id=164622&action=review)
Local resource caching test

1) extract the attached archive
2) open local-cache.html in a tab (and do not close it): it should be displaying img1.png
3) copy img2.png -> img1.png
4) reload the tab: it's still showing img1.png

  double CachedResource::freshnessLifetime() const
  {
      // Cache non-http resources liberally
      if (!m_response.url().protocolIsInHTTPFamily())
          return std::numeric_limits<double>::max();

Based on this ^^^, one could argue that the above behavior is deliberate. But it's not consistent with how statically declared resources are handled: if inline styling is used instead of JS in the test above, reloading the tab refreshes the image as expected.

I tracked this down to CachedResourceLoader::determineRevalidationPolicy():

    // Check if the cache headers requires us to revalidate (cache expiration for example).
    if (existingResource->mustRevalidateDueToCacheHeaders(cachePolicy())) {
        ...

        return Reload;
    }
    return Use;

While the page is loading, cachePolicy() returns CachePolicyRevalidate and the branch is taken, forcing a reload. After the frame loader is finished, the cache policy is CachePolicyVerify due to FrameLoader::subresourceCachePolicy():

    if (m_isComplete)
        return CachePolicyVerify;

Since local resources never expire, the branch is not taken anymore and the cached resource is used.

I'm not familiar with the caching infrastructure, so it's unclear to me how/whether the behavior in these two cases can be aligned without making local resources effectively uncacheable. Maybe purging non-http resources on reload could be a compromise?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list