Backed out changeset 955256297d6d (bug 1579367) for causing a top crash in Bug 1594404. a=backout
authorDorel Luca <dluca@mozilla.com>
Wed, 06 Nov 2019 23:19:09 +0200
changeset 500954 e163e84188dd95d8ad3909bbde2c52f3c4d2c7a8
parent 500953 c1e66d6fc61e928cd819bc0be5ab5f0696ca4941
child 500955 6e19f038ae4d339067830ba7b30ffe1fdffb77e4
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1579367, 1594404
milestone72.0a1
backs out955256297d6dc83d52eb77a202c9c320622c0d13
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
Backed out changeset 955256297d6d (bug 1579367) for causing a top crash in Bug 1594404. a=backout
caps/nsScriptSecurityManager.cpp
caps/nsScriptSecurityManager.h
js/xpconnect/src/XPCJSContext.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/nsXPConnect.cpp
js/xpconnect/src/xpcprivate.h
js/xpconnect/src/xpcpublic.h
layout/build/nsLayoutStatics.cpp
toolkit/xre/nsAppRunner.cpp
xpcom/build/XPCOMInit.cpp
xpcom/build/nsXPCOM.h
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -80,16 +80,17 @@
 
 // This should be probably defined on some other place... but I couldn't find it
 #define WEBAPPS_PERM_NAME "webapps-manage"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsIIOService* nsScriptSecurityManager::sIOService = nullptr;
