Bug 1389300 - Don't mix style backend types in nsComputedDOMStyle. r=heycam, a=gchang
☠☠ backed out by b25f3c5ec904 ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Mon, 14 Aug 2017 11:41:23 -0700
changeset 421245 84f048b7dca0169ed9d43009eac05a379a70b3cb
parent 421244 c261040950bfb7d7e575a9b73684cb6d48fa9678
child 421246 78a5c6c95ab89c8a28525cb5e62aac3b8a02f080
push id7634
push userryanvm@gmail.com
push dateFri, 18 Aug 2017 11:43:44 +0000
treeherdermozilla-beta@78a5c6c95ab8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam, gchang
bugs1389300
milestone56.0
Bug 1389300 - Don't mix style backend types in nsComputedDOMStyle. r=heycam, a=gchang MozReview-Commit-ID: 8Decj2cxySY
layout/style/nsComputedDOMStyle.cpp
--- 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 "