Bug 642145 - Avoid firing document-element-inserted for non-element insertions to the document node. r=jonas.
authorHenri Sivonen <hsivonen@iki.fi>
Fri, 08 Apr 2011 09:07:28 +0300
changeset 67662 119dd70688e2037014b342360afa7977fef4d92a
parent 67661 36406d349301a3057e86e9d13f3c1012d070420a
child 67663 fe86883e3a52c1fc97f9d7fd2e35ec3247882cf1
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)
reviewersjonas
bugs642145
milestone2.2a1pre
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 642145 - Avoid firing document-element-inserted for non-element insertions to the document node. r=jonas.
parser/html/nsHtml5TreeOperation.cpp
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -255,19 +255,20 @@ nsHtml5TreeOperation::AppendToDocument(n
   nsIDocument* doc = aBuilder->GetDocument();
   PRUint32 childCount = doc->GetChildCount();
   rv = doc->AppendChildTo(aNode, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
   nsNodeUtils::ContentInserted(doc, aNode, childCount);
 
   NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
                "Someone forgot to block scripts");
-  nsContentUtils::AddScriptRunner(
-    new nsDocElementCreatedNotificationRunner(doc));
-
+  if (aNode->IsElement()) {
+    nsContentUtils::AddScriptRunner(
+        new nsDocElementCreatedNotificationRunner(doc));
+  }
   return rv;
 }
 
 nsresult
 nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
                               nsIContent** aScriptElement)
 {
   nsresult rv = NS_OK;