aboutsummaryrefslogtreecommitdiff
path: root/www/waterfox/files/patch-bug1400540
blob: 6cbe87dc3d61e62efd601d2c74569bf934ab35f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
commit 6905267b2878
Author: Xidorn Quan <me@upsuper.org>
Date:   Wed Sep 20 08:26:53 2017 +1000

    Bug 1400540 - Decide style backend type based on principal. r=bholley
    
    MozReview-Commit-ID: A4y9Shdbr7g
    
    --HG--
    extra : source : cdfe5e5e059273a1c7fc6506d6e0fecb2bb7affb
---
 dom/base/nsDocument.cpp | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git dom/base/nsDocument.cpp dom/base/nsDocument.cpp
index 642960e6a155..265af0df07b9 100644
--- dom/base/nsDocument.cpp
+++ dom/base/nsDocument.cpp
@@ -13465,20 +13465,15 @@ nsIDocument::UpdateStyleBackendType()
 
 #ifdef MOZ_STYLO
   if (nsLayoutUtils::StyloEnabled()) {
-    if (IsBeingUsedAsImage()) {
-      // Enable stylo for SVG-as-image.
+    // Disable stylo only for system principal. Other principals aren't
+    // able to use XUL by default, and the back door to enable XUL is
+    // mostly just for testing, which means they don't matter, and we
+    // shouldn't respect them at the same time.
+    // Note that, since tests can have XUL support, we still need to
+    // explicitly exclude XUL documents here.
+    if (!nsContentUtils::IsSystemPrincipal(NodePrincipal()) &&
+        !IsXULDocument()) {
       mStyleBackendType = StyleBackendType::Servo;
-    } else if (!mDocumentContainer) {
-      // Not docshell, assume Gecko. Various callers can end up setting this
-      // explicitly afterwards to inherit it in various situations.
-    } else if (!IsXULDocument() && IsContentDocument()) {
-      // Disable stylo for about: pages other than about:blank, since
-      // they tend to use unsupported selectors like XUL tree pseudos.
-      bool isAbout = false;
-      mDocumentURI->SchemeIs("about", &isAbout);
-      if (!isAbout || NS_IsAboutBlank(mDocumentURI)) {
-        mStyleBackendType = StyleBackendType::Servo;
-      }
     }
   }
 #endif