Bug 1389300 - Don't mix style backend types in nsComputedDOMStyle. r=heycam, a=gchang
MozReview-Commit-ID: 8Decj2cxySY
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -590,16 +590,26 @@ nsComputedDOMStyle::DoGetStyleContextNoF
// correct document.
nsIPresShell *presShell = GetPresShellForContent(aElement);
bool inDocWithShell = true;
if (!presShell) {
inDocWithShell = false;
presShell = aPresShell;
if (!presShell)
return nullptr;
+
+ // In some edge cases, the caller document might be using a different style
+ // backend than the callee. This causes problems because the cached parsed
+ // style attributes in the callee document will be a different format than
+ // the caller expects. Supporting this would be a pain, and we're already
+ // in edge-case-squared, so we just return.
+ if (presShell->GetDocument()->GetStyleBackendType() !=
+ aElement->OwnerDoc()->GetStyleBackendType()) {
+ return nullptr;
+ }
}
// We do this check to avoid having to add too much special casing of
// Servo functions we call to explicitly ignore any element data in
// the tree. (See comment in ServoStyleSet::ResolveStyleLazily.)
MOZ_RELEASE_ASSERT((aStyleType == eAll && aAnimationFlag == eWithAnimation) ||
!aElement->OwnerDoc()->GetBFCacheEntry(),
"nsComputedDOMStyle doesn't support getting styles without "