Bug 716110 - Split -new-instance flag out of existing -no-remote flag. r=bsmedberg

This commit is contained in:
Jed Davis 2012-01-20 01:12:00 -05:00
Родитель 3bb96a049d
Коммит 29b732d7b9
1 изменённых файлов: 21 добавлений и 6 удалений

Просмотреть файл

@ -1330,7 +1330,8 @@ DumpHelp()
" -P <profile> Start with <profile>.\n"
" -migration Start with migration wizard.\n"
" -ProfileManager Start with ProfileManager.\n"
" -no-remote Open new instance, not a new window in running instance.\n"
" -no-remote Do not accept or send remote commands; implies -new-instance.\n"
" -new-instance Open new instance, not a new window in running instance.\n"
" -UILocale <locale> Start with <locale> resources as UI Locale.\n"
" -safe-mode Disables extensions and themes for this session.\n", gAppData->name);
@ -2906,15 +2907,23 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
gSafeMode = true;
#endif
// Handle -no-remote command line argument. Setup the environment to
// better accommodate other components and various restart scenarios.
// Handle -no-remote and -new-instance command line arguments. Setup
// the environment to better accommodate other components and various
// restart scenarios.
ar = CheckArg("no-remote", true);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument -a requires an application name\n");
PR_fprintf(PR_STDERR, "Error: argument -no-remote is invalid when argument -osint is specified\n");
return 1;
} else if (ar == ARG_FOUND) {
SaveToEnv("MOZ_NO_REMOTE=1");
}
ar = CheckArg("new-instance", true);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument -new-instance is invalid when argument -osint is specified\n");
return 1;
} else if (ar == ARG_FOUND) {
SaveToEnv("MOZ_NEW_INSTANCE=1");
}
// Handle -help and -version command line arguments.
// They should return quickly, so we deal with them here.
@ -3035,10 +3044,16 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
#ifdef MOZ_ENABLE_XREMOTE
// handle -remote now that xpcom is fired up
bool disableRemote = false;
bool disableRemote, newInstance;
{
char *e = PR_GetEnv("MOZ_NO_REMOTE");
disableRemote = (e && *e);
if (disableRemote) {
newInstance = true;
} else {
e = PR_GetEnv("MOZ_NEW_INSTANCE");
newInstance = (e && *e);
}
}
const char* xremotearg;
@ -3053,7 +3068,7 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
return HandleRemoteArgument(xremotearg, desktopStartupIDPtr);
}
if (!disableRemote) {
if (!newInstance) {
// Try to remote the entire command line. If this fails, start up normally.
RemoteResult rr = RemoteCommandLine(desktopStartupIDPtr);
if (rr == REMOTE_FOUND)