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 476777 a165a02849d3e6e527bc7abf2e84cceac81e2513
parent 476776 fc2ffbc36c0798ff373228f5447f8184e104cf22
child 476778 e51f8dbf0397a7f7055dc792c3ee5ad2409e1e2c
child 476848 3b4d11763f3fbef1f7d3156dbed2728bbf96dd5f
push id9374
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:43:20 +0000
treeherdermozilla-beta@160e085dfb0b [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) {