LayoutTests:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jul 2007 06:29:08 +0000 (06:29 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 Jul 2007 06:29:08 +0000 (06:29 +0000)
        Reviewed by Oliver.

        - test case for <rdar://problem/5133420> ASSERT in WebDocumentLoaderMac::decreaseLoadCount() un-discarding Gmail message

        * fast/loader/early-load-cancel-expected.txt: Added.
        * fast/loader/early-load-cancel.html: Added.
        * fast/loader/resources/early-load-cancel-inner.html: Added.

WebCore:

        Reviewed by Oliver.

        - fixed <rdar://problem/5133420> ASSERT in WebDocumentLoaderMac::decreaseLoadCount() un-discarding Gmail message

        test case: fast/loader/early-load-cancel.html

        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::didCancel): Don't send cancel-related client callbacks
        if we never even sent willSendRequest because we were deferred.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24087 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/loader/early-load-cancel-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/early-load-cancel.html [new file with mode: 0644]
LayoutTests/fast/loader/resources/early-load-cancel-inner.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/loader/ResourceLoader.cpp

index 0884310..83d75e5 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-06  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver.
+
+        - test case for <rdar://problem/5133420> ASSERT in WebDocumentLoaderMac::decreaseLoadCount() un-discarding Gmail message
+        
+        * fast/loader/early-load-cancel-expected.txt: Added.
+        * fast/loader/early-load-cancel.html: Added.
+        * fast/loader/resources/early-load-cancel-inner.html: Added.
+
 2007-07-06  Mitz Pettel  <mitz@webkit.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/loader/early-load-cancel-expected.txt b/LayoutTests/fast/loader/early-load-cancel-expected.txt
new file mode 100644 (file)
index 0000000..827f72f
--- /dev/null
@@ -0,0 +1,2 @@
+
+A series of unfortunate circumstances can load to starting a load and then cancelling it while loading is deferred, thus leading to a mismatched set of callbacks (it gets cancelled without ever starting). If this test does not crash or fail an assertion, then that bug is fixed.
diff --git a/LayoutTests/fast/loader/early-load-cancel.html b/LayoutTests/fast/loader/early-load-cancel.html
new file mode 100644 (file)
index 0000000..0f299d6
--- /dev/null
@@ -0,0 +1,12 @@
+<iframe src="resources/early-load-cancel-inner.html"></iframe>
+
+<p>A series of unfortunate circumstances can lead to starting a load
+and then cancelling it while loading is deferred, thus leading to a
+mismatched set of callbacks (it gets cancelled without ever
+starting). If this test does not crash or fail an assertion, then that
+bug is fixed.</p>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
diff --git a/LayoutTests/fast/loader/resources/early-load-cancel-inner.html b/LayoutTests/fast/loader/resources/early-load-cancel-inner.html
new file mode 100644 (file)
index 0000000..eb45595
--- /dev/null
@@ -0,0 +1,17 @@
+<a id="test" onmousedown="test()">click here</a>
+<div id="outer">
+</div>
+<script>
+function test()
+{
+    document.getElementById("outer").innerHTML = "<iframe src='other.html'></iframe>";
+    document.getElementById("outer").innerHTML = "PASSED";
+}
+
+if (window.eventSender) {
+    eventSender.mouseMoveTo(20, 20);
+    eventSender.mouseDown();
+}
+
+</script>
+
index a52c80e..a6de1e0 100644 (file)
@@ -1,3 +1,15 @@
+2007-07-06  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Oliver.
+
+        - fixed <rdar://problem/5133420> ASSERT in WebDocumentLoaderMac::decreaseLoadCount() un-discarding Gmail message
+        
+        test case: fast/loader/early-load-cancel.html
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::didCancel): Don't send cancel-related client callbacks
+        if we never even sent willSendRequest because we were deferred.
+
 2007-07-06  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Maciej.
index ebbb887..520a95e 100644 (file)
@@ -283,6 +283,7 @@ void ResourceLoader::didCancel(const ResourceError& error)
     // for a single delegate. Cancelling wins.
     m_cancelled = true;
     
+    bool m_hadHandle = m_handle;
     if (m_handle)
         m_handle->clearAuthentication();
 
@@ -291,7 +292,7 @@ void ResourceLoader::didCancel(const ResourceError& error)
         m_handle->cancel();
         m_handle = 0;
     }
-    if (m_sendResourceLoadCallbacks && !m_calledDidFinishLoad)
+    if (m_sendResourceLoadCallbacks && !m_calledDidFinishLoad && m_hadHandle)
         frameLoader()->didFailToLoad(this, error);
 
     releaseResources();