Bug 1517653 - part 0a - invert the check for loading chrome manifests; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Tue, 08 Jan 2019 15:56:58 -0500
changeset 510080 9aaacc4c6149f3f54880e535e4a89dd4787e0ca1
parent 510079 9721f08cfc146910bd4f122bfd8239d21d0f8e5a
child 510081 08438a0f4757ad2d483a29d3fbd89ff86a827f27
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1517653
milestone66.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 1517653 - part 0a - invert the check for loading chrome manifests; r=mccr8 Checking that the current process type is not equal to some value requires adding code when new process types are added. Since it seems reasonable to assume that all new process types aren't going to require chrome manifests, let's make the code reflect that assumption as well, and reduce the number of places you need to touch when adding a new process type.
xpcom/components/nsComponentManager.cpp
--- a/xpcom/components/nsComponentManager.cpp
+++ b/xpcom/components/nsComponentManager.cpp
@@ -333,19 +333,37 @@ nsresult nsComponentManagerImpl::Init() 
   for (uint32_t i = 0; i < sExtraStaticModules->Length(); ++i) {
     RegisterModule((*sExtraStaticModules)[i]);
   }
 
   // This needs to be called very early, before anything in nsLayoutModule is
   // used, and before any calls are made into the JS engine.
   nsLayoutModuleInitialize();
 
-  bool loadChromeManifests = (XRE_GetProcessType() != GeckoProcessType_GPU &&
-                              XRE_GetProcessType() != GeckoProcessType_VR &&
-                              XRE_GetProcessType() != GeckoProcessType_RDD);
+  bool loadChromeManifests;
+  switch (XRE_GetProcessType()) {
+    // We are going to assume that only a select few (see below) process types
+    // want to load chrome manifests, and that any new process types will not
+    // want to load them, because they're not going to be executing JS.
+    default:
+      loadChromeManifests = false;
+      break;
+
+    // XXX The check this code replaced implicitly let through all of these
+    // process types, but presumably only the default (parent) and content
+    // processes really need chrome manifests...?
+    case GeckoProcessType_Default:
+    case GeckoProcessType_Plugin:
+    case GeckoProcessType_Content:
+    case GeckoProcessType_IPDLUnitTest:
+    case GeckoProcessType_GMPlugin:
+      loadChromeManifests = true;
+      break;
+  }
+
   if (loadChromeManifests) {
     // The overall order in which chrome.manifests are expected to be treated
     // is the following:
     // - greDir
     // - greDir's omni.ja
     // - appDir
     // - appDir's omni.ja