Bug 559311 - [HTML5] nsContentUtils::CreateContextualFragment doesn't cache HTML5 parser, r=hsivonen
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 15 Apr 2010 12:40:30 +0300
changeset 40786 d9d7de04f75d3b7aa1e1de69b34a7986c4b4b49e
parent 40785 83477896e72d9419e01271b2207dc3962ad0b7a0
child 40787 00acdc310884c3eed57765335c2237468cf0b73d
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen
bugs559311
milestone1.9.3a5pre
first release with
nightly linux32
d9d7de04f75d / 3.7a5pre / 20100415031558 / files
nightly linux64
d9d7de04f75d / 3.7a5pre / 20100415030714 / files
nightly mac
d9d7de04f75d / 3.7a5pre / 20100415030639 / files
nightly win32
d9d7de04f75d / 3.7a5pre / 20100415051417 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 559311 - [HTML5] nsContentUtils::CreateContextualFragment doesn't cache HTML5 parser, r=hsivonen
content/base/src/nsContentUtils.cpp
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -3725,17 +3725,16 @@ nsContentUtils::CreateContextualFragment
       parser->Reset();
     }
     else {
       // Create a new parser for this operation.
       parser = nsHtml5Module::NewHtml5Parser();
       if (!parser) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
-      document->SetFragmentParser(parser);
     }
     nsCOMPtr<nsIDOMDocumentFragment> frag;
     rv = NS_NewDocumentFragment(getter_AddRefs(frag), document->NodeInfoManager());
     NS_ENSURE_SUCCESS(rv, rv);
     
     nsCOMPtr<nsIContent> contextAsContent = do_QueryInterface(aContextNode);
     if (contextAsContent && !contextAsContent->IsNodeOfType(nsINode::eELEMENT)) {
       contextAsContent = contextAsContent->GetParent();
@@ -3755,16 +3754,17 @@ nsContentUtils::CreateContextualFragment
       parser->ParseFragment(aFragment, 
                             frag, 
                             nsGkAtoms::body, 
                             kNameSpaceID_XHTML, 
                             (document->GetCompatibilityMode() == eCompatibility_NavQuirks));
     }
   
     NS_ADDREF(*aReturn = frag);
+    document->SetFragmentParser(parser);
     return NS_OK;
   }
 
   nsAutoTArray<nsString, 32> tagStack;
   nsAutoString uriStr, nameStr;
   nsCOMPtr<nsIContent> content = do_QueryInterface(aContextNode);
   // just in case we have a text node
   if (content && !content->IsNodeOfType(nsINode::eELEMENT))