Reviewed by Brady.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Sep 2006 20:18:46 +0000 (20:18 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 17 Sep 2006 20:18:46 +0000 (20:18 +0000)
        http://bugzilla.opendarwin.org/show_bug.cgi?id=10852
        REGRESSION: Reproducible crash in XMLHttpRequest::abort()

        Test: http/tests/xmlhttprequest/xhr-onunload.html

        * xml/xmlhttprequest.cpp:
        (WebCore::XMLHttpRequest::send): Check the return value of ResourceLoader::start().

        * loader/icon/IconLoader.cpp:
        (IconLoader::startLoading): Fix a similar latent bug here.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/xmlhttprequest/xhr-onunload-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/xmlhttprequest/xhr-onunload.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/loader/icon/IconLoader.cpp
WebCore/xml/xmlhttprequest.cpp

index 73afcdfbac5b14348efd6c8d4ca5a157a1cfc94a..db9e5bccda78174e528c8ba4f33cc0f7ed44f436 100644 (file)
@@ -1,3 +1,16 @@
+2006-09-17  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Brady.
+
+        Test for http://bugzilla.opendarwin.org/show_bug.cgi?id=10852
+        REGRESSION: Reproducible crash in XMLHttpRequest::abort()
+
+        Currently, this test prints an error message to the console, because requests from
+        an unload handler still don't work.
+
+        * http/tests/xmlhttprequest/xhr-onunload-expected.txt: Added.
+        * http/tests/xmlhttprequest/xhr-onunload.html: Added.
+
 2006-09-15  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by harrison
diff --git a/LayoutTests/http/tests/xmlhttprequest/xhr-onunload-expected.txt b/LayoutTests/http/tests/xmlhttprequest/xhr-onunload-expected.txt
new file mode 100644 (file)
index 0000000..d181ae3
--- /dev/null
@@ -0,0 +1,5 @@
+Test for bug 10852: REGRESSION: Reproducible crash in XMLHttpRequest::abort().
+
+Press Cmd+R to reload (should not crash).
+
+
diff --git a/LayoutTests/http/tests/xmlhttprequest/xhr-onunload.html b/LayoutTests/http/tests/xmlhttprequest/xhr-onunload.html
new file mode 100644 (file)
index 0000000..3f3ea37
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<head>
+<title></title>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<body onunload="test('xhr-ununload.html')">
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=10852">bug 10852</a>:
+REGRESSION: Reproducible crash in XMLHttpRequest::abort().
+<p>Press Cmd+R to reload (should not crash).</p>
+<!-- When running as an automated test, crashes when loading the next test case. -->
+<script>
+    
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    function test(url)
+    {
+        req = new XMLHttpRequest();
+        req.open('GET', url, true);
+        req.send(null);
+    }
+    
+</script>
+</body>
+</html>
index 6684c2ecd73ba86cb3e7671535197462d5fa41ba..21c8b081710925970799159e2d30c30dece01c5b 100644 (file)
@@ -1,3 +1,18 @@
+2006-09-17  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by Brady.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10852
+        REGRESSION: Reproducible crash in XMLHttpRequest::abort()
+
+        Test: http/tests/xmlhttprequest/xhr-onunload.html
+
+        * xml/xmlhttprequest.cpp:
+        (WebCore::XMLHttpRequest::send): Check the return value of ResourceLoader::start().
+
+        * loader/icon/IconLoader.cpp:
+        (IconLoader::startLoading): Fix a similar latent bug here.
+
 2006-09-17  Adam Roben  <aroben@apple.com>
 
         Build fix.
index 1e2715ed44b806b2ed7e9372a7a92f2cd5dbaf82..bc9a787c339a6ce9dea54bffb23d5b004a8d9101 100644 (file)
@@ -67,9 +67,7 @@ void IconLoader::startLoading()
     ASSERT(m_frame->document());
     if (!m_resourceLoader->start(m_frame->document()->docLoader())) {
         LOG_ERROR("Failed to start load for icon at url %s", m_frame->iconURL().url().ascii());
-        delete m_resourceLoader;
         m_resourceLoader = 0;
-        return;
     }
 }
 
index a1ab0bb1a331dd25a1cc4a91333d72dfdb230af8..94eb64b6355b7d31db824244415cf4fa0332812e 100644 (file)
@@ -347,7 +347,10 @@ void XMLHttpRequest::send(const String& body)
         gcProtectNullTolerant(KJS::ScriptInterpreter::getDOMObject(this));
     }
   
-    m_job->start(m_doc->docLoader());
+    if (!m_job->start(m_doc->docLoader())) {
+        LOG_ERROR("Failed to send an XMLHttpRequest for %s", m_url.url().ascii());
+        m_job = 0;
+    }
 }
 
 void XMLHttpRequest::abort()