Title: [172215] trunk/Source/WebCore
Revision
172215
Author
psola...@apple.com
Date
2014-08-07 10:20:16 -0700 (Thu, 07 Aug 2014)

Log Message

Random resource replacement on beta.icloud.com
https://bugs.webkit.org/show_bug.cgi?id=135685
<rdar://problem/17937975>

Reviewed by Alexey Proskuryakov.

Revert the performance optimization in r170499. It turns out we could get a delayed disk
cache notification for a resource that has since been changed in WebCore. In such a case, we
were replacing the newer resource data with the older disk cached resource data. This was
happening for cached POST content on beta.icloud.com. Fix this by forcing a memcmp of data
contents before replacing it which is what we used to do before.

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::tryReplaceEncodedData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (172214 => 172215)


--- trunk/Source/WebCore/ChangeLog	2014-08-07 16:37:59 UTC (rev 172214)
+++ trunk/Source/WebCore/ChangeLog	2014-08-07 17:20:16 UTC (rev 172215)
@@ -1,3 +1,20 @@
+2014-08-07  Pratik Solanki  <psola...@apple.com>
+
+        Random resource replacement on beta.icloud.com
+        https://bugs.webkit.org/show_bug.cgi?id=135685
+        <rdar://problem/17937975>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Revert the performance optimization in r170499. It turns out we could get a delayed disk
+        cache notification for a resource that has since been changed in WebCore. In such a case, we
+        were replacing the newer resource data with the older disk cached resource data. This was
+        happening for cached POST content on beta.icloud.com. Fix this by forcing a memcmp of data
+        contents before replacing it which is what we used to do before.
+
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::tryReplaceEncodedData):
+
 2014-08-06  Brent Fulgham  <bfulg...@apple.com>
 
         [Mac, iOS] Captions are appearing multiple times during repeated video play through

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (172214 => 172215)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2014-08-07 16:37:59 UTC (rev 172214)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2014-08-07 17:20:16 UTC (rev 172215)
@@ -896,8 +896,11 @@
     if (!mayTryReplaceEncodedData())
         return;
 
-    ASSERT(m_data->size() == newBuffer->size());
-    ASSERT(!memcmp(m_data->data(), newBuffer->data(), m_data->size()));
+    // We have to do the memcmp because we can't tell if the replacement file backed data is for the
+    // same resource or if we made a second request with the same URL which gave us a different
+    // resource. We have seen this happen for cached POST resources.
+    if (m_data->size() != newBuffer->size() || memcmp(m_data->data(), newBuffer->data(), m_data->size()))
+        return;
 
     m_data->tryReplaceSharedBufferContents(newBuffer.get());
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to