Bug 771090 - Use NS_GRE_DIR instead of current process dir when looking up plugin container. r=bsmedberg
authorTim Abraldes <tabraldes@mozilla.com>
Tue, 10 Jul 2012 18:31:04 -0400
changeset 98878 3b579feaa4fc4405f1db12f6e9350d3cfa2e7c13
parent 98877 815dcf79f5deea4836708f1774d7a82bc5672c28
child 98879 f3145f3e7f4403bd8317df305d45fb4679e099d7
push id23088
push userryanvm@gmail.com
push dateWed, 11 Jul 2012 03:26:10 +0000
treeherdermozilla-central@8495e311226f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs771090
milestone16.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 771090 - Use NS_GRE_DIR instead of current process dir when looking up plugin container. r=bsmedberg
ipc/glue/GeckoChildProcessHost.cpp
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -102,47 +102,50 @@ GeckoChildProcessHost::~GeckoChildProces
 #if defined(MOZ_WIDGET_COCOA)
   if (mChildTask != MACH_PORT_NULL)
     mach_port_deallocate(mach_task_self(), mChildTask);
 #endif
 }
 
 void GetPathToBinary(FilePath& exePath)
 {
-#if defined(OS_WIN)
-  exePath = FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
-  exePath = exePath.DirName();
-  exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);
-#elif defined(OS_POSIX)
   if (ShouldHaveDirectoryService()) {
     nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     NS_ASSERTION(directoryService, "Expected XPCOM to be available");
     if (directoryService) {
       nsCOMPtr<nsIFile> greDir;
       nsresult rv = directoryService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile), getter_AddRefs(greDir));
       if (NS_SUCCEEDED(rv)) {
+#ifdef OS_WIN
+        nsString path;
+        greDir->GetPath(path);
+#else
         nsCString path;
         greDir->GetNativePath(path);
+#endif
         exePath = FilePath(path.get());
 #ifdef MOZ_WIDGET_COCOA
         // We need to use an App Bundle on OS X so that we can hide
         // the dock icon. See Bug 557225.
         exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_BUNDLE);
 #endif
       }
     }
   }
 
   if (exePath.empty()) {
+#ifdef OS_WIN
+    exePath = FilePath::FromWStringHack(CommandLine::ForCurrentProcess()->program());
+#else
     exePath = FilePath(CommandLine::ForCurrentProcess()->argv()[0]);
+#endif
     exePath = exePath.DirName();
   }
 
   exePath = exePath.AppendASCII(MOZ_CHILD_PROCESS_NAME);
-#endif
 }
 
 #ifdef MOZ_WIDGET_COCOA
 class AutoCFTypeObject {
 public:
   AutoCFTypeObject(CFTypeRef object)
   {
     mObject = object;