Bug 1423895: Don't use the XUL stylesheet cache if the parsing mode doesn't match. r=bz
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 13 Jun 2018 14:01:08 -0700
changeset 422559 a165a02849d3
parent 422558 fc2ffbc36c07
child 422560 e51f8dbf0397
child 422630 3b4d11763f3f
push id34138
push userdluca@mozilla.com
push date2018-06-15 02:39 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1423895
milestone62.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 1423895: Don't use the XUL stylesheet cache if the parsing mode doesn't match. r=bz Enigmail is loading a XUL document sheet that is @import-ed in another chrome:// sheet. Servo keys stuff off the origin of the sheet, which we derive from the parsing mode (see mode_to_origin in glue.rs). MozReview-Commit-ID: LQqKmxToBKC
layout/style/Loader.cpp
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -973,19 +973,22 @@ Loader::CreateSheet(nsIURI* aURI,
       // This sheet came from the XUL cache or our per-document hashtable; it
       // better be a complete sheet.
       NS_ASSERTION(sheet->IsComplete(),
                    "Sheet thinks it's not complete while we think it is");
 
       // Make sure it hasn't been forced to have a unique inner;
       // that is an indication that its rules have been exposed to
       // CSSOM and so we can't use it.
-      if (sheet->HasForcedUniqueInner()) {
+      //
+      // Similarly, if the sheet doesn't have the right parsing mode just bail.
+      if (sheet->HasForcedUniqueInner() ||
+          sheet->ParsingMode() != aParsingMode) {
         LOG(("  Not cloning completed sheet %p because it has a "
-             "forced unique inner",
+             "forced unique inner or the wrong parsing mode",
              sheet.get()));
         sheet = nullptr;
         fromCompleteSheets = false;
       }
     }
 
     // Then loading sheets
     if (!sheet && !aSyncLoad) {