Mac v2 signing - backing out Bug 1060562 to reland updated patch
authorRobert Strong <robert.bugzilla@gmail.com>
Sat, 27 Sep 2014 21:01:55 -0700
changeset 491286 d016a561afc4d5ddeef49e7a3a7dc8fdc019bd0e
parent 491285 341092082b6e7f5e357f8e3a29ec67423be5c368
child 491287 dda3674cff4de1084b237291a19243162179c955
push id47343
push userbmo:dothayer@mozilla.com
push dateWed, 01 Mar 2017 22:58:58 +0000
bugs1060562
milestone35.0a1
Mac v2 signing - backing out Bug 1060562 to reland updated patch
browser/app/macbuild/Contents/MacOS-files.in
js/xpconnect/src/XPCShellImpl.cpp
netwerk/test/unit/test_socks.js
python/mozbuild/mozbuild/base.py
security/manager/ssl/tests/unit/head_psm.js
testing/xpcshell/runxpcshelltests.py
testing/xpcshell/selftest.py
toolkit/crashreporter/test/unit/head_crashreporter.js
xpcom/tests/unit/head_xpcom.js
--- a/browser/app/macbuild/Contents/MacOS-files.in
+++ b/browser/app/macbuild/Contents/MacOS-files.in
@@ -1,9 +1,8 @@
 /*.app/***
 /*.dylib
 /certutil
 /firefox-bin
 /pk12util
 /ssltunnel
 /webapprt-stub
-/xpcshell
 /XUL
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -1346,41 +1346,26 @@ XRE_XPCShellMain(int argc, char **argv, 
             return 1;
         }
 
         dirprovider.SetGREDir(greDir);
 
         argc -= 2;
         argv += 2;
     } else {
-#ifdef XP_MACOSX
-        XRE_GetFileFromPath(argv[0], getter_AddRefs(greDir));
-        nsCOMPtr<nsIFile> parentDir;
-        greDir->GetParent(getter_AddRefs(parentDir));
-        parentDir->GetParent(getter_AddRefs(greDir));
-        greDir->AppendNative(NS_LITERAL_CSTRING("Resources"));
-        bool dirExists = false;
-        greDir->Exists(&dirExists);
-        if (dirExists) {
-            dirprovider.SetGREDir(greDir);
-        } else {
-#endif
         nsAutoString workingDir;
         if (!GetCurrentWorkingDirectory(workingDir)) {
             printf("GetCurrentWorkingDirectory failed.\n");
             return 1;
         }
         rv = NS_NewLocalFile(workingDir, true, getter_AddRefs(greDir));
         if (NS_FAILED(rv)) {
             printf("NS_NewLocalFile failed.\n");
             return 1;
         }
-#ifdef XP_MACOSX
-        }
-#endif
     }
 
     if (argc > 1 && !strcmp(argv[1], "-a")) {
         if (argc < 3)
             return usage();
 
         nsCOMPtr<nsIFile> dir;
         rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(dir));
--- a/netwerk/test/unit/test_socks.js
+++ b/netwerk/test/unit/test_socks.js
@@ -25,20 +25,26 @@ function getAvailableBytes(input)
   } catch (e) {
   }
   
   return len;
 }
 
 function runScriptSubprocess(script, args)
 {
+  // logic copied from ted's crashreporter unit test
   var ds = new DirectoryService();
-  var bin = ds.get("XREExeF", Ci.nsILocalFile);
+  var bin = ds.get("CurProcD", Ci.nsILocalFile);
+
+  bin.append("xpcshell");
   if (!bin.exists()) {
-    do_throw("Can't find xpcshell binary");
+    bin.leafName = "xpcshell.exe";
+    do_check_true(bin.exists());
+    if (!bin.exists())
+      do_throw("Can't find xpcshell binary");
   }
 
   var script = do_get_file(script);
   var proc = new Process(bin);
   var args = [script.path].concat(args);
 
   proc.run(false, args, args.length);
 
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -269,18 +269,16 @@ class MozbuildObject(ProcessExecutionMix
         return self.config_environment.substs
 
     @property
     def distdir(self):
         return os.path.join(self.topobjdir, 'dist')
 
     @property
     def bindir(self):
-        if sys.platform.startswith('darwin'):
-            return os.path.join(self.topobjdir, 'dist', self.substs['MOZ_MACBUNDLE_NAME'], 'Contents', 'MacOS')
         return os.path.join(self.topobjdir, 'dist', 'bin')
 
     @property
     def includedir(self):
         return os.path.join(self.topobjdir, 'dist', 'include')
 
     @property
     def statedir(self):
--- a/security/manager/ssl/tests/unit/head_psm.js
+++ b/security/manager/ssl/tests/unit/head_psm.js
@@ -356,19 +356,17 @@ function _setupTLSServerTest(serverBinNa
 
   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("GreD", Ci.nsIFile);
-  let macOSDir = greDir.parent;
-  macOSDir.append("MacOS");
-  envSvc.set("DYLD_LIBRARY_PATH", macOSDir.path);
+  envSvc.set("DYLD_LIBRARY_PATH", greDir.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/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -836,22 +836,16 @@ class XPCShellTests(object):
         self.httpdJSPath = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.js')
         self.httpdJSPath = replaceBackSlashes(self.httpdJSPath)
 
         self.httpdManifest = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.manifest')
         self.httpdManifest = replaceBackSlashes(self.httpdManifest)
 
         if self.xrePath is None:
             self.xrePath = os.path.dirname(self.xpcshell)
-            if sys.platform == 'osx' or sys.platform == "darwin":
-                # Check if we're run from an OSX app bundle and override
-                # self.xrePath if we are.
-                appBundlePath = os.path.join(os.path.dirname(os.path.dirname(self.xpcshell)), 'Resources')
-                if os.path.exists(os.path.join(appBundlePath, 'application.ini')):
-                    self.xrePath = appBundlePath
         else:
             self.xrePath = os.path.abspath(self.xrePath)
 
         if self.mozInfo is None:
             self.mozInfo = os.path.join(self.testharnessdir, "mozinfo.json")
 
     def buildCoreEnvironment(self):
         """
@@ -881,17 +875,17 @@ class XPCShellTests(object):
         self.env = dict(os.environ)
         self.buildCoreEnvironment()
         if sys.platform == 'win32':
             self.env["PATH"] = self.env["PATH"] + ";" + self.xrePath
         elif sys.platform in ('os2emx', 'os2knix'):
             os.environ["BEGINLIBPATH"] = self.xrePath + ";" + self.env["BEGINLIBPATH"]
             os.environ["LIBPATHSTRICT"] = "T"
         elif sys.platform == 'osx' or sys.platform == "darwin":
-            self.env["DYLD_LIBRARY_PATH"] = os.path.join(os.path.dirname(self.xrePath), 'MacOS')
+            self.env["DYLD_LIBRARY_PATH"] = self.xrePath
         else: # unix or linux?
             if not "LD_LIBRARY_PATH" in self.env or self.env["LD_LIBRARY_PATH"] is None:
                 self.env["LD_LIBRARY_PATH"] = self.xrePath
             else:
                 self.env["LD_LIBRARY_PATH"] = ":".join([self.xrePath, self.env["LD_LIBRARY_PATH"]])
 
         if "asan" in self.mozInfo and self.mozInfo["asan"]:
             # ASan symbolizer support
--- a/testing/xpcshell/selftest.py
+++ b/testing/xpcshell/selftest.py
@@ -15,23 +15,18 @@ from mozbuild.base import MozbuildObject
 os.environ.pop('MOZ_OBJDIR', None)
 build_obj = MozbuildObject.from_environment()
 
 from runxpcshelltests import XPCShellTests
 
 mozinfo.find_and_update_from_json()
 
 objdir = build_obj.topobjdir.encode("utf-8")
-
-if sys.platform.startswith('darwin'):
-  from buildconfig import substs
-  xpcshellBin = os.path.join(objdir, "dist", substs['MOZ_MACBUNDLE_NAME'], "Contents", "MacOS", "xpcshell")
-else:
-  xpcshellBin = os.path.join(objdir, "dist", "bin", "xpcshell")
-  if sys.platform == "win32":
+xpcshellBin = os.path.join(objdir, "dist", "bin", "xpcshell")
+if sys.platform == "win32":
     xpcshellBin += ".exe"
 
 SIMPLE_PASSING_TEST = "function run_test() { do_check_true(true); }"
 SIMPLE_FAILING_TEST = "function run_test() { do_check_true(false); }"
 
 ADD_TEST_SIMPLE = '''
 function run_test() { run_next_test(); }
 
--- a/toolkit/crashreporter/test/unit/head_crashreporter.js
+++ b/toolkit/crashreporter/test/unit/head_crashreporter.js
@@ -30,20 +30,24 @@ function getEventDir() {
  *       Certain types of crashes may not cause the process to
  *       exit with an error.
  */
 function do_crash(setup, callback, canReturnZero)
 {
   // get current process filename (xpcshell)
   let ds = Components.classes["@mozilla.org/file/directory_service;1"]
     .getService(Components.interfaces.nsIProperties);
-  let bin = ds.get("XREExeF", Components.interfaces.nsILocalFile);
+  let bin = ds.get("CurProcD", Components.interfaces.nsILocalFile);
+  bin.append("xpcshell");
   if (!bin.exists()) {
-    // weird, can't find xpcshell binary?
-    do_throw("Can't find xpcshell binary!");
+    bin.leafName = "xpcshell.exe";
+    do_check_true(bin.exists());
+    if (!bin.exists())
+      // weird, can't find xpcshell binary?
+      do_throw("Can't find xpcshell binary!");
   }
   // get Gre dir (GreD)
   let greD = ds.get("GreD", Components.interfaces.nsILocalFile);
   let headfile = do_get_file("crasher_subprocess_head.js");
   let tailfile = do_get_file("crasher_subprocess_tail.js");
   // run xpcshell -g GreD -f head -e "some setup code" -f tail
   let process = Components.classes["@mozilla.org/process/util;1"]
                   .createInstance(Components.interfaces.nsIProcess);
--- a/xpcom/tests/unit/head_xpcom.js
+++ b/xpcom/tests/unit/head_xpcom.js
@@ -11,16 +11,15 @@ 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("GreD", Components.interfaces.nsIFile);
-  var macOSDir = greDir.parent;
-  macOSDir.append("MacOS");
-  envSvc.set("DYLD_LIBRARY_PATH", macOSDir.path);
+
+  envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
   // For Linux
   envSvc.set("LD_LIBRARY_PATH", greDir.path);
   //XXX: handle windows
 }