Bug 1444494: Initialize DllServices in XPCShell; r=jimm
authorAaron Klotz <aklotz@mozilla.com>
Fri, 09 Mar 2018 12:56:33 -0700
changeset 765593 1caceba533ebc4ecf677b434299e37e3511356dd
parent 765592 925adb267211585b0cfd2f6b4e219857ecca7921
child 765594 017dbfcb23698b9484a4467221e86a0dca980326
push id102114
push userbmo:jgilbert@mozilla.com
push dateFri, 09 Mar 2018 22:13:16 +0000
reviewersjimm
bugs1444494
milestone60.0a1
Bug 1444494: Initialize DllServices in XPCShell; r=jimm
js/xpconnect/src/XPCShellImpl.cpp
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -36,17 +36,19 @@
 #include "nsIXULRuntime.h"
 #include "GeckoProfiler.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #ifdef XP_WIN
+#include "mozilla/ScopeExit.h"
 #include "mozilla/widget/AudioSession.h"
+#include "mozilla/WinDllServices.h"
 #include <windows.h>
 #if defined(MOZ_SANDBOX)
 #include "sandboxBroker.h"
 #endif
 #endif
 
 #ifdef MOZ_CODE_COVERAGE
 #include "mozilla/CodeCoverageHandler.h"
@@ -1298,16 +1300,22 @@ XRE_XPCShellMain(int argc, char** argv, 
         gfxPrefs::GetSingleton();
         // Initialize e10s check on the main thread, if not already done
         BrowserTabsRemoteAutostart();
 #ifdef XP_WIN
         // Plugin may require audio session if installed plugin can initialize
         // asynchronized.
         AutoAudioSession audioSession;
 
+        // Ensure that DLL Services are running
+        RefPtr<DllServices> dllSvc(DllServices::Get());
+        auto dllServicesDisable = MakeScopeExit([&dllSvc]() {
+          dllSvc->Disable();
+        });
+
 #if defined(MOZ_SANDBOX)
         // Required for sandboxed child processes.
         if (aShellData->sandboxBrokerServices) {
           SandboxBroker::Initialize(aShellData->sandboxBrokerServices);
           SandboxBroker::GeckoDependentInitialize();
         } else {
           NS_WARNING("Failed to initialize broker services, sandboxed "
                      "processes will fail to start.");