Skip to content

Commit

Permalink
Bug 1105044: update XULRunner stub path finding to match the updated …
Browse files Browse the repository at this point in the history
…Mac app package signing requirements. r=bsmedberg
  • Loading branch information
mikedeboer committed Mar 28, 2015
1 parent f29d9f7 commit f8fa164
Showing 1 changed file with 19 additions and 37 deletions.
56 changes: 19 additions & 37 deletions xulrunner/stub/nsXULStub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,48 +335,30 @@ main(int argc, char **argv)

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 (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 (absexurl) {
char tbuffer[MAXPATHLEN];

CFRelease(xulurl);
if (CFURLGetFileSystemRepresentation(absexurl, true,
(UInt8*) tbuffer,
sizeof(tbuffer)) &&
access(tbuffer, R_OK | X_OK) == 0) {
if (realpath(tbuffer, greDir)) {
greFound = true;
}
else {
greDir[0] = '\0';
}
}

CFRelease(absfwurl);
CFRelease(absexurl);
}
#endif
if (!greFound) {
Expand Down

0 comments on commit f8fa164

Please sign in to comment.