+JSContext* nsScriptSecurityManager::sContext = nullptr;
 bool nsScriptSecurityManager::sStrictFileOriginPolicy = true;
 
 namespace {
 
 class BundleHelper {
  public:
   NS_INLINE_DECL_REFCOUNTING(BundleHelper)
 
@@ -1365,38 +1366,32 @@ nsresult nsScriptSecurityManager::Init()
 
   InitPrefs();
 
   // Create our system principal singleton
   RefPtr<SystemPrincipal> system = SystemPrincipal::Create();
 
   mSystemPrincipal = system;
 
-  return NS_OK;
-}
-
-void nsScriptSecurityManager::InitJSCallbacks(JSContext* aCx) {
   //-- Register security check callback in the JS engine
   //   Currently this is used to control access to function.caller
+  sContext = danger::GetJSContext();
 
   static const JSSecurityCallbacks securityCallbacks = {
       ContentSecurityPolicyPermitsJSAction,
       JSPrincipalsSubsume,
   };
 
-  MOZ_ASSERT(!JS_GetSecurityCallbacks(aCx));
-  JS_SetSecurityCallbacks(aCx, &securityCallbacks);
-  JS_InitDestroyPrincipalsCallback(aCx, nsJSPrincipals::Destroy);
+  MOZ_ASSERT(!JS_GetSecurityCallbacks(sContext));
+  JS_SetSecurityCallbacks(sContext, &securityCallbacks);
+  JS_InitDestroyPrincipalsCallback(sContext, nsJSPrincipals::Destroy);
 
-  JS_SetTrustedPrincipals(aCx, BasePrincipal::Cast(mSystemPrincipal));
-}
+  JS_SetTrustedPrincipals(sContext, system);
 
-void nsScriptSecurityManager::ClearJSCallbacks(JSContext* aCx) {
-  JS_SetSecurityCallbacks(aCx, nullptr);
-  JS_SetTrustedPrincipals(aCx, nullptr);
+  return NS_OK;
 }
 
 static StaticRefPtr<nsScriptSecurityManager> gScriptSecMan;
 
 nsScriptSecurityManager::~nsScriptSecurityManager(void) {
   Preferences::UnregisterPrefixCallbacks(
       nsScriptSecurityManager::ScriptSecurityPrefChanged, kObservedPrefs, this);
   if (mDomainPolicy) {
@@ -1404,16 +1399,22 @@ nsScriptSecurityManager::~nsScriptSecuri
   }
   // ContentChild might hold a reference to the domain policy,
   // and it might release it only after the security manager is
   // gone. But we can still assert this for the main process.
   MOZ_ASSERT_IF(XRE_IsParentProcess(), !mDomainPolicy);
 }
 
 void nsScriptSecurityManager::Shutdown() {
+  if (sContext) {
+    JS_SetSecurityCallbacks(sContext, nullptr);
+    JS_SetTrustedPrincipals(sContext, nullptr);
+    sContext = nullptr;
+  }
+
   NS_IF_RELEASE(sIOService);
   BundleHelper::Shutdown();
 }
 
 nsScriptSecurityManager* nsScriptSecurityManager::GetScriptSecurityManager() {
   return gScriptSecMan;
 }
 
--- a/caps/nsScriptSecurityManager.h
+++ b/caps/nsScriptSecurityManager.h
@@ -46,19 +46,16 @@ class nsScriptSecurityManager final : pu
   NS_DECL_ISUPPORTS
   NS_DECL_NSISCRIPTSECURITYMANAGER
 
   static nsScriptSecurityManager* GetScriptSecurityManager();
 
   // Invoked exactly once, by XPConnect.
   static void InitStatics();
 
-  void InitJSCallbacks(JSContext* aCx);
-  void ClearJSCallbacks(JSContext* aCx);
-
   static already_AddRefed<mozilla::SystemPrincipal>
   SystemPrincipalSingletonConstructor();
 
   /**
    * Utility method for comparing two URIs.  For security purposes, two URIs
    * are equivalent if their schemes, hosts, and ports (if any) match.  This
    * method returns true if aSubjectURI and aObjectURI have the same origin,
    * false otherwise.
@@ -119,11 +116,12 @@ class nsScriptSecurityManager final : pu
   // This machinery controls new-style domain policies. The old-style
   // policy machinery will be removed soon.
   nsCOMPtr<nsIDomainPolicy> mDomainPolicy;
 
   static bool sStrictFileOriginPolicy;
 
   static nsIIOService* sIOService;
   static nsIStringBundle* sStrBundle;
+  static JSContext* sContext;
 };
 
 #endif  // nsScriptSecurityManager_h__
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -1257,20 +1257,16 @@ nsresult XPCJSContext::Initialize() {
   ReloadPrefsCallback(nullptr, this);
   Preferences::RegisterPrefixCallback(ReloadPrefsCallback, JS_OPTIONS_DOT_STR,
                                       this);
 
 #ifdef FUZZING
   Preferences::RegisterCallback(ReloadPrefsCallback, "fuzzing.enabled", this);
 #endif
 
-  MOZ_RELEASE_ASSERT(JS::InitSelfHostedCode(cx), "InitSelfHostedCode failed");
-  MOZ_RELEASE_ASSERT(Runtime()->InitializeStrings(cx),
-                     "InitializeStrings failed");
-
   return NS_OK;
 }
 
 // static
 uint32_t XPCJSContext::sInstanceCount;
 
 // static
 StaticAutoPtr<WatchdogManager> XPCJSContext::sWatchdogInstance;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -27,17 +27,16 @@
 #include "nsIObserverService.h"
 #include "nsIDebug2.h"
 #include "nsIDocShell.h"
 #include "mozilla/dom/Document.h"
 #include "nsIRunnable.h"
 #include "nsIPlatformInfo.h"
 #include "nsPIDOMWindow.h"
 #include "nsPrintfCString.h"
-#include "nsScriptSecurityManager.h"
 #include "nsThreadPool.h"
 #include "nsWindowSizes.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/Services.h"
 #include "mozilla/dom/ScriptLoader.h"
 #include "mozilla/dom/ScriptSettings.h"
 
@@ -1131,18 +1130,16 @@ void XPCJSRuntime::Shutdown(JSContext* c
   // which can call back into the context with various callbacks if we aren't
   // careful. Remove the relevant callbacks, but leave the weak pointer
   // callbacks to clear out any remaining table entries.
   JS_RemoveFinalizeCallback(cx, FinalizeCallback);
   xpc_DelocalizeRuntime(JS_GetRuntime(cx));
 
   JS::SetGCSliceCallback(cx, mPrevGCSliceCallback);
 
-  nsScriptSecurityManager::GetScriptSecurityManager()->ClearJSCallbacks(cx);
-
   // Shut down the helper threads
   gHelperThreads->Shutdown();
   gHelperThreads = nullptr;
 
   // Clean up and destroy maps. Any remaining entries in mWrappedJSMap will be
   // cleaned up by the weak pointer callbacks.
   delete mIID2NativeInterfaceMap;
   mIID2NativeInterfaceMap = nullptr;
@@ -3043,18 +3040,16 @@ void ConstructUbiNode(void* storage, JSO
 
 void XPCJSRuntime::Initialize(JSContext* cx) {
   mUnprivilegedJunkScope.init(cx, nullptr);
   mLoaderGlobal.init(cx, nullptr);
 
   // these jsids filled in later when we have a JSContext to work with.
   mStrIDs[0] = JSID_VOID;
 
-  nsScriptSecurityManager::GetScriptSecurityManager()->InitJSCallbacks(cx);
-
   // Unconstrain the runtime's threshold on nominal heap size, to avoid
   // triggering GC too often if operating continuously near an arbitrary
   // finite threshold (0xffffffff is infinity for uint32_t parameters).
   // This leaves the maximum-JS_malloc-bytes threshold still in effect
   // to cause period, and we hope hygienic, last-ditch GCs from within
   // the GC's allocator.
   JS_SetGCParameter(cx, JSGC_MAX_BYTES, 0xffffffff);
 
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -21,17 +21,16 @@
 
 #include "WrapperFactory.h"
 #include "AccessCheck.h"
 
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMException.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/Promise.h"
-#include "mozilla/ScriptPreloader.h"
 
 #include "nsDOMMutationObserver.h"
 #include "nsICycleCollectorListener.h"
 #include "nsCycleCollector.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsScriptSecurityManager.h"
 #include "nsIPermissionManager.h"
@@ -67,45 +66,27 @@ static XPCJSContext* gContext;
 
 nsXPConnect::nsXPConnect() : mShuttingDown(false) {
   XPCJSContext::InitTLS();
 
 #ifdef MOZ_GECKO_PROFILER
   JS::SetProfilingThreadCallbacks(profiler_register_thread,
                                   profiler_unregister_thread);
 #endif
-}
-
-// static
-void nsXPConnect::InitJSContext() {
-  MOZ_ASSERT(!gContext);
 
   XPCJSContext* xpccx = XPCJSContext::NewXPCJSContext();
   if (!xpccx) {
     MOZ_CRASH("Couldn't create XPCJSContext.");
   }
   gContext = xpccx;
-  gSelf->mRuntime = xpccx->Runtime();
-
-  // Initialize our singleton scopes.
-  gSelf->mRuntime->InitSingletonScopes();
-
-  mozJSComponentLoader::InitStatics();
-
-  // Initialize the script preloader cache.
-  Unused << mozilla::ScriptPreloader::GetSingleton();
-
-  nsJSContext::EnsureStatics();
+  mRuntime = xpccx->Runtime();
 }
 
-void xpc::InitializeJSContext() { nsXPConnect::InitJSContext(); }
-
 nsXPConnect::~nsXPConnect() {
   MOZ_ASSERT(XPCJSContext::Get() == gContext);
-  MOZ_ASSERT(mRuntime);
 
   mRuntime->DeleteSingletonScopes();
 
   // In order to clean up everything properly, we need to GC twice: once now,
   // to clean anything that can go away on its own (like the Junk Scope, which
   // we unrooted above), and once after forcing a bunch of shutdown in
   // XPConnect, to clean the stuff we forcibly disconnected. The forced
   // shutdown code defaults to leaking in a number of situations, so we can't
@@ -150,16 +131,29 @@ void nsXPConnect::InitStatics() {
   // balanced by explicit call to ReleaseXPConnectSingleton()
   NS_ADDREF(gSelf);
 
   // Fire up the SSM.
   nsScriptSecurityManager::InitStatics();
   gScriptSecurityManager = nsScriptSecurityManager::GetScriptSecurityManager();
   gScriptSecurityManager->GetSystemPrincipal(&gSystemPrincipal);
   MOZ_RELEASE_ASSERT(gSystemPrincipal);
+
+  JSContext* cx = XPCJSContext::Get()->Context();
+  if (!JS::InitSelfHostedCode(cx)) {
+    MOZ_CRASH("InitSelfHostedCode failed");
+  }
+  if (!gSelf->mRuntime->InitializeStrings(cx)) {
+    MOZ_CRASH("InitializeStrings failed");
+  }
+
+  // Initialize our singleton scopes.
+  gSelf->mRuntime->InitSingletonScopes();
+
+  mozJSComponentLoader::InitStatics();
 }
 
 // static
 void nsXPConnect::ReleaseXPConnectSingleton() {
   nsXPConnect* xpc = gSelf;
   if (xpc) {
     nsrefcnt cnt;
     NS_RELEASE2(xpc, cnt);
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -241,31 +241,29 @@ class nsXPConnect final : public nsIXPCo
     return gSystemPrincipal;
   }
 
   // Called by module code in dll startup
   static void InitStatics();
   // Called by module code on dll shutdown.
   static void ReleaseXPConnectSingleton();
 
-  static void InitJSContext();
-
   void RecordTraversal(void* p, nsISupports* s);
 
  protected:
   virtual ~nsXPConnect();
 
   nsXPConnect();
 
  private:
   // Singleton instance
   static nsXPConnect* gSelf;
   static bool gOnceAliveNowDead;
 
-  XPCJSRuntime* mRuntime = nullptr;
+  XPCJSRuntime* mRuntime;
   bool mShuttingDown;
 
   friend class nsIXPConnect;
 
  public:
   static nsIScriptSecurityManager* gScriptSecurityManager;
   static nsIPrincipal* gSystemPrincipal;
 };
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -705,18 +705,16 @@ inline bool IsInAutomation() {
   static bool sPrefCacheAdded = false;
   if (!sPrefCacheAdded) {
     CacheAutomationPref(&sAutomationPrefIsSet);
     sPrefCacheAdded = true;
   }
   return sAutomationPrefIsSet && AreNonLocalConnectionsDisabled();
 }
 
-void InitializeJSContext();
-
 /**
  * Extract the native nsID object from a JS ID, IfaceID, ClassID, or ContractID
  * value.
  *
  * Returns 'Nothing()' if 'aVal' does is not one of the supported ID types.
  */
 mozilla::Maybe<nsID> JSValue2ID(JSContext* aCx, JS::HandleValue aVal);
 
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -159,16 +159,17 @@ nsresult nsLayoutStatics::Initialize() {
 
 #ifdef DEBUG
   nsCSSPseudoElements::AssertAtoms();
   nsCSSAnonBoxes::AssertAtoms();
   DebugVerifyFrameStateBits();
 #endif
 
   StartupJSEnvironment();
+  nsJSContext::EnsureStatics();
 
   nsGlobalWindowInner::Init();
   nsGlobalWindowOuter::Init();
   Navigator::Init();
 #ifdef MOZ_XBL
   nsXBLService::Init();
 #endif
 
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1197,17 +1197,17 @@ bool gLogConsoleErrors = false;
  * during early returns.
  */
 
 class ScopedXPCOMStartup {
  public:
   ScopedXPCOMStartup() : mServiceManager(nullptr) {}
   ~ScopedXPCOMStartup();
 
-  nsresult Initialize(bool aInitJSContext = true);
+  nsresult Initialize();
   nsresult SetWindowCreator(nsINativeAppSupport* native);
 
  private:
   nsIServiceManager* mServiceManager;
   static nsINativeAppSupport* gNativeAppSupport;
 
   friend already_AddRefed<nsINativeAppSupport> NS_GetNativeAppSupport();
 };
@@ -1254,23 +1254,23 @@ static const mozilla::Module::CIDEntry k
     {nullptr}};
 
 static const mozilla::Module::ContractIDEntry kXREContracts[] = {
     {NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID}, {nullptr}};
 
 extern const mozilla::Module kXREModule = {mozilla::Module::kVersion, kXRECIDs,
                                            kXREContracts};
 
-nsresult ScopedXPCOMStartup::Initialize(bool aInitJSContext) {
+nsresult ScopedXPCOMStartup::Initialize() {
   NS_ASSERTION(gDirServiceProvider, "Should not get here!");
 
   nsresult rv;
 
   rv = NS_InitXPCOM(&mServiceManager, gDirServiceProvider->GetAppDir(),
-                    gDirServiceProvider, aInitJSContext);
+                    gDirServiceProvider);
   if (NS_FAILED(rv)) {
     NS_ERROR("Couldn't start xpcom!");
     mServiceManager = nullptr;
   } else {
 #ifdef DEBUG
     nsCOMPtr<nsIComponentRegistrar> reg = do_QueryInterface(mServiceManager);
     NS_ASSERTION(reg, "Service Manager doesn't QI to Registrar.");
 #endif
@@ -4339,31 +4339,20 @@ nsresult XREMain::XRE_mainRun() {
       if (NS_SUCCEEDED(rv)) {
         if (buf[0] == '0' || buf[0] == 'f' || buf[0] == 'F') {
           gDoMigration = false;
         }
       }
     }
   }
 
-  // We'd like to initialize the JSContext *after* reading the user prefs.
-  // Unfortunately that's not possible if we have to do profile migration
-  // because that requires us to execute JS before reading user prefs.
-  // Restarting the browser after profile migration would fix this. See
-  // bug 1592523.
-  bool initializedJSContext = false;
-
   {
     // Profile Migration
     if (mAppData->flags & NS_XRE_ENABLE_PROFILE_MIGRATOR && gDoMigration) {
       gDoMigration = false;
-
-      xpc::InitializeJSContext();
-      initializedJSContext = true;
-
       nsCOMPtr<nsIProfileMigrator> pm(
           do_CreateInstance(NS_PROFILEMIGRATOR_CONTRACTID));
       if (pm) {
         nsAutoCString aKey;
         nsAutoCString aName;
         if (gDoProfileReset) {
           // Automatically migrate from the current application if we just
           // reset the profile.
@@ -4395,22 +4384,16 @@ nsresult XREMain::XRE_mainRun() {
     return NS_ERROR_FAILURE;
   }
 #endif
 
   // Initialize user preferences before notifying startup observers so they're
   // ready in time for early consumers, such as the component loader.
   mDirProvider.InitializeUserPrefs();
 
-  // Now that all (user) prefs have been loaded we can initialize the main
-  // thread's JSContext.
-  if (!initializedJSContext) {
-    xpc::InitializeJSContext();
-  }
-
   nsAppStartupNotifier::NotifyObservers(APPSTARTUP_CATEGORY);
 
   nsCOMPtr<nsIAppStartup> appStartup(components::AppStartup::Service());
   NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
 
   mDirProvider.DoStartup();
 
   // As FilePreferences need the profile directory, we must initialize right
@@ -4722,23 +4705,21 @@ int XREMain::XRE_main(int argc, char* ar
   });
 
   // startup
   result = XRE_mainStartup(&exit);
   if (result != 0 || exit) return result;
 
   bool appInitiatedRestart = false;
 
-  // Start the real application. We use |aInitJSContext = false| because
-  // XRE_mainRun wants to initialize the JSContext after reading user prefs.
-
+  // Start the real application
   mScopedXPCOM = MakeUnique<ScopedXPCOMStartup>();
   if (!mScopedXPCOM) return 1;
 
-  rv = mScopedXPCOM->Initialize(/* aInitJSContext = */ false);
+  rv = mScopedXPCOM->Initialize();
   NS_ENSURE_SUCCESS(rv, 1);
 
   // run!
   rv = XRE_mainRun();
 
 #ifdef MOZ_INSTRUMENT_EVENT_LOOP
   mozilla::ShutdownEventTracing();
 #endif
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -244,18 +244,17 @@ NS_IMPL_ISUPPORTS(OggReporter, nsIMemory
 CountingAllocatorBase<OggReporter>::AmountType
     CountingAllocatorBase<OggReporter>::sAmount(0);
 
 static bool sInitializedJS = false;
 
 // Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser
 EXPORT_XPCOM_API(nsresult)
 NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
-             nsIDirectoryServiceProvider* aAppFileLocationProvider,
-             bool aInitJSContext) {
+             nsIDirectoryServiceProvider* aAppFileLocationProvider) {
   static bool sInitialized = false;
   if (sInitialized) {
     return NS_ERROR_FAILURE;
   }
 
   sInitialized = true;
 
   mozPoisonValueInit();
@@ -456,16 +455,17 @@ NS_InitXPCOM(nsIServiceManager** aResult
   // After autoreg, but before we actually instantiate any components,
   // add any services listed in the "xpcom-directory-providers" category
   // to the directory service.
   nsDirectoryService::gService->RegisterCategoryProviders();
 
   // Init SharedThreadPool (which needs the service manager).
   SharedThreadPool::InitStatics();
 
+  mozilla::ScriptPreloader::GetSingleton();
   mozilla::scache::StartupCache::GetSingleton();
   mozilla::AvailableMemoryTracker::Init();
 
   // Notify observers of xpcom autoregistration start
   NS_CreateServicesFromCategory(NS_XPCOM_STARTUP_CATEGORY, nullptr,
                                 NS_XPCOM_STARTUP_OBSERVER_ID);
 #ifdef XP_WIN
   CreateAnonTempFileRemover();
@@ -479,20 +479,16 @@ NS_InitXPCOM(nsIServiceManager** aResult
 
   mozilla::BackgroundHangMonitor::Startup();
 
   const MessageLoop* const loop = MessageLoop::current();
   sMainHangMonitor = new mozilla::BackgroundHangMonitor(
       loop->thread_name().c_str(), loop->transient_hang_timeout(),
       loop->permanent_hang_timeout());
 
-  if (aInitJSContext) {
-    xpc::InitializeJSContext();
-  }
-
   return NS_OK;
 }
 
 EXPORT_XPCOM_API(nsresult)
 NS_InitMinimalXPCOM() {
   mozPoisonValueInit();
   NS_SetMainThread();
   mozilla::TimeStamp::Startup();
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -58,33 +58,29 @@ struct Module;
  *                         or use <CODE>nullptr</CODE> to use the working
  *                         directory.
  *
  * @param aAppFileLocationProvider The object to be used by Gecko that
  *                         specifies to Gecko where to find profiles, the
  *                         component registry preferences and so on; or use
  *                         <CODE>nullptr</CODE> for the default behaviour.
  *
- * @param aInitJSContext   Whether the nsXPCJSContext should be initialized at
- *                         this point.
- *
  * @see NS_NewLocalFile
  * @see nsIFile
  * @see nsIDirectoryServiceProvider
  *
  * @return NS_OK for success;
  *         NS_ERROR_NOT_INITIALIZED if static globals were not initialized,
  *         which can happen if XPCOM is reloaded, but did not completly
  *         shutdown. Other error codes indicate a failure during
  *         initialisation.
  */
 XPCOM_API(nsresult)
 NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
-             nsIDirectoryServiceProvider* aAppFileLocationProvider,
-             bool aInitJSContext = true);
+             nsIDirectoryServiceProvider* aAppFileLocationProvider);
 
 /**
  * Initialize only minimal components of XPCOM. This ensures nsThreadManager,
  * logging, and timers will work.
  */
 XPCOM_API(nsresult)
 NS_InitMinimalXPCOM();