Title: [139230] trunk
Revision
139230
Author
[email protected]
Date
2013-01-09 12:53:45 -0800 (Wed, 09 Jan 2013)

Log Message

        Assertion failure in SubresourceLoader::didFail when reloading
        https://bugs.webkit.org/show_bug.cgi?id=101416

        Reviewed by Nate Chapin.

        Test: http/tests/cache/network-error-during-revalidation.html

        * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): Handle revalidation.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139229 => 139230)


--- trunk/LayoutTests/ChangeLog	2013-01-09 20:46:17 UTC (rev 139229)
+++ trunk/LayoutTests/ChangeLog	2013-01-09 20:53:45 UTC (rev 139230)
@@ -1,3 +1,17 @@
+2013-01-09  Alexey Proskuryakov  <[email protected]>
+
+        Assertion failure in SubresourceLoader::didFail when reloading
+        https://bugs.webkit.org/show_bug.cgi?id=101416
+
+        Reviewed by Nate Chapin.
+
+        * http/tests/cache/network-error-during-revalidation-expected.txt: Added.
+        * http/tests/cache/network-error-during-revalidation.html: Added.
+        * http/tests/cache/resources/network-error-during-revalidation-frame.html: Added.
+
+        * http/tests/resources/network-simulator.php: Added a way to serve resources
+        without no-cache no-store directives.
+
 2013-01-09  Alexandru Chiculita  <[email protected]>
 
         Assertion Failure in WebCore::RenderLayerCompositor::updateCompositingLayers

Added: trunk/LayoutTests/http/tests/cache/network-error-during-revalidation-expected.txt (0 => 139230)


--- trunk/LayoutTests/http/tests/cache/network-error-during-revalidation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/network-error-during-revalidation-expected.txt	2013-01-09 20:53:45 UTC (rev 139230)
@@ -0,0 +1,9 @@
+Test that failing revalidation with a network error does not cause a crash.
+
+Enabling network
+Loading an image once to cache it
+Disabling network
+Reloading to revalidate the image
+Enabling network
+Done
+
Property changes on: trunk/LayoutTests/http/tests/cache/network-error-during-revalidation-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:eol-style

Added: trunk/LayoutTests/http/tests/cache/network-error-during-revalidation.html (0 => 139230)


--- trunk/LayoutTests/http/tests/cache/network-error-during-revalidation.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/network-error-during-revalidation.html	2013-01-09 20:53:45 UTC (rev 139230)
@@ -0,0 +1,61 @@
+<body _onload_="startTest()">
+<p>Test that failing revalidation with a network error does not cause a crash.</p>
+<pre id=log></pre>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById("log").innerHTML += message + "\n";
+}
+
+function setNetworkEnabled(state)
+{
+    log(state ? "Enabling network" : "Disabling network");
+    var req = new XMLHttpRequest;
+    req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
+    req.send("");
+}
+
+function startTest()
+{
+    setNetworkEnabled(true);
+    log("Loading an image once to cache it");
+    var iframe = document.createElement("iframe");
+    iframe.src = ""
+    iframe._onload_ = imageLoaded;
+    document.body.appendChild(iframe);
+}
+
+function imageLoaded()
+{
+    setNetworkEnabled(false);
+    log("Reloading to revalidate the image");
+    var iframe = document.getElementsByTagName("iframe")[0];
+    iframe._onload_ = cachedLoadComplete;
+    iframe.contentWindow.location.reload();
+}
+
+function cachedLoadComplete()
+{
+    setNetworkEnabled(true);
+    log("Done");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function unexpectedError()
+{
+    log("Unexpected error");
+    setNetworkEnabled(true);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+
+</head>
+</body>
Property changes on: trunk/LayoutTests/http/tests/cache/network-error-during-revalidation.html
___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/http/tests/cache/resources/network-error-during-revalidation-frame.html (0 => 139230)


--- trunk/LayoutTests/http/tests/cache/resources/network-error-during-revalidation-frame.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/resources/network-error-during-revalidation-frame.html	2013-01-09 20:53:45 UTC (rev 139230)
@@ -0,0 +1 @@
+<img src=""
Property changes on: trunk/LayoutTests/http/tests/cache/resources/network-error-during-revalidation-frame.html
___________________________________________________________________

Added: svn:mime-type

Modified: trunk/LayoutTests/http/tests/resources/network-simulator.php (139229 => 139230)


--- trunk/LayoutTests/http/tests/resources/network-simulator.php	2013-01-09 20:46:17 UTC (rev 139229)
+++ trunk/LayoutTests/http/tests/resources/network-simulator.php	2013-01-09 20:53:45 UTC (rev 139230)
@@ -73,7 +73,8 @@
         if ($path[0] == '/')
             $path = '..' . $path;
 
-        generateNoCacheHTTPHeader();
+        if (!$_GET['allow-caching'])
+            generateNoCacheHTTPHeader();
 
         if (file_exists($path)) {
             header("Last-Modified: " . gmdate("D, d M Y H:i:s T", filemtime($path)));

Modified: trunk/Source/WebCore/ChangeLog (139229 => 139230)


--- trunk/Source/WebCore/ChangeLog	2013-01-09 20:46:17 UTC (rev 139229)
+++ trunk/Source/WebCore/ChangeLog	2013-01-09 20:53:45 UTC (rev 139230)
@@ -1,3 +1,14 @@
+2013-01-09  Alexey Proskuryakov  <[email protected]>
+
+        Assertion failure in SubresourceLoader::didFail when reloading
+        https://bugs.webkit.org/show_bug.cgi?id=101416
+
+        Reviewed by Nate Chapin.
+
+        Test: http/tests/cache/network-error-during-revalidation.html
+
+        * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFail): Handle revalidation.
+
 2013-01-09  Alexandru Chiculita  <[email protected]>
 
         Assertion Failure in WebCore::RenderLayerCompositor::updateCompositingLayers

Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (139229 => 139230)


--- trunk/Source/WebCore/loader/SubresourceLoader.cpp	2013-01-09 20:46:17 UTC (rev 139229)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp	2013-01-09 20:53:45 UTC (rev 139230)
@@ -283,12 +283,13 @@
     if (m_state != Initialized)
         return;
     ASSERT(!reachedTerminalState());
-    ASSERT(!m_resource->resourceToRevalidate());
     LOG(ResourceLoading, "Failed to load '%s'.\n", m_resource->url().string().latin1().data());
 
     RefPtr<SubresourceLoader> protect(this);
     CachedResourceHandle<CachedResource> protectResource(m_resource);
     m_state = Finishing;
+    if (m_resource->resourceToRevalidate())
+        memoryCache()->revalidationFailed(m_resource);
     m_resource->setResourceError(error);
     m_resource->error(CachedResource::LoadError);
     if (!m_resource->isPreloaded())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to