2011-08-24 Nate Chapin <japhet@chromium.org>
authorjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2011 20:16:45 +0000 (20:16 +0000)
committerjaphet@chromium.org <japhet@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Aug 2011 20:16:45 +0000 (20:16 +0000)
        Fix an intermittent crash in EventSource, when a
        reconnect timer triggers after a navigation
        away from the current page begins.
        https://bugs.webkit.org/show_bug.cgi?id=45202

        Reviewed by Alexey Proskuryakov.

        Test: http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html

        * page/EventSource.cpp:
        (WebCore::EventSource::connect): Don't set m_requestInFlight
            to true if ThreadableLoader::create() failed.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html [new file with mode: 0644]
LayoutTests/http/tests/eventsource/resources/wait-then-notify-done.php [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/EventSource.cpp

index 6e48f51..6294b5d 100644 (file)
@@ -1,3 +1,13 @@
+2011-08-24  Nate Chapin  <japhet@chromium.org>
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=45202.
+
+        Reviewed by Alexey Proskuryakov.
+
+        * http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt: Added.
+        * http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html: Added.
+        * http/tests/eventsource/resources/wait-then-notify-done.php: Added.
+
 2011-08-23  Peter Kasting  <pkasting@google.com>
 
         [chromium] Test expectation updates.
diff --git a/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt b/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash-expected.txt
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
diff --git a/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html b/LayoutTests/http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html
new file mode 100644 (file)
index 0000000..68aef92
--- /dev/null
@@ -0,0 +1,20 @@
+<html>
+<body>
+<p>Navigate while an EventSource reconnect timer is waiting, then have the reconnect timer trigger before the page unloads. We pass if we don't crash.
+<script>
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+}
+
+function navigate() {
+    window.location = "resources/wait-then-notify-done.php";
+}
+
+var es = new EventSource("resources/reconnect.php");
+es.onerror = function() {
+    setTimeout(navigate, 0);
+};
+</script>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/eventsource/resources/wait-then-notify-done.php b/LayoutTests/http/tests/eventsource/resources/wait-then-notify-done.php
new file mode 100644 (file)
index 0000000..45cb8c7
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+header("Content-Type: text/html");
+header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Pragma: no-cache");
+sleep(1);
+echo "<script> if (window.layoutTestController) layoutTestController.notifyDone()</script>\n";
+?>
index 73deb91..76905d2 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-24  Nate Chapin  <japhet@chromium.org>
+
+        Fix an intermittent crash in EventSource, when a
+        reconnect timer triggers after a navigation
+        away from the current page begins.
+        https://bugs.webkit.org/show_bug.cgi?id=45202
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test: http/tests/eventsource/eventsource-reconnect-during-navigate-crash.html
+
+        * page/EventSource.cpp:
+        (WebCore::EventSource::connect): Don't set m_requestInFlight
+            to true if ThreadableLoader::create() failed.
+
 2011-08-24  Mike Reed  <reed@google.com>
 
         Change clip routine to promote the clipbounds up to (local) floats and then perform the intersection,
index 5e05def..3b5bb25 100644 (file)
@@ -120,7 +120,8 @@ void EventSource::connect()
 
     m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
 
-    m_requestInFlight = true;
+    if (m_loader)
+        m_requestInFlight = true;
 }
 
 void EventSource::endRequest()