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 236248 ea17ed6738b56029e8302a6f0258da8e7fb20969
parent 236247 230000accfbef06b7c892f507a03cfcbf7b379fa
child 236249 b7a9b5a6983b062aad92797eb3f8d876cc9b9ac7
push id12062
push usermdeboer@mozilla.com
push dateSat, 28 Mar 2015 11:27:40 +0000
treeherderfx-team@ea17ed6738b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1105044
milestone39.0a1
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;
     }
   }