Title: [142525] trunk
Revision
142525
Author
aba...@webkit.org
Date
2013-02-11 15:11:24 -0800 (Mon, 11 Feb 2013)

Log Message

The threaded HTML parser should pass all the fast/parser tests
https://bugs.webkit.org/show_bug.cgi?id=109486

Reviewed by Tony Gentilcore.

Source/WebCore:

This patch fixes the last two test failures in fast/parser, which were
crashes caused by not having a tokenizer when document.close() was
called. (The tokenizer is created lazily by calls to document.write,
which might not happen before document.close).

fast/parser/document-close-iframe-load.html
fast/parser/document-close-nested-iframe-load.html

In addition, I've added a new test to make sure we flush the tokenizer
properly in these cases.

Test: fast/parser/document-close-iframe-load-partial-entity.html

* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::prepareToStopParsing):
(WebCore::HTMLDocumentParser::pumpTokenizer):

LayoutTests:

* fast/parser/document-close-iframe-load-partial-entity-expected.txt: Added.
* fast/parser/document-close-iframe-load-partial-entity.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (142524 => 142525)


--- trunk/LayoutTests/ChangeLog	2013-02-11 23:07:43 UTC (rev 142524)
+++ trunk/LayoutTests/ChangeLog	2013-02-11 23:11:24 UTC (rev 142525)
@@ -1,3 +1,13 @@
+2013-02-11  Adam Barth  <aba...@webkit.org>
+
+        The threaded HTML parser should pass all the fast/parser tests
+        https://bugs.webkit.org/show_bug.cgi?id=109486
+
+        Reviewed by Tony Gentilcore.
+
+        * fast/parser/document-close-iframe-load-partial-entity-expected.txt: Added.
+        * fast/parser/document-close-iframe-load-partial-entity.html: Added.
+
 2013-02-11  Julien Chaffraix  <jchaffr...@webkit.org>
 
         Unreviewed Chromium rebaselining after r142500.

Added: trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity-expected.txt (0 => 142525)


--- trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity-expected.txt	2013-02-11 23:11:24 UTC (rev 142525)
@@ -0,0 +1,2 @@
+ALERT: This test passes if the text "&g" appears below.
+&g

Added: trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity.html (0 => 142525)


--- trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity.html	                        (rev 0)
+++ trunk/LayoutTests/fast/parser/document-close-iframe-load-partial-entity.html	2013-02-11 23:11:24 UTC (rev 142525)
@@ -0,0 +1,7 @@
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+alert('This test passes if the text "&g" appears below.');
+</script>
+This test passes if it doesn't crash.
+<iframe _onload_="document.open();document.write('&g');document.close();" >

Modified: trunk/Source/WebCore/ChangeLog (142524 => 142525)


--- trunk/Source/WebCore/ChangeLog	2013-02-11 23:07:43 UTC (rev 142524)
+++ trunk/Source/WebCore/ChangeLog	2013-02-11 23:11:24 UTC (rev 142525)
@@ -1,3 +1,27 @@
+2013-02-11  Adam Barth  <aba...@webkit.org>
+
+        The threaded HTML parser should pass all the fast/parser tests
+        https://bugs.webkit.org/show_bug.cgi?id=109486
+
+        Reviewed by Tony Gentilcore.
+
+        This patch fixes the last two test failures in fast/parser, which were
+        crashes caused by not having a tokenizer when document.close() was
+        called. (The tokenizer is created lazily by calls to document.write,
+        which might not happen before document.close).
+
+        fast/parser/document-close-iframe-load.html
+        fast/parser/document-close-nested-iframe-load.html
+
+        In addition, I've added a new test to make sure we flush the tokenizer
+        properly in these cases.
+
+        Test: fast/parser/document-close-iframe-load-partial-entity.html
+
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::prepareToStopParsing):
+        (WebCore::HTMLDocumentParser::pumpTokenizer):
+
 2013-02-11  Bruno de Oliveira Abinader  <bruno.abina...@basyskom.com>
 
         [texmap] Implement frames-per-second debug counter

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (142524 => 142525)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-02-11 23:07:43 UTC (rev 142524)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-02-11 23:11:24 UTC (rev 142525)
@@ -162,12 +162,16 @@
     // but we need to ensure it isn't deleted yet.
     RefPtr<HTMLDocumentParser> protect(this);
 
-#if ENABLE(THREADED_HTML_PARSER)
     // NOTE: This pump should only ever emit buffered character tokens,
     // so ForceSynchronous vs. AllowYield should be meaningless.
-    if (!m_haveBackgroundParser)
+#if ENABLE(THREADED_HTML_PARSER)
+    if (m_tokenizer) {
+        ASSERT(!m_haveBackgroundParser);
+        pumpTokenizerIfPossible(ForceSynchronous);
+    }
+#else
+    pumpTokenizerIfPossible(ForceSynchronous);
 #endif
-        pumpTokenizerIfPossible(ForceSynchronous);
 
     if (isStopped())
         return;
@@ -388,7 +392,8 @@
     ASSERT(!isScheduledForResume());
     // ASSERT that this object is both attached to the Document and protected.
     ASSERT(refCount() >= 2);
-
+    ASSERT(m_tokenizer);
+    ASSERT(m_token);
     ASSERT(!shouldUseThreading() || mode == ForceSynchronous);
 
     PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to