Bug 1358524 - Load userContent.css on both style backends in e10s. r=bholley
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 03 May 2017 20:48:48 +0900
changeset 404680 dcc5b9d4c114bd70aa331bb72f360568ca43f57c
parent 404679 cd9b38e93a9fc68e008640e6e9784d51856187c9
child 404681 85bc6a5f7c735cb440598da679d9ebbd5f8e91cf
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1358524
milestone55.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 1358524 - Load userContent.css on both style backends in e10s. r=bholley MozReview-Commit-ID: 54HOAnm73dz
layout/reftests/usercss/reftest.list
layout/reftests/usercss/usercss-moz-document-ref.html
layout/reftests/usercss/usercss-moz-document.html
layout/reftests/usercss/usercss-ref.html
layout/reftests/usercss/usercss-xbl.html
layout/reftests/usercss/usercss.html
layout/style/nsLayoutStylesheetCache.cpp
layout/style/nsLayoutStylesheetCache.h
--- a/layout/reftests/usercss/reftest.list
+++ b/layout/reftests/usercss/reftest.list
@@ -1,1 +1,3 @@
-skip-if(stylo) == usercss.html usercss-ref.html
+== usercss.html usercss-ref.html
+== usercss-xbl.html usercss-ref.html
+fails-if(stylo) == usercss-moz-document.html usercss-moz-document-ref.html # bug 1355408
copy from layout/reftests/usercss/usercss-ref.html
copy to layout/reftests/usercss/usercss-moz-document-ref.html
--- a/layout/reftests/usercss/usercss-ref.html
+++ b/layout/reftests/usercss/usercss-moz-document-ref.html
@@ -1,12 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
 <style>p { background-color: lime; }</style>
 </head>
 <body>
-<p>This paragraph should have a green background.</p>
-<p>This paragraph should have a green background, too.</p>
 <p>@-moz-document rules should be applied.</p>
 <p>@-moz-document rules should not be applied.</p>
 </body>
 </html>
copy from layout/reftests/usercss/usercss.html
copy to layout/reftests/usercss/usercss-moz-document.html
--- a/layout/reftests/usercss/usercss.html
+++ b/layout/reftests/usercss/usercss-moz-document.html
@@ -1,19 +1,17 @@
 <!DOCTYPE html>
-<html class="reftest-wait">
+<html>
 <head>
 <style>
 p {
   background-color: red;
 }
 .reftest-xdomain {
   background: lime;
 }
 </style>
 </head>
 <body>
-<p class="reftest-usercss">This paragraph should have a green background.</p>
-<p class="reftest-userxbl">This paragraph should have a green background, too.</p>
 <p class="reftest-domain">@-moz-document rules should be applied.</p>
 <p class="reftest-xdomain">@-moz-document rules should not be applied.</p>
 </body>
 </html>
--- a/layout/reftests/usercss/usercss-ref.html
+++ b/layout/reftests/usercss/usercss-ref.html
@@ -1,12 +1,9 @@
 <!DOCTYPE html>
 <html>
 <head>
 <style>p { background-color: lime; }</style>
 </head>
 <body>
 <p>This paragraph should have a green background.</p>
-<p>This paragraph should have a green background, too.</p>
-<p>@-moz-document rules should be applied.</p>
-<p>@-moz-document rules should not be applied.</p>
 </body>
 </html>
copy from layout/reftests/usercss/usercss.html
copy to layout/reftests/usercss/usercss-xbl.html
--- a/layout/reftests/usercss/usercss.html
+++ b/layout/reftests/usercss/usercss-xbl.html
@@ -1,19 +1,13 @@
 <!DOCTYPE html>
 <html class="reftest-wait">
 <head>
 <style>
 p {
   background-color: red;
 }
-.reftest-xdomain {
-  background: lime;
-}
 </style>
 </head>
 <body>
-<p class="reftest-usercss">This paragraph should have a green background.</p>
-<p class="reftest-userxbl">This paragraph should have a green background, too.</p>
-<p class="reftest-domain">@-moz-document rules should be applied.</p>
-<p class="reftest-xdomain">@-moz-document rules should not be applied.</p>
+<p class="reftest-userxbl">This paragraph should have a green background.</p>
 </body>
 </html>
--- a/layout/reftests/usercss/usercss.html
+++ b/layout/reftests/usercss/usercss.html
@@ -1,19 +1,13 @@
 <!DOCTYPE html>
-<html class="reftest-wait">
+<html>
 <head>
 <style>
 p {
   background-color: red;
 }
-.reftest-xdomain {
-  background: lime;
-}
 </style>
 </head>
 <body>
 <p class="reftest-usercss">This paragraph should have a green background.</p>
