Bug 959150 part 7 - Retain probable bugs instead of changing behavior right now. r=smaug.
authorHenri Sivonen <hsivonen@hsivonen.fi>
Wed, 05 Mar 2014 21:38:50 +0200
changeset 189498 f516327022975f2962f9ae3ecfa80314a4aa5118
parent 189497 5182bb4118cc1bb809d0211c660f1bba0a693abc
child 189499 47882484a98db000eb488ff10574d3fa303a6d2a
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs959150
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 959150 part 7 - Retain probable bugs instead of changing behavior right now. r=smaug.
parser/html/nsHtml5TreeBuilderCppSupplement.h
parser/html/nsHtml5TreeOperation.cpp
parser/html/nsHtml5TreeOperation.h
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -530,17 +530,18 @@ nsHtml5TreeBuilder::addAttributesToEleme
 }
 
 void
 nsHtml5TreeBuilder::markMalformedIfScript(nsIContentHandle* aElement)
 {
   NS_PRECONDITION(aElement, "Null element");
 
   if (mBuilder) {
-    // XXX innerHTML
+    nsHtml5TreeOperation::MarkMalformedIfScript(
+      static_cast<nsIContent*>(aElement));
     return;
   }
 
   nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
   NS_ASSERTION(treeOp, "Tree op allocation failed.");
   treeOp->Init(eTreeOpMarkMalformedIfScript, aElement);
 }
 
@@ -727,22 +728,21 @@ nsHtml5TreeBuilder::elementPopped(int32_
       return;
     }
     nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
     NS_ASSERTION(treeOp, "Tree op allocation failed.");
     treeOp->Init(eTreeOpUpdateStyleSheet, aElement);
     return;
   }
   if (aNamespace == kNameSpaceID_SVG) {
-    if (mBuilder) {
-      // XXX innerHTML
-      // is this ever needed for the on-the-main-thread case
-      return;
-    }
     if (aName == nsHtml5Atoms::svg) {
+      if (mBuilder) {
+        nsHtml5TreeOperation::SvgLoad(static_cast<nsIContent*>(aElement));
+        return;
+      }
       nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
       NS_ASSERTION(treeOp, "Tree op allocation failed.");
       treeOp->Init(eTreeOpSvgLoad, aElement);
     }
     return;
   }
   // we now have only HTML
   // Some HTML nodes need DoneAddingChildren() called to initialize
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -616,16 +616,35 @@ nsHtml5TreeOperation::DoneAddingChildren
 }
 
 void
 nsHtml5TreeOperation::DoneCreatingElement(nsIContent* aNode)
 {
   aNode->DoneCreatingElement();
 }
 
+void
+nsHtml5TreeOperation::SvgLoad(nsIContent* aNode)
+{
+  nsCOMPtr<nsIRunnable> event = new nsHtml5SVGLoadDispatcher(aNode);
+  if (NS_FAILED(NS_DispatchToMainThread(event))) {
+    NS_WARNING("failed to dispatch svg load dispatcher");
+  }
+}
+
+void
+nsHtml5TreeOperation::MarkMalformedIfScript(nsIContent* aNode)
+{
+  nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aNode);
+  if (sele) {
+    // Make sure to serialize this script correctly, for nice round tripping.
+    sele->SetIsMalformed();
+  }
+}
+
 nsresult
 nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
                               nsIContent** aScriptElement)
 {
   switch(mOpCode) {
     case eTreeOpAppend: {
       nsIContent* node = *(mOne.node);
       nsIContent* parent = *(mTwo.node);
@@ -783,21 +802,17 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
     case eTreeOpProcessOfflineManifest: {
       char16_t* str = mOne.unicharPtr;
       nsDependentString dependentString(str);
       aBuilder->ProcessOfflineManifest(dependentString);
       return NS_OK;
     }
     case eTreeOpMarkMalformedIfScript: {
       nsIContent* node = *(mOne.node);
-      nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node);
-      if (sele) {
-        // Make sure to serialize this script correctly, for nice round tripping.
-        sele->SetIsMalformed();
-      }
+      MarkMalformedIfScript(node);
       return NS_OK;
     }
     case eTreeOpStreamEnded: {
       aBuilder->DidBuildModel(false); // this causes a notifications flush anyway
       return NS_OK;
     }
     case eTreeOpStartLayout: {
       aBuilder->StartLayout(); // this causes a notification flush anyway
@@ -819,20 +834,17 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
       nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node);
       NS_ASSERTION(sele, "Node didn't QI to script.");
       sele->SetScriptLineNumber(mFour.integer);
       sele->FreezeUriAsyncDefer();
       return NS_OK;
     }
     case eTreeOpSvgLoad: {
       nsIContent* node = *(mOne.node);
-      nsCOMPtr<nsIRunnable> event = new nsHtml5SVGLoadDispatcher(node);
-      if (NS_FAILED(NS_DispatchToMainThread(event))) {
-        NS_WARNING("failed to dispatch svg load dispatcher");
-      }
+      SvgLoad(node);
       return NS_OK;
     }
     case eTreeOpMaybeComplainAboutCharset: {
       char* msgId = mOne.charPtr;
       bool error = mTwo.integer;
       int32_t lineNumber = mThree.integer;
       aBuilder->MaybeComplainAboutCharset(msgId, error, (uint32_t)lineNumber);
       return NS_OK;
--- a/parser/html/nsHtml5TreeOperation.h
+++ b/parser/html/nsHtml5TreeOperation.h
@@ -182,16 +182,20 @@ class nsHtml5TreeOperation {
 
     static void PreventScriptExecution(nsIContent* aNode);
 
     static void DoneAddingChildren(nsIContent* aNode,
                                    nsHtml5DocumentBuilder* aBuilder);
 
     static void DoneCreatingElement(nsIContent* aNode);
 
+    static void SvgLoad(nsIContent* aNode);
+
+    static void MarkMalformedIfScript(nsIContent* aNode);
+
     nsHtml5TreeOperation();
 
     ~nsHtml5TreeOperation();
 
     inline void Init(eHtml5TreeOperation aOpCode)
     {
       NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
         "Op code must be uninitialized when initializing.");