From f7987dbade251ac2f922e695e1bdd521bffc71ac Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Sat, 20 Jun 2015 22:51:48 -0700 Subject: [PATCH] Back out changeset cd741d3ae78a (bug 1168737) for mochitest failures on Mac OS X 10.10. CLOSED TREE Failures were: 2358 INFO TEST-UNEXPECTED-FAIL | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | Test timed out. - expected PASS 2359 INFO TEST-UNEXPECTED-FAIL | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | Webapp runtime executable has been replaced - got 256, expected 42 2362 INFO TEST-UNEXPECTED-ERROR | toolkit/webapps/tests/test_webapp_runtime_executable_update.xul | called finish() multiple times --- testing/mochitest/mach_commands.py | 4 --- webapprt/mac/webapprt.mm | 47 ++++++++++++------------------ 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index 7efc7a47173..8735111101f 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -333,10 +333,6 @@ class MochitestRunner(MozbuildObject): if not options.app or options.app == self.get_binary_path(): options.app = self.get_webapp_runtime_path() options.xrePath = self.get_webapp_runtime_xre_path() - # On Mac, pass the path to the runtime, to ensure the test app - # uses that specific runtime instead of another one on the system. - if sys.platform.startswith('darwin'): - options.browserArgs.extend(('-runtime', os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME']))) from manifestparser import TestManifest manifest = TestManifest() diff --git a/webapprt/mac/webapprt.mm b/webapprt/mac/webapprt.mm index ace444cff9b..fd16affb180 100644 --- a/webapprt/mac/webapprt.mm +++ b/webapprt/mac/webapprt.mm @@ -44,7 +44,7 @@ const char APP_RESOURCES_PATH[] = "/Contents/Resources/"; //the path to the WebappRT subdir within the Firefox app contents dir const char WEBAPPRT_PATH[] = "webapprt/"; -void ExecNewBinary(NSString* launchPath, NSDictionary* args); +void ExecNewBinary(NSString* launchPath); NSString *PathToWebRT(NSString* alternateBinaryID); @@ -110,15 +110,9 @@ main(int argc, char **argv) NSLog(@"found override firefox binary: %@", alternateBinaryID); @try { - // Determine the runtime with which to run the application. - // Throws an exception with an error dialog if it can't find one. - firefoxPath = [args objectForKey:@"runtime"]; - if (firefoxPath) { - NSLog(@"Runtime specified with -runtime flag: %@", firefoxPath); - } else { - firefoxPath = PathToWebRT(alternateBinaryID); - NSLog(@"Found runtime: %@", firefoxPath); - } + //find a webapprt binary to launch with. throws an exception with error dialog if none found. + firefoxPath = PathToWebRT(alternateBinaryID); + NSLog(@"USING FIREFOX : %@", firefoxPath); NSString* myWebRTPath = [myBundle pathForResource:@"webapprt" ofType:nil]; @@ -204,7 +198,7 @@ main(int argc, char **argv) } //execv the new binary, and ride off into the sunset - ExecNewBinary(myWebRTPath, args); + ExecNewBinary(myWebRTPath); } else { //we are ready to load XUL and such, and go go go @@ -273,7 +267,7 @@ main(int argc, char **argv) NSString *profile = [args objectForKey:@"profile"]; if (profile) { - NSLog(@"Profile specified with -profile flag: %@", profile); + NSLog(@"Profile specified with --profile: %@", profile); } else { nsINIParser parser; @@ -357,6 +351,15 @@ NSString //default is firefox NSString *binaryPath = nil; + // We're run from the Firefox bundle during WebappRT chrome and content tests. + NSString *myBundlePath = [[NSBundle mainBundle] bundlePath]; + NSString *fxPath = + [NSString stringWithFormat:@"%@%sfirefox-bin", myBundlePath, + APP_MACOS_PATH]; + if ([[NSFileManager defaultManager] fileExistsAtPath:fxPath]) { + return myBundlePath; + } + //we look for these flavors of Firefox, in this order NSArray* launchBinarySearchList = [NSArray arrayWithObjects: @"org.mozilla.nightly", @"org.mozilla.firefoxdeveloperedition", @@ -386,26 +389,12 @@ NSString } void -ExecNewBinary(NSString* launchPath, NSDictionary* args) +ExecNewBinary(NSString* launchPath) { NSLog(@" launching webrt at path: %@\n", launchPath); - NSUInteger numArgs = [args count]; - const char *newargv[numArgs + 2]; - NSMutableString *commandLine = [NSMutableString string]; - newargv[0] = [launchPath UTF8String]; - [commandLine appendString:launchPath]; + const char *const newargv[] = {[launchPath UTF8String], NULL}; - NSUInteger i = 1; - for (id key in args) { - NSString *name = [@"-" stringByAppendingString:key]; - NSString *value = [args objectForKey:key]; - newargv[i++] = [name UTF8String]; - newargv[i++] = [value UTF8String]; - [commandLine appendFormat:@" %@ %@", name, value]; - } - newargv[i] = NULL; - - NSLog(@"Command line: '%@'", commandLine); + NSLog(@"COMMAND LINE: '%@ %s'", launchPath, newargv[0]); execv([launchPath UTF8String], (char **)newargv); }