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
--- 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) {