Backed out changeset 3df4eb39cf4a
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 03 Oct 2014 00:27:53 -0700
changeset 491312 7d0ccd91e8db7c56529da80145248c0260455ccd
parent 491311 3df4eb39cf4a509bc86d92c150acbe53ce449d87
child 491313 b1a13b7cfa9fa2b727ab8a18a75f36e12627a8cc
push id47343
push userbmo:dothayer@mozilla.com
push dateWed, 01 Mar 2017 22:58:58 +0000
milestone35.0a1
backs out3df4eb39cf4a509bc86d92c150acbe53ce449d87
Backed out changeset 3df4eb39cf4a
browser/app/nsBrowserApp.cpp
ipc/glue/GeckoChildProcessHost.cpp
js/xpconnect/src/XPCShellImpl.cpp
security/manager/ssl/tests/unit/head_psm.js
startupcache/test/TestStartupCache.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
xpcom/build/XPCOMInit.cpp
xpcom/tests/unit/head_xpcom.js
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -269,17 +269,20 @@ static int do_main(int argc, char* argv[
     if (NS_FAILED(rv)) {
       Output("Couldn't find the application directory.\n");
       return 255;
     }
 
     nsCOMPtr<nsIFile> greDir;
     exeFile->GetParent(getter_AddRefs(greDir));
 #ifdef XP_MACOSX
-    greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
+    nsCOMPtr<nsIFile> parent;
+    greDir->GetParent(getter_AddRefs(parent));
+    greDir = parent.forget();
+    greDir->AppendNative(NS_LITERAL_CSTRING(kOSXResourcesFolder));
 #endif
     nsCOMPtr<nsIFile> appSubdir;
     greDir->Clone(getter_AddRefs(appSubdir));
     appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
 
     SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
     // xreDirectory already has a refcount from NS_NewLocalFile
     appData.xreDirectory = xreDirectory;
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -136,17 +136,20 @@ GeckoChildProcessHost::GetPathToBinary(F
 #ifdef OS_WIN
     exePath = FilePath(char16ptr_t(gGREPath));
 #elif MOZ_WIDGET_COCOA
     nsCOMPtr<nsIFile> childProcPath;
     NS_NewLocalFile(nsDependentString(gGREPath), false,
                     getter_AddRefs(childProcPath));
     // We need to use an App Bundle on OS X so that we can hide
     // the dock icon. See Bug 557225.
-    childProcPath->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
+    nsCOMPtr<nsIFile> tempPath;
+    childProcPath->GetParent(getter_AddRefs(tempPath));
+    childProcPath = tempPath.forget();
+    childProcPath->AppendNative(NS_LITERAL_CSTRING("MacOS"));
     childProcPath->AppendNative(NS_LITERAL_CSTRING("plugin-container.app"));
     childProcPath->AppendNative(NS_LITERAL_CSTRING("Contents"));
     childProcPath->AppendNative(NS_LITERAL_CSTRING("MacOS"));
     nsCString tempCPath;
     childProcPath->GetNativePath(tempCPath);
     exePath = FilePath(tempCPath.get());
 #else
     nsCString path;
@@ -543,21 +546,23 @@ GeckoChildProcessHost::PerformAsyncLaunc
   // XPCOM may not be initialized in some subprocesses.  We don't want
   // to initialize XPCOM just for the directory service, especially
   // since LD_LIBRARY_PATH is already set correctly in subprocesses
   // (meaning that we don't need to set that up in the environment).
   if (ShouldHaveDirectoryService()) {
     MOZ_ASSERT(gGREPath);
     nsCString path;
 #ifdef MOZ_WIDGET_COCOA
-    nsCOMPtr<nsIFile> greDir;
+    nsCOMPtr<nsIFile> grePath;
+    nsCOMPtr<nsIFile> tempPath;
     NS_NewLocalFile(nsDependentString(gGREPath), false,
-                    getter_AddRefs(greDir));
-    greDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
-    greDir->GetNativePath(path);
+                    getter_AddRefs(grePath));
+    grePath->GetParent(getter_AddRefs(tempPath));
+    tempPath->AppendNative(NS_LITERAL_CSTRING("MacOS"));
+    tempPath->GetNativePath(path);
 #else
     NS_CopyUnicodeToNative(nsDependentString(gGREPath), path);
 #endif
 # if defined(OS_LINUX) || defined(OS_BSD)
 #  if defined(MOZ_WIDGET_ANDROID)
     path += "/lib";
 #  endif  // MOZ_WIDGET_ANDROID
     const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -1355,18 +1355,18 @@ XRE_XPCShellMain(int argc, char **argv, 
     } else {
 #ifdef XP_MACOSX
         // On OSX, the GreD needs to point to Contents/Resources in the .app
         // bundle. Libraries will be loaded at a relative path to GreD, i.e.
         // ../MacOS.
         XRE_GetFileFromPath(argv[0], getter_AddRefs(greDir));
         nsCOMPtr<nsIFile> parentDir;
         greDir->GetParent(getter_AddRefs(parentDir));
-        greDir = parentDir.forget();
-        greDir->SetNativeLeafName(NS_LITERAL_CSTRING("Resources"));
+        parentDir->GetParent(getter_AddRefs(greDir));
+        greDir->AppendNative(NS_LITERAL_CSTRING("Resources"));
         bool dirExists = false;
         greDir->Exists(&dirExists);
         if (!dirExists) {
             printf("Setting GreD failed.\n");
             return 1;
         }
         dirprovider.SetGREDirs(greDir);
 #else
--- a/security/manager/ssl/tests/unit/head_psm.js
+++ b/security/manager/ssl/tests/unit/head_psm.js
@@ -355,18 +355,20 @@ function _setupTLSServerTest(serverBinNa
   addCertFromFile(certdb, "tlsserver/test-ca.der", "CTu,u,u");
 
   const CALLBACK_PORT = 8444;
 
   let directoryService = Cc["@mozilla.org/file/directory_service;1"]
                            .getService(Ci.nsIProperties);
   let envSvc = Cc["@mozilla.org/process/environment;1"]
                  .getService(Ci.nsIEnvironment);
-  let greDir = directoryService.get("GreBinD", Ci.nsIFile);
-  envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
+  let greDir = directoryService.get("GreD", Ci.nsIFile);
+  let macOSDir = greDir.parent;
+  macOSDir.append("MacOS");
+  envSvc.set("DYLD_LIBRARY_PATH", macOSDir.path);
   envSvc.set("LD_LIBRARY_PATH", greDir.path);
   envSvc.set("MOZ_TLS_SERVER_DEBUG_LEVEL", "3");
   envSvc.set("MOZ_TLS_SERVER_CALLBACK_PORT", CALLBACK_PORT);
 
   let httpServer = new HttpServer();
   httpServer.registerPathHandler("/",
       function handleServerCallback(aRequest, aResponse) {
         aResponse.setStatusLine(aRequest.httpVersion, 200, "OK");
--- a/startupcache/test/TestStartupCache.cpp
+++ b/startupcache/test/TestStartupCache.cpp
@@ -411,17 +411,20 @@ int main(int argc, char** argv)
   nsresult scrv;
 
   // Register TestStartupCacheTelemetry
   nsCOMPtr<nsIFile> manifest;
   scrv = NS_GetSpecialDirectory(NS_GRE_DIR,
                                 getter_AddRefs(manifest));
 #ifdef XP_MACOSX
   if (NS_SUCCEEDED(scrv)) {
-    manifest->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
+    nsCOMPtr<nsIFile> parent;
+    manifest->GetParent(getter_AddRefs(parent));
+    parent->AppendNative(NS_LITERAL_CSTRING("MacOS"));
+    manifest = parent.forget();
   }
 #endif
   if (NS_FAILED(scrv)) {
     fail("NS_XPCOM_CURRENT_PROCESS_DIR");
     return 1;
   }
 
   manifest->AppendNative(NS_LITERAL_CSTRING("TestStartupCacheTelemetry.manifest"));
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1081,17 +1081,20 @@ nsresult SetExceptionHandler(nsIFile* aX
 
   if (!headlessClient) {
     // locate crashreporter executable
     nsCOMPtr<nsIFile> exePath;
     nsresult rv = aXREDirectory->Clone(getter_AddRefs(exePath));
     NS_ENSURE_SUCCESS(rv, rv);
 
 #if defined(XP_MACOSX)
-    exePath->SetNativeLeafName(NS_LITERAL_STRING("MacOS"));
+    nsCOMPtr<nsIFile> parentPath;
+    exePath->GetParent(getter_AddRefs(parentPath));
+    exePath = parentPath.forget();
+    exePath->Append(NS_LITERAL_STRING("MacOS"));
     exePath->Append(NS_LITERAL_STRING("crashreporter.app"));
     exePath->Append(NS_LITERAL_STRING("Contents"));
     exePath->Append(NS_LITERAL_STRING("MacOS"));
 #endif
 
     exePath->AppendNative(NS_LITERAL_CSTRING(CRASH_REPORTER_FILENAME));
 
 #ifdef XP_WIN32
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -596,17 +596,17 @@ NS_InitXPCOM2(nsIServiceManager** aResul
 
 #ifdef XP_MACOSX
   nsCOMPtr<nsIFile> parent;
   xpcomLib->GetParent(getter_AddRefs(parent));
   parent->AppendNative(NS_LITERAL_CSTRING("MacOS"));
   bool pathExists = false;
   parent->Exists(&pathExists);
   if (pathExists) {
-    xpcomLib = parent.forget();
+      xpcomLib = parent.forget();
   }
 #endif
 
   xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
   nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
 
   if (!mozilla::Omnijar::IsInitialized()) {
     mozilla::Omnijar::Init();
--- a/xpcom/tests/unit/head_xpcom.js
+++ b/xpcom/tests/unit/head_xpcom.js
@@ -10,15 +10,17 @@ function get_test_program(prog)
 }
 
 function set_process_running_environment()
 {
   var envSvc = Components.classes["@mozilla.org/process/environment;1"].
     getService(Components.interfaces.nsIEnvironment);
   var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
     getService(Components.interfaces.nsIProperties);
-  var greDir = dirSvc.get("GreBinD", Components.interfaces.nsIFile);
-  envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
+  var greDir = dirSvc.get("GreD", Components.interfaces.nsIFile);
+  var macOSDir = greDir.parent;
+  macOSDir.append("MacOS");
+  envSvc.set("DYLD_LIBRARY_PATH", macOSDir.path);
   // For Linux
   envSvc.set("LD_LIBRARY_PATH", greDir.path);
   //XXX: handle windows
 }