Bug 1176449 - Enter an update here to avoid assertions on startup. r=dbaron
authorBlake Kaplan <mrbkap@gmail.com>
Mon, 08 Feb 2016 14:51:00 +0100
changeset 283625 d7a8f54d6f6ba9bae4f655f117a7cc115e6bc8c2
parent 283624 3b0ec072cd212b1449050cc87c5cbed862f30809
child 283626 202de45bc0d4da8b1fb0843d3db2796ce4a8366a
push id17536
push usercbook@mozilla.com
push dateWed, 10 Feb 2016 13:30:18 +0000
treeherderfx-team@31150215eedf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1176449
milestone47.0a1
Bug 1176449 - Enter an update here to avoid assertions on startup. r=dbaron
dom/xul/XULDocument.cpp
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -87,16 +87,17 @@
 #include "mozilla/dom/XULDocumentBinding.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/LoadInfo.h"
 #include "mozilla/Preferences.h"
 #include "nsTextNode.h"
 #include "nsJSUtils.h"
 #include "mozilla/dom/URL.h"
 #include "nsIContentPolicy.h"
+#include "mozAutoDocUpdate.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 //
 // CIDs
 //
@@ -2962,20 +2963,24 @@ nsresult
 XULDocument::DoneWalking()
 {
     NS_PRECONDITION(mPendingSheets == 0, "there are sheets to be loaded");
     NS_PRECONDITION(!mStillWalking, "walk not done");
 
     // XXXldb This is where we should really be setting the chromehidden
     // attribute.
 
-    uint32_t count = mOverlaySheets.Length();
-    for (uint32_t i = 0; i < count; ++i) {
-        AddStyleSheet(mOverlaySheets[i]);
+    {
+        mozAutoDocUpdate updateBatch(this, UPDATE_STYLE, true);
+        uint32_t count = mOverlaySheets.Length();
+        for (uint32_t i = 0; i < count; ++i) {
+            AddStyleSheet(mOverlaySheets[i]);
+        }
     }
+
     mOverlaySheets.Clear();
 
     if (!mDocumentLoaded) {
         // Make sure we don't reenter here from StartLayout().  Note that
         // setting mDocumentLoaded to true here means that if StartLayout()
         // causes ResumeWalk() to be reentered, we'll take the other branch of
         // the |if (!mDocumentLoaded)| check above and since
         // mInitialLayoutComplete will be false will follow the else branch