Title: [147263] trunk/Source/WebCore
Revision
147263
Author
[email protected]
Date
2013-03-29 17:04:17 -0700 (Fri, 29 Mar 2013)

Log Message

Let cached resources from file: schemes expire immediately
https://bugs.webkit.org/show_bug.cgi?id=113626

Reviewed by Brady Eidson

When a CachedResource was loaded from a file: URL, we would give it an
indefinite freshness lifetime. This means that we would continue to
serve a stale resource from the memory cache even if the file was
changed on disk. With the introduction of main resource caching, this
behavior broke at least one third-party WebKit app (see <rdar://problem/13313769>).

We should instead let file resources expire immediately. Modern
filesystems implement their own caching, so we should get good
performance for multiple reads of unmodified files without doing our
own caching.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::freshnessLifetime): file: URLs should have a
0 freshness lifetime.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147262 => 147263)


--- trunk/Source/WebCore/ChangeLog	2013-03-29 23:41:54 UTC (rev 147262)
+++ trunk/Source/WebCore/ChangeLog	2013-03-30 00:04:17 UTC (rev 147263)
@@ -1,3 +1,25 @@
+2013-03-29  Andy Estes  <[email protected]>
+
+        Let cached resources from file: schemes expire immediately
+        https://bugs.webkit.org/show_bug.cgi?id=113626
+
+        Reviewed by Brady Eidson
+
+        When a CachedResource was loaded from a file: URL, we would give it an
+        indefinite freshness lifetime. This means that we would continue to
+        serve a stale resource from the memory cache even if the file was
+        changed on disk. With the introduction of main resource caching, this
+        behavior broke at least one third-party WebKit app (see <rdar://problem/13313769>).
+
+        We should instead let file resources expire immediately. Modern
+        filesystems implement their own caching, so we should get good
+        performance for multiple reads of unmodified files without doing our
+        own caching.
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::freshnessLifetime): file: URLs should have a
+        0 freshness lifetime.
+
 2013-03-29  Ojan Vafai  <[email protected]>
 
         Flexitems no longer default min-width to min-content

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (147262 => 147263)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2013-03-29 23:41:54 UTC (rev 147262)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2013-03-30 00:04:17 UTC (rev 147263)
@@ -432,7 +432,14 @@
     
 double CachedResource::freshnessLifetime() const
 {
-    // Cache non-http resources liberally
+    // Let file: resources expire immediately so that we don't serve a stale
+    // resource when a file has changed underneath us. Modern filesystems
+    // implement their own caches, so we should still get good performance if
+    // the resource hasn't changed.
+    if (m_response.url().protocolIs("file"))
+        return 0;
+
+    // Cache other non-http resources liberally.
     if (!m_response.url().protocolIsInHTTPFamily())
         return std::numeric_limits<double>::max();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to