Bug 992571 - Don't rebuild anything in FlushSkinSheets if there's no doc. r=mrbkap
authorWilliam Chen <wchen@mozilla.com>
Wed, 23 Apr 2014 14:20:09 -0700
changeset 198564 5e6769176ce1af8da2951b36dba0b86590720c1c
parent 198563 45f4f9b91b970ef9f67f5d3418e49749b41daafb
child 198565 9688e85bd87c14f571c15a15b074ae6b1ebfb2df
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs992571
milestone31.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 992571 - Don't rebuild anything in FlushSkinSheets if there's no doc. r=mrbkap
dom/xbl/nsXBLPrototypeResources.cpp
--- a/dom/xbl/nsXBLPrototypeResources.cpp
+++ b/dom/xbl/nsXBLPrototypeResources.cpp
@@ -61,26 +61,33 @@ nsXBLPrototypeResources::AddResourceList
 nsresult
 nsXBLPrototypeResources::FlushSkinSheets()
 {
   if (mStyleSheetList.Length() == 0)
     return NS_OK;
 
   nsCOMPtr<nsIDocument> doc =
     mLoader->mBinding->XBLDocumentInfo()->GetDocument();
-  mozilla::css::Loader* cssLoader = doc->CSSLoader();
+
+  // If doc is null, we're in the process of tearing things down, so just
+  // return without rebuilding anything.
+  if (!doc) {
+    return NS_OK;
+  }
 
   // We have scoped stylesheets.  Reload any chrome stylesheets we
   // encounter.  (If they aren't skin sheets, it doesn't matter, since
   // they'll still be in the chrome cache.
   mRuleProcessor = nullptr;
 
   sheet_array_type oldSheets(mStyleSheetList);
   mStyleSheetList.Clear();
 
+  mozilla::css::Loader* cssLoader = doc->CSSLoader();
+
   for (sheet_array_type::size_type i = 0, count = oldSheets.Length();
        i < count; ++i) {
     nsCSSStyleSheet* oldSheet = oldSheets[i];
 
     nsIURI* uri = oldSheet->GetSheetURI();
 
     nsRefPtr<nsCSSStyleSheet> newSheet;
     if (IsChromeURI(uri)) {