-<p class="reftest-userxbl">This paragraph should have a green background, too.</p>
-<p class="reftest-domain">@-moz-document rules should be applied.</p>
-<p class="reftest-xdomain">@-moz-document rules should not be applied.</p>
 </body>
 </html>
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -251,26 +251,32 @@ nsLayoutStylesheetCache::DesignModeSheet
   return mDesignModeSheet;
 }
 
 void
 nsLayoutStylesheetCache::Shutdown()
 {
   gCSSLoader_Gecko = nullptr;
   gCSSLoader_Servo = nullptr;
+  MOZ_ASSERT(!gStyleCache_Gecko || !gUserContentSheetURL_Gecko,
+             "Got the URL but never used by Gecko?");
+  MOZ_ASSERT(!gStyleCache_Servo || !gUserContentSheetURL_Servo,
+             "Got the URL but never used by Servo?");
   gStyleCache_Gecko = nullptr;
   gStyleCache_Servo = nullptr;
-  gUserContentSheetURL = nullptr;
+  gUserContentSheetURL_Gecko = nullptr;
+  gUserContentSheetURL_Servo = nullptr;
 }
 
 void
 nsLayoutStylesheetCache::SetUserContentCSSURL(nsIURI* aURI)
 {
   MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
-  gUserContentSheetURL = aURI;
+  gUserContentSheetURL_Gecko = aURI;
+  gUserContentSheetURL_Servo = aURI;
 }
 
 MOZ_DEFINE_MALLOC_SIZE_OF(LayoutStylesheetCacheMallocSizeOf)
 
 NS_IMETHODIMP
 nsLayoutStylesheetCache::CollectReports(nsIHandleReportCallback* aHandleReport,
                                         nsISupports* aData, bool aAnonymize)
 {
@@ -346,20 +352,23 @@ nsLayoutStylesheetCache::nsLayoutStylesh
                &mQuirkSheet, eAgentSheetFeatures, eCrash);
   LoadSheetURL("resource://gre/res/svg.css",
                &mSVGSheet, eAgentSheetFeatures, eCrash);
   if (XRE_IsParentProcess()) {
     // We know we need xul.css for the UI, so load that now too:
     XULSheet();
   }
 
-  if (gUserContentSheetURL) {
+  auto& userContentSheetURL = aType == StyleBackendType::Gecko ?
+                              gUserContentSheetURL_Gecko :
+                              gUserContentSheetURL_Servo;
+  if (userContentSheetURL) {
     MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
-    LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures, eLogToConsole);
-    gUserContentSheetURL = nullptr;
+    LoadSheet(userContentSheetURL, &mUserContentSheet, eUserSheetFeatures, eLogToConsole);
+    userContentSheetURL = nullptr;
   }
 
   // The remaining sheets are created on-demand do to their use being rarer
   // (which helps save memory for Firefox OS apps) or because they need to
   // be re-loadable in DependentPrefChanged.
 }
 
 nsLayoutStylesheetCache::~nsLayoutStylesheetCache()
@@ -1003,9 +1012,12 @@ nsLayoutStylesheetCache::gStyleCache_Ser
 
 mozilla::StaticRefPtr<mozilla::css::Loader>
 nsLayoutStylesheetCache::gCSSLoader_Gecko;
 
 mozilla::StaticRefPtr<mozilla::css::Loader>
 nsLayoutStylesheetCache::gCSSLoader_Servo;
 
 mozilla::StaticRefPtr<nsIURI>
-nsLayoutStylesheetCache::gUserContentSheetURL;
+nsLayoutStylesheetCache::gUserContentSheetURL_Gecko;
+
+mozilla::StaticRefPtr<nsIURI>
+nsLayoutStylesheetCache::gUserContentSheetURL_Servo;
--- a/layout/style/nsLayoutStylesheetCache.h
+++ b/layout/style/nsLayoutStylesheetCache.h
@@ -104,17 +104,18 @@ private:
   static void DependentPrefChanged(const char* aPref, void* aData);
   void BuildPreferenceSheet(RefPtr<mozilla::StyleSheet>* aSheet,
                             nsPresContext* aPresContext);
 
   static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Gecko;
   static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Servo;
   static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Gecko;
   static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Servo;
-  static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL;
+  static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL_Gecko;
+  static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL_Servo;
   mozilla::StyleBackendType mBackendType;
   RefPtr<mozilla::StyleSheet> mChromePreferenceSheet;
   RefPtr<mozilla::StyleSheet> mContentEditableSheet;
   RefPtr<mozilla::StyleSheet> mContentPreferenceSheet;
   RefPtr<mozilla::StyleSheet> mCounterStylesSheet;
   RefPtr<mozilla::StyleSheet> mDesignModeSheet;
   RefPtr<mozilla::StyleSheet> mFormsSheet;
   RefPtr<mozilla::StyleSheet> mHTMLSheet;