Bug 1105044: update XULRunner stub path finding to match the updated Mac app package signing requirements. r=bsmedberg
authorMike de Boer <mdeboer@mozilla.com>
Sat, 28 Mar 2015 12:26:22 +0100
changeset 266551 ea17ed6738b56029e8302a6f0258da8e7fb20969
parent 266550 230000accfbef06b7c892f507a03cfcbf7b379fa
child 266552 b7a9b5a6983b062aad92797eb3f8d876cc9b9ac7
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1105044
milestone39.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 1105044: update XULRunner stub path finding to match the updated Mac app package signing requirements. r=bsmedberg
xulrunner/stub/nsXULStub.cpp
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -330,58 +330,40 @@ main(int argc, char **argv)
   rv = parser.Init(iniPath);
   if (NS_FAILED(rv)) {
     fprintf(stderr, "Could not read application.ini\n");
     return 1;
   }
 
   if (!greFound) {
 #ifdef XP_MACOSX
-    // Check for <bundle>/Contents/Frameworks/XUL.framework/Versions/Current/libmozglue.dylib
-    CFURLRef fwurl = CFBundleCopyPrivateFrameworksURL(appBundle);
-    CFURLRef absfwurl = nullptr;
-    if (fwurl) {
-      absfwurl = CFURLCopyAbsoluteURL(fwurl);
-      CFRelease(fwurl);
+    // The bundle can be found next to the executable, in the MacOS dir.
+    CFURLRef exurl = CFBundleCopyExecutableURL(appBundle);
+    CFURLRef absexurl = nullptr;
+    if (exurl) {
+      absexurl = CFURLCopyAbsoluteURL(exurl);
+      CFRelease(exurl);
     }
 
-    if (absfwurl) {
-      CFURLRef xulurl =
-        CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
-                                              CFSTR("XUL.framework/Versions/Current"),
-                                              true);
-
-      if (xulurl) {
-        CFURLRef xpcomurl =
-          CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
-                                                CFSTR("libmozglue.dylib"),
-                                                false);
-
-        if (xpcomurl) {
-          char tbuffer[MAXPATHLEN];
+    if (absexurl) {
+      char tbuffer[MAXPATHLEN];
 
-          if (CFURLGetFileSystemRepresentation(xpcomurl, true,
-                                               (UInt8*) tbuffer,
-                                               sizeof(tbuffer)) &&
-              access(tbuffer, R_OK | X_OK) == 0) {
-            if (realpath(tbuffer, greDir)) {
-              greFound = true;
-            }
-            else {
-              greDir[0] = '\0';
-            }
-          }
-
-          CFRelease(xpcomurl);
+      if (CFURLGetFileSystemRepresentation(absexurl, true,
+                                           (UInt8*) tbuffer,
+                                           sizeof(tbuffer)) &&
+          access(tbuffer, R_OK | X_OK) == 0) {
+        if (realpath(tbuffer, greDir)) {
+          greFound = true;
         }
-
-        CFRelease(xulurl);
+        else {
+          greDir[0] = '\0';
+        }
       }
 
-      CFRelease(absfwurl);
+      CFRelease(absexurl);
     }
 #endif
     if (!greFound) {
       Output(false, "Could not find the Mozilla runtime.\n");
       return 1;
     }
   }