Title: [143685] trunk/Source/WebCore
Revision
143685
Author
[email protected]
Date
2013-02-21 20:03:41 -0800 (Thu, 21 Feb 2013)

Log Message

Invalidate outstanding checkpoints for the background input stream and preload scanner
https://bugs.webkit.org/show_bug.cgi?id=110537

Reviewed by Adam Barth.

fast/tokenizer/write-before-load.html caused duplicate didFailSpeculation() calls for the same checkpoint.
One was triggered by processParsedChunkFromBackgroundParser and the other by resumeParsingAfterScriptExecution.
This change ensures that after we send a checkpoint, it is cleared so it won't be sent again until the next
processParsedChunkFromBackgroundParser().

No new tests because no new functionality.

* html/parser/BackgroundHTMLInputStream.cpp:
(WebCore::BackgroundHTMLInputStream::rewindTo):
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::didFailSpeculation):
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::rewindTo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143684 => 143685)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 03:19:46 UTC (rev 143684)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 04:03:41 UTC (rev 143685)
@@ -1,3 +1,24 @@
+2013-02-21  Tony Gentilcore  <[email protected]>
+
+        Invalidate outstanding checkpoints for the background input stream and preload scanner
+        https://bugs.webkit.org/show_bug.cgi?id=110537
+
+        Reviewed by Adam Barth.
+
+        fast/tokenizer/write-before-load.html caused duplicate didFailSpeculation() calls for the same checkpoint.
+        One was triggered by processParsedChunkFromBackgroundParser and the other by resumeParsingAfterScriptExecution.
+        This change ensures that after we send a checkpoint, it is cleared so it won't be sent again until the next
+        processParsedChunkFromBackgroundParser().
+
+        No new tests because no new functionality.
+
+        * html/parser/BackgroundHTMLInputStream.cpp:
+        (WebCore::BackgroundHTMLInputStream::rewindTo):
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::didFailSpeculation):
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::rewindTo):
+
 2013-02-21  Dean Jackson  <[email protected]>
 
         Followup commit for https://bugs.webkit.org/show_bug.cgi?id=110541

Modified: trunk/Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp (143684 => 143685)


--- trunk/Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp	2013-02-22 03:19:46 UTC (rev 143684)
+++ trunk/Source/WebCore/html/parser/BackgroundHTMLInputStream.cpp	2013-02-22 04:03:41 UTC (rev 143685)
@@ -71,10 +71,8 @@
     if (isClosed && !m_current.isClosed())
         m_current.close();
 
-    // FIXME: We should be able to actively invalidate all the outstanding checkpoints
-    // by clearing m_segments and m_checkpoints, but that causes
-    // fast/tokenizer/write-before-load.html to hit the ASSERT at the beginning of
-    // this function.
+    m_segments.clear();
+    m_checkpoints.clear();
 }
 
 }

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (143684 => 143685)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-02-22 03:19:46 UTC (rev 143684)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2013-02-22 04:03:41 UTC (rev 143685)
@@ -308,6 +308,9 @@
 
 void HTMLDocumentParser::didFailSpeculation(PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer> tokenizer)
 {
+    if (!m_currentChunk)
+        return;
+
     m_weakFactory.revokeAll();
     m_speculations.clear();
 
@@ -319,6 +322,7 @@
     checkpoint->preloadScannerCheckpoint = m_currentChunk->preloadScannerCheckpoint;
     checkpoint->unparsedInput = m_input.current().toString().isolatedCopy();
     m_input.current().clear();
+    m_currentChunk.clear();
 
     ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread());
     HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::resumeFrom, m_backgroundParser, checkpoint.release()));

Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (143684 => 143685)


--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2013-02-22 03:19:46 UTC (rev 143684)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp	2013-02-22 04:03:41 UTC (rev 143685)
@@ -283,10 +283,7 @@
     m_templateCount = checkpoint.templateCount;
 #endif
     m_cssScanner.reset();
-
-    // FIXME: We should be able to actively invalidate all the outstanding checkpoints
-    // by clearing m_checkpoints, but that causes fast/tokenizer/write-before-load.html
-    // to hit the ASSERT at the beginning of this function.
+    m_checkpoints.clear();
 }
 
 void TokenPreloadScanner::scan(const HTMLToken& token, Vector<OwnPtr<PreloadRequest> >& requests)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to