Backed out changeset 78f4fbeaac20 (bug 1403366)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 04 Oct 2017 01:27:13 +0200
changeset 384314 a208381e377edcb93842c463dace5392bf15ee3d
parent 384313 cadb2bf153615d095f29c141c3bf93d0db427a48
child 384315 8a7e10cf8824863cfd0d6ec670c9e390c0fbbb5c
push id32625
push userarchaeopteryx@coole-files.de
push dateWed, 04 Oct 2017 09:11:07 +0000
treeherdermozilla-central@933b30269777 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1403366
milestone58.0a1
backs out78f4fbeaac2004bb382c12081673ed363b3ad07c
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 78f4fbeaac20 (bug 1403366)
toolkit/xre/nsUpdateDriver.cpp
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -156,16 +156,45 @@ GetInstallDirPath(nsIFile *appDir, nsACS
   rv = appDir->GetNativePath(installDirPath);
 #endif
   if (NS_FAILED(rv)) {
     return rv;
   }
   return NS_OK;
 }
 
+#if defined(XP_MACOSX)
+// This is a copy of OS X's XRE_GetBinaryPath from nsAppRunner.cpp with the
+// gBinaryPath check removed so that the updater can reload the stub executable
+// instead of xulrunner-bin. See bug 349737.
+static nsresult
+GetXULRunnerStubPath(const char* argv0, nsIFile* *aResult)
+{
+  // Works even if we're not bundled.
+  CFBundleRef appBundle = ::CFBundleGetMainBundle();
+  if (!appBundle)
+    return NS_ERROR_FAILURE;
+
+  CFURLRef bundleURL = ::CFBundleCopyExecutableURL(appBundle);
+  if (!bundleURL)
+    return NS_ERROR_FAILURE;
+
+  nsCOMPtr<nsILocalFileMac> lfm;
+  nsresult rv = NS_NewLocalFileWithCFURL(bundleURL, true, getter_AddRefs(lfm));
+
+  ::CFRelease(bundleURL);
+
+  if (NS_FAILED(rv))
+    return rv;
+
+  lfm.forget(aResult);
+  return NS_OK;
+}
+#endif /* XP_MACOSX */
+
 static bool
 GetFile(nsIFile* dir, const nsACString& name, nsCOMPtr<nsIFile>& result)
 {
   nsresult rv;
 
   nsCOMPtr<nsIFile> file;
   rv = dir->Clone(getter_AddRefs(file));
   if (NS_FAILED(rv))
@@ -503,17 +532,23 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
     rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath));
     if (NS_FAILED(rv)) {
       return;
     }
 
     // Get the application file path used by the updater to restart the
     // application after the update has finished.
     nsCOMPtr<nsIFile> appFile;
+#if defined(XP_MACOSX)
+    // On OS X we need to pass the location of the xulrunner-stub executable
+    // rather than xulrunner-bin. See bug 349737.
+    GetXULRunnerStubPath(appArgv[0], getter_AddRefs(appFile));
+#else
     XRE_GetBinaryPath(appArgv[0], getter_AddRefs(appFile));
+#endif
     if (!appFile) {
       return;
     }
 
 #if defined(XP_WIN)
     nsAutoString appFilePathW;
     rv = appFile->GetPath(appFilePathW);
     if (NS_FAILED(rv)) {