Bug 1389300 - Don't mix style backend types in nsComputedDOMStyle. r=heycam
authorBobby Holley <bobbyholley@gmail.com>
Mon, 14 Aug 2017 11:41:23 -0700
changeset 374887 c5c135b17ec1e33c0e14427534455a007ad2a425
parent 374886 f10462fa4e8915711b6d34b999b00483a2bb4077
child 374954 33c2573359b3aaf4ae93c133fda908fbb406aa51
push id48859
push userbholley@mozilla.com
push dateWed, 16 Aug 2017 02:11:06 +0000
treeherderautoland@c5c135b17ec1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1389300
milestone57.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 1389300 - Don't mix style backend types in nsComputedDOMStyle. r=heycam MozReview-Commit-ID: 8Decj2cxySY
layout/style/nsComputedDOMStyle.cpp
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -581,16 +581,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 "