Bug 721313 - Do not run normal parse end code when parsing a full document from string. r=smaug.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 26 Jan 2012 15:59:22 +0200
changeset 86704 39b235bc0ac475c4dcd5e540921a57f5fd56adcb
parent 86703 9b70467dfec07fe3c7da8c65bb0f94a1a9f5e9c3
child 86705 6f3b4c36b2850ebb13adb23f8b6ce716fe7b54b4
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs721313
milestone12.0a1
Bug 721313 - Do not run normal parse end code when parsing a full document from string. r=smaug.
parser/html/nsHtml5TreeOpExecutor.cpp
parser/htmlparser/tests/crashtests/721313-1.html
parser/htmlparser/tests/crashtests/crashtests.list
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -131,20 +131,22 @@ nsHtml5TreeOpExecutor::DidBuildModel(boo
     
     // If the above caused a call to nsIParser::Terminate(), let that call
     // win.
     if (!mParser) {
       return NS_OK;
     }
   }
   
-  if (!mRunsToCompletion) {
-    GetParser()->DropStreamParser();
+  if (mRunsToCompletion) {
+    return NS_OK;
   }
 
+  GetParser()->DropStreamParser();
+
   // This comes from nsXMLContentSink and nsHTMLContentSink
   DidBuildModelImpl(aTerminated);
 
   if (!mLayoutStarted) {
     // We never saw the body, and layout never got started. Force
     // layout *now*, to get an initial reflow.
 
     // NOTE: only force the layout if we are NOT destroying the
new file mode 100644
--- /dev/null
+++ b/parser/htmlparser/tests/crashtests/721313-1.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<script>(new DOMParser()).parseFromString("", "text/html");</script>
--- a/parser/htmlparser/tests/crashtests/crashtests.list
+++ b/parser/htmlparser/tests/crashtests/crashtests.list
@@ -44,8 +44,9 @@ load 522326-1.html
 load 536097-1.html
 load 563514-1.html
 load 574884-1.html
 load 574884-2.html
 load 591330-1.html
 load 650501-1.xhtml
 load 696651-1.html
 load view-source:699347-1.xml
+load 721313-1.html