Back out changeset 0e9ee7d2188b (bug 1541233) as per bug discussion.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 02 May 2019 21:50:16 +0200
changeset 531196 06c42ef3ab2b6dd9a03e5d46528d0dcb66b2d4a9
parent 531195 f630333b81b8c255d8831dc150929a8c6c1eb6ff
child 531197 e2e8514d344b0f34c0981f1c4aeb6c26984b2107
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1541233
milestone68.0a1
backs out0e9ee7d2188b6c82549ce2b23e159b99f32ab452
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
Back out changeset 0e9ee7d2188b (bug 1541233) as per bug discussion.
dom/ipc/ContentParent.cpp
layout/reftests/reftest.list
layout/style/nsLayoutStylesheetCache.cpp
layout/style/nsLayoutStylesheetCache.h
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2386,18 +2386,22 @@ void ContentParent::InitInternal(Process
   // This is only implemented (returns a non-empty list) by MacOSX and Linux
   // at present.
   nsTArray<SystemFontListEntry> fontList;
   gfxPlatform::GetPlatform()->ReadSystemFontList(&fontList);
   nsTArray<LookAndFeelInt> lnfCache = LookAndFeel::GetIntCache();
 
   // Content processes have no permission to access profile directory, so we
   // send the file URL instead.
-  nsIURI* ucsURI = nsLayoutStylesheetCache::Singleton()->GetUserContentCSSURL();
-  SerializeURI(ucsURI, xpcomInit.userContentSheetURL());
+  StyleSheet* ucs = nsLayoutStylesheetCache::Singleton()->GetUserContentSheet();
+  if (ucs) {
+    SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
+  } else {
+    SerializeURI(nullptr, xpcomInit.userContentSheetURL());
+  }
 
   // 1. Build ContentDeviceData first, as it may affect some gfxVars.
   gfxPlatform::GetPlatform()->BuildContentDeviceData(
       &xpcomInit.contentDeviceData());
   // 2. Gather non-default gfxVars.
   xpcomInit.gfxNonDefaultVarUpdates() = gfxVars::FetchNonDefaultVars();
   // 3. Start listening for gfxVars updates, to notify content process later on.
   gfxVars::AddReceiver(this);
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -385,18 +385,18 @@ include ../../toolkit/content/tests/reft
 skip-if(winWidget&&!browserIsRemote) include transform/reftest.list
 
 # 3d transforms
 include transform-3d/reftest.list
 
 # unicode/ (verify that we don't do expend effort doing unicode-aware case checks)
 include unicode/reftest.list
 
-# usercss - only supported in content processes.
-skip-if(!browserIsRemote) include usercss/reftest.list
+# usercss
+include usercss/reftest.list
 
 include view-source/reftest.list
 
 # vr
 include ../../dom/vr/test/reftest/reftest.list
 
 # web-animations
 include web-animations/reftest.list
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -164,28 +164,21 @@ void nsLayoutStylesheetCache::Shutdown()
     r = nullptr;
   }
   // Some content processes don't get around to consuming the shared memory
   // buffer we store in sSharedMemory (e.g. a preloaded content process that
   // doesn't get a document loaded in it), so clear it out here to avoid leaks.
   sSharedMemory = nullptr;
 }
 
-/* static */
 void nsLayoutStylesheetCache::SetUserContentCSSURL(nsIURI* aURI) {
   MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
   gUserContentSheetURL = aURI;
 }
 
