Bug 1425866: Just null-check the CSS Loader for now. r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 27 Apr 2018 01:46:50 +0200
changeset 472017 a42293258ab3dffb794f3a1e8fe2c3937dd81bb5
parent 472016 7d6abd1366c1060ca6b89e937a6e606c309f7105
child 472018 ab26e8e09fe50465702fd4f08fee67edf16a0e6b
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1425866
milestone61.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 1425866: Just null-check the CSS Loader for now. r=heycam After discussing with Olli there isn't any kind of severe problem out of this. Shadow subtrees will be disconnected just like the rest, and they shouldn't assume that the document hasn't been disconnected first. MozReview-Commit-ID: CX4fXOqEIFj
dom/base/nsStyleLinkElement.cpp
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -251,17 +251,18 @@ nsStyleLinkElement::DoUpdateStyleSheet(n
   // When static documents are created, stylesheets are cloned manually.
   if (mDontLoadStyle || !mUpdatesEnabled ||
       thisContent->OwnerDoc()->IsStaticDocument()) {
     return Update { };
   }
 
   nsCOMPtr<nsIDocument> doc = thisContent->IsInShadowTree() ?
     thisContent->OwnerDoc() : thisContent->GetUncomposedDoc();
-  if (!doc || !doc->CSSLoader()->GetEnabled()) {
+  // Loader could be null during unlink, see bug 1425866.
+  if (!doc || !doc->CSSLoader() || !doc->CSSLoader()->GetEnabled()) {
     return Update { };
   }
 
   bool isInline;
   nsCOMPtr<nsIPrincipal> triggeringPrincipal;
   nsCOMPtr<nsIURI> uri = GetStyleSheetURL(&isInline, getter_AddRefs(triggeringPrincipal));
 
   if (aForceUpdate == ForceUpdate::No && mStyleSheet && !isInline && uri) {