Bug 1563405, part 1 - Call AddAttributes earlier in XULContentSinkImpl::OpenRoot(). r=bzbarsky
authorAndrew McCreight <continuation@gmail.com>
Thu, 04 Jul 2019 05:53:32 +0000
changeset 481232 a4f406edcb1af929d53b20e8f39c5acbd835d370
parent 481231 1c595f00eeecd34b5c0072246ea827acf0344218
child 481233 dfe7d3650300443755a77f6166bacb5787f11b47
push id36236
push userrmaries@mozilla.com
push dateThu, 04 Jul 2019 21:41:54 +0000
treeherdermozilla-central@9340f815a2d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1563405
milestone69.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 1563405, part 1 - Call AddAttributes earlier in XULContentSinkImpl::OpenRoot(). r=bzbarsky AddAttributes has no side effects on |this|, so that's okay. Also remove an extra semi colon. Differential Revision: https://phabricator.services.mozilla.com/D36845
dom/xul/nsXULContentSink.cpp
--- a/dom/xul/nsXULContentSink.cpp
+++ b/dom/xul/nsXULContentSink.cpp
@@ -48,17 +48,16 @@
 #include "nsAttrName.h"
 #include "nsXMLContentSink.h"
 #include "nsIConsoleService.h"
 #include "nsIScriptError.h"
 #include "nsContentTypeParser.h"
 #include "XULDocument.h"
 
 static mozilla::LazyLogModule gContentSinkLog("nsXULContentSink");
-;
 
 //----------------------------------------------------------------------
 
 XULContentSinkImpl::ContextStack::ContextStack() : mTop(nullptr), mDepth(0) {}
 
 XULContentSinkImpl::ContextStack::~ContextStack() {
   while (mTop) {
     Entry* doomed = mTop;
@@ -622,24 +621,24 @@ nsresult XULContentSinkImpl::OpenRoot(co
             ("xul: script tag not allowed as root content element"));
 
     return NS_ERROR_UNEXPECTED;
   }
 
   // Create the element
   RefPtr<nsXULPrototypeElement> element = new nsXULPrototypeElement(aNodeInfo);
 
+  // Add the attributes
+  nsresult rv = AddAttributes(aAttributes, aAttrLen, element);
+  if (NS_FAILED(rv)) return rv;
+
   // Push the element onto the context stack, so that child
   // containers will hook up to us as their parent.
   mContextStack.Push(element, mState);
 
-  // Add the attributes
-  nsresult rv = AddAttributes(aAttributes, aAttrLen, element);
-  if (NS_FAILED(rv)) return rv;
-
   mState = eInDocumentElement;
   return NS_OK;
 }
 
 nsresult XULContentSinkImpl::OpenTag(const char16_t** aAttributes,
                                      const uint32_t aAttrLen,
                                      const uint32_t aLineNumber,
                                      mozilla::dom::NodeInfo* aNodeInfo) {