Title: [151335] trunk
Revision
151335
Author
beid...@apple.com
Date
2013-06-07 13:52:40 -0700 (Fri, 07 Jun 2013)

Log Message

REGRESSION (r151088): Crash navigating away from non-loaded main resources with non-loaded scripts.
<rdar://problem/14052886> and https://bugs.webkit.org/show_bug.cgi?id=117278

Reviewed by Anders Carlsson.

Source/WebCore:

Test: http/tests/navigation/slow-loading-page-with-slow-script.php

* html/parser/HTMLScriptRunner.cpp:
(WebCore::HTMLScriptRunner::isPendingScriptReady): The script runner might be told about a script
  after it has already been detached (the main resource load has finished/failed/cancelled).
  Don't dereference a null document in that case.

LayoutTests:

* http/tests/navigation/slow-loading-page-with-slow-script-expected.txt: Added.
* http/tests/navigation/slow-loading-page-with-slow-script.php: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (151334 => 151335)


--- trunk/LayoutTests/ChangeLog	2013-06-07 20:33:06 UTC (rev 151334)
+++ trunk/LayoutTests/ChangeLog	2013-06-07 20:52:40 UTC (rev 151335)
@@ -1,3 +1,13 @@
+2013-06-07  Brady Eidson  <beid...@apple.com>
+
+        REGRESSION (r151088): Crash navigating away from non-loaded main resources with non-loaded scripts.
+        <rdar://problem/14052886> and https://bugs.webkit.org/show_bug.cgi?id=117278
+
+        Reviewed by Anders Carlsson.
+
+        * http/tests/navigation/slow-loading-page-with-slow-script-expected.txt: Added.
+        * http/tests/navigation/slow-loading-page-with-slow-script.php: Added.
+
 2013-06-07  Chris Fleizach  <cfleiz...@apple.com>
 
         MathML line fraction needs to parse number values

Added: trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script-expected.txt (0 => 151335)


--- trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script-expected.txt	2013-06-07 20:52:40 UTC (rev 151335)
@@ -0,0 +1 @@
+This page calls testRunner.notifyDone().

Added: trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script.php (0 => 151335)


--- trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script.php	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/slow-loading-page-with-slow-script.php	2013-06-07 20:52:40 UTC (rev 151335)
@@ -0,0 +1,41 @@
+<?php
+
+@apache_setenv('no-gzip', 1);
+@ini_set('zlib.output_compression', 0);
+@ini_set('implicit_flush', 1);
+for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
+ob_implicit_flush(1);
+
+header("HTTP/1.1 200 OK"); flush();
+
+echo str_repeat(" ", 1024)."<pre>"; flush();
+?>
+
+<script>
+
+if (window.testRunner) {
+	testRunner.dumpAsText();
+	testRunner.waitUntilDone();
+}
+
+</script>
+
+This page takes forever to load.<br>
+It also blocks on an external script that takes forever to load.<br>
+Without the fix for http://webkit.org/b/117278, navigating away from this page will crash.<br>
+So... navigating away should not crash!<br>
+
+<script>
+
+setTimeout("location.href = ''", 0);
+
+</script>
+
+<script src=''></script>
+
+<?php
+while(true)
+{
+    echo "Still loading...<br>\r\n"; flush(); sleep(1);
+}
+?>

Modified: trunk/Source/WebCore/ChangeLog (151334 => 151335)


--- trunk/Source/WebCore/ChangeLog	2013-06-07 20:33:06 UTC (rev 151334)
+++ trunk/Source/WebCore/ChangeLog	2013-06-07 20:52:40 UTC (rev 151335)
@@ -1,3 +1,17 @@
+2013-06-07  Brady Eidson  <beid...@apple.com>
+
+        REGRESSION (r151088): Crash navigating away from non-loaded main resources with non-loaded scripts.
+        <rdar://problem/14052886> and https://bugs.webkit.org/show_bug.cgi?id=117278
+
+        Reviewed by Anders Carlsson.
+
+        Test: http/tests/navigation/slow-loading-page-with-slow-script.php
+
+        * html/parser/HTMLScriptRunner.cpp:
+        (WebCore::HTMLScriptRunner::isPendingScriptReady): The script runner might be told about a script
+          after it has already been detached (the main resource load has finished/failed/cancelled).
+          Don't dereference a null document in that case.
+
 2013-06-07  Andy Estes  <aes...@apple.com>
 
         Compile WebCoreTestShimLibrary.cpp on iOS, but exclude the Carbon bits

Modified: trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp (151334 => 151335)


--- trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp	2013-06-07 20:33:06 UTC (rev 151334)
+++ trunk/Source/WebCore/html/parser/HTMLScriptRunner.cpp	2013-06-07 20:52:40 UTC (rev 151335)
@@ -101,6 +101,8 @@
 
 bool HTMLScriptRunner::isPendingScriptReady(const PendingScript& script)
 {
+    if (!m_document)
+        return false;
     m_hasScriptsWaitingForStylesheets = !m_document->haveStylesheetsLoaded();
     if (m_hasScriptsWaitingForStylesheets)
         return false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to