From bec174332a0e5f131ef60f3931ca6cbf23b1cfa6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 23 Oct 2014 17:25:19 -0700 Subject: [PATCH] Bug 1080302 (part 1) - Add support for --foo and /foo options where it's not already present. r=glandium. --- python/mozbuild/mozbuild/mach_commands.py | 4 +++- toolkit/xre/nsNativeAppSupportWin.cpp | 4 ++-- webapprt/gtk/webapprt.cpp | 4 ++-- webapprt/win/webapprt.cpp | 4 +++- widget/windows/winrt/MetroContracts.cpp | 5 ++++- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 057c4b56b71..08d2c6ceb2f 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -851,7 +851,9 @@ class RunProgram(MachCommandBase): if not background and sys.platform == 'darwin': args.append('-foreground') - if '-profile' not in params and '-P' not in params and not noprofile: + no_profile_option_given = \ + all(p not in params for p in ['-profile', '--profile', '-P']) + if no_profile_option_given and not noprofile: path = os.path.join(self.topobjdir, 'tmp', 'scratch_user') if not os.path.isdir(path): os.makedirs(path) diff --git a/toolkit/xre/nsNativeAppSupportWin.cpp b/toolkit/xre/nsNativeAppSupportWin.cpp index d8f7155ab6b..49d75890408 100644 --- a/toolkit/xre/nsNativeAppSupportWin.cpp +++ b/toolkit/xre/nsNativeAppSupportWin.cpp @@ -334,8 +334,8 @@ NS_IMPL_RELEASE_INHERITED(nsNativeAppSupportWin, nsNativeAppSupportBase) void nsNativeAppSupportWin::CheckConsole() { for ( int i = 1; i < gArgc; i++ ) { - if ( strcmp( "-console", gArgv[i] ) == 0 - || + if ( strcmp( "-console", gArgv[i] ) == 0 || + strcmp( "--console", gArgv[i] ) == 0 || strcmp( "/console", gArgv[i] ) == 0 ) { // Users wants to make sure we have a console. // Try to allocate one. diff --git a/webapprt/gtk/webapprt.cpp b/webapprt/gtk/webapprt.cpp index 3ea1f41b01b..a8487485ec9 100644 --- a/webapprt/gtk/webapprt.cpp +++ b/webapprt/gtk/webapprt.cpp @@ -327,10 +327,10 @@ int main(int argc, char *argv[]) bool removeApp = false; for (int i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-profile")) { + if (!strcmp(argv[i], "-profile") || !strcmp(argv[i], "--profile")) { isProfileOverridden = true; } - else if (!strcmp(argv[i], "-remove")) { + else if (!strcmp(argv[i], "-remove") || !strcmp(argv[i], "--remove")) { removeApp = true; } } diff --git a/webapprt/win/webapprt.cpp b/webapprt/win/webapprt.cpp index 9b7c404ecdd..fe968593069 100644 --- a/webapprt/win/webapprt.cpp +++ b/webapprt/win/webapprt.cpp @@ -446,7 +446,9 @@ main(int argc, char* argv[]) // Check if the runtime was executed with the "-profile" argument for (int i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-profile")) { + if (!strcmp(argv[i], "-profile") || + !strcmp(argv[i], "--profile") || + !strcmp(argv[i], "/profile")) { isProfileOverridden = true; break; } diff --git a/widget/windows/winrt/MetroContracts.cpp b/widget/windows/winrt/MetroContracts.cpp index 60118eda54e..02697c0a63f 100644 --- a/widget/windows/winrt/MetroContracts.cpp +++ b/widget/windows/winrt/MetroContracts.cpp @@ -103,7 +103,10 @@ FrameworkView::LaunchActivated(ComPtr& aArgs, bool aS int argc; unsigned int length; LPWSTR* argv = CommandLineToArgvW(data.GetRawBuffer(&length), &argc); - if (aStartup && argc == 2 && !wcsicmp(argv[0], L"-url")) { + if (aStartup && argc == 2 && + (!wcsicmp(argv[0], L"-url") || + !wcsicmp(argv[0], L"--url") || + !wcsicmp(argv[0], L"/url"))) { WindowsCreateString(argv[1], wcslen(argv[1]), &sActivationURI); } else { // Some other command line or this is not a startup.