-/* static */
-nsIURI* nsLayoutStylesheetCache::GetUserContentCSSURL() {
-  MOZ_ASSERT(XRE_IsParentProcess(), "Only used in parent processes.");
-  return gUserContentSheetURL;
-}
-
 MOZ_DEFINE_MALLOC_SIZE_OF(LayoutStylesheetCacheMallocSizeOf)
 
 NS_IMETHODIMP
 nsLayoutStylesheetCache::CollectReports(nsIHandleReportCallback* aHandleReport,
                                         nsISupports* aData, bool aAnonymize) {
   MOZ_COLLECT_REPORT("explicit/layout/style-sheet-cache/unshared", KIND_HEAP,
                      UNITS_BYTES,
                      SizeOfIncludingThis(LayoutStylesheetCacheMallocSizeOf),
@@ -237,17 +230,18 @@ nsLayoutStylesheetCache::nsLayoutStylesh
   // Load user style sheets.
   InitFromProfile();
 
   if (XRE_IsParentProcess()) {
     // We know we need xul.css for the UI, so load that now too:
     XULSheet();
   }
 
-  if (gUserContentSheetURL && XRE_IsContentProcess()) {
+  if (gUserContentSheetURL) {
+    MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
     LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures,
               eLogToConsole);
     gUserContentSheetURL = nullptr;
   }
 
   // If we are the in the parent process, then we load all of the UA sheets that
   // are shareable and store them into shared memory.  In both the parent and
   // the content process, we load these sheets out of shared memory.
@@ -424,42 +418,34 @@ void nsLayoutStylesheetCache::InitFromPr
   if (appInfo) {
     bool inSafeMode = false;
     appInfo->GetInSafeMode(&inSafeMode);
     if (inSafeMode) return;
   }
   nsCOMPtr<nsIFile> contentFile;
   nsCOMPtr<nsIFile> chromeFile;
 
-  NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR, getter_AddRefs(chromeFile));
-  if (!chromeFile) {
+  NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR, getter_AddRefs(contentFile));
+  if (!contentFile) {
     // if we don't have a profile yet, that's OK!
     return;
   }
 
-  chromeFile->Clone(getter_AddRefs(contentFile));
-  if (!contentFile) return;
+  contentFile->Clone(getter_AddRefs(chromeFile));
+  if (!chromeFile) return;
 
   contentFile->Append(NS_LITERAL_STRING("userContent.css"));
   chromeFile->Append(NS_LITERAL_STRING("userChrome.css"));
 
+  LoadSheetFile(contentFile, &mUserContentSheet, eUserSheetFeatures,
+                eLogToConsole);
   LoadSheetFile(chromeFile, &mUserChromeSheet, eUserSheetFeatures,
                 eLogToConsole);
 
   if (XRE_IsParentProcess()) {
-    bool exists = false;
-    contentFile->Exists(&exists);
-    if (exists) {
-      // We don't need to load this sheet in the parent process, but we do need
-      // the file URI so that we can send it down to the content processes.
-      nsCOMPtr<nsIURI> uri;
-      NS_NewFileURI(getter_AddRefs(uri), contentFile);
-      gUserContentSheetURL = uri;
-    }
-
     // We're interested specifically in potential chrome customizations,
     // so we only need data points from the parent process
     Telemetry::Accumulate(Telemetry::USER_CHROME_CSS_LOADED,
                           mUserChromeSheet != nullptr);
   }
 }
 
 void nsLayoutStylesheetCache::LoadSheetURL(const char* aURL,
--- a/layout/style/nsLayoutStylesheetCache.h
+++ b/layout/style/nsLayoutStylesheetCache.h
@@ -64,17 +64,16 @@ class nsLayoutStylesheetCache final : pu
   mozilla::StyleSheet* ChromePreferenceSheet();
   mozilla::StyleSheet* ContentPreferenceSheet();
 
   static void InvalidatePreferenceSheets();
 
   static void Shutdown();
 
   static void SetUserContentCSSURL(nsIURI* aURI);
-  static nsIURI* GetUserContentCSSURL();
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   // Set the shared memory segment to load the shared UA sheets from.
   // Called early on in a content process' life from
   // ContentChild::InitSharedUASheets, before the nsLayoutStylesheetCache
   // singleton has been created.
   static void SetSharedMemory(const base::SharedMemoryHandle& aHandle,