mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 512728 - Fast startup allows restarts and activates itself always. -faststart-hidden only prevents the default chrome window from being shown. r=gavin
This commit is contained in:
parent
b13ca44fb3
commit
eb8a59b8ab
@ -114,11 +114,19 @@ function nsFastStartupObserver() {
|
|||||||
if (_browserWindowCount == 0)
|
if (_browserWindowCount == 0)
|
||||||
scheduleMemoryCleanup();
|
scheduleMemoryCleanup();
|
||||||
}
|
}
|
||||||
|
} else if (topic == "quit-application-granted") {
|
||||||
|
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||||
|
getService(Ci.nsIAppStartup);
|
||||||
|
appstartup.exitLastWindowClosingSurvivalArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QI
|
/*
|
||||||
this.QueryInterface = XPCOMUtils.generateQI([Ci.nsIObserver]);
|
* QueryInterface
|
||||||
|
* We expect the WindowWatcher service to retain a strong reference to us, so supporting
|
||||||
|
* weak references is fine.
|
||||||
|
*/
|
||||||
|
this.QueryInterface = XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nsFastStartupCLH() { }
|
function nsFastStartupCLH() { }
|
||||||
@ -129,10 +137,8 @@ nsFastStartupCLH.prototype = {
|
|||||||
//
|
//
|
||||||
handle: function fs_handle(cmdLine) {
|
handle: function fs_handle(cmdLine) {
|
||||||
// the rest of this only handles -faststart here
|
// the rest of this only handles -faststart here
|
||||||
if (!cmdLine.handleFlag("faststart", false))
|
if (cmdLine.handleFlag("faststart-hidden", false))
|
||||||
return;
|
cmdLine.preventDefault = true;
|
||||||
|
|
||||||
cmdLine.preventDefault = true;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// did we already initialize faststart? if so,
|
// did we already initialize faststart? if so,
|
||||||
@ -142,19 +148,24 @@ nsFastStartupCLH.prototype = {
|
|||||||
|
|
||||||
this.inited = true;
|
this.inited = true;
|
||||||
|
|
||||||
|
let fsobs = new nsFastStartupObserver();
|
||||||
let wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
let wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||||
getService(Ci.nsIWindowWatcher);
|
getService(Ci.nsIWindowWatcher);
|
||||||
wwatch.registerNotification(new nsFastStartupObserver());
|
wwatch.registerNotification(fsobs);
|
||||||
|
|
||||||
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
let appstartup = Cc["@mozilla.org/toolkit/app-startup;1"].
|
||||||
getService(Ci.nsIAppStartup);
|
getService(Ci.nsIAppStartup);
|
||||||
|
|
||||||
|
let obsService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
|
||||||
|
obsService.addObserver(fsobs, "quit-application-granted", true);
|
||||||
|
|
||||||
appstartup.enterLastWindowClosingSurvivalArea();
|
appstartup.enterLastWindowClosingSurvivalArea();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
helpInfo: " -faststart\n",
|
helpInfo: " -faststart-hidden\n",
|
||||||
|
|
||||||
// QI
|
// QI
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||||
|
@ -14,7 +14,7 @@ WinMain(HINSTANCE hInstance,
|
|||||||
wchar_t modfilename[MAX_PATH];
|
wchar_t modfilename[MAX_PATH];
|
||||||
wchar_t execname[MAX_PATH];
|
wchar_t execname[MAX_PATH];
|
||||||
wchar_t args[MAX_PATH];
|
wchar_t args[MAX_PATH];
|
||||||
wcscpy(args, L"-nosplash -faststart");
|
wcscpy(args, L"-nosplash -faststart-hidden");
|
||||||
|
|
||||||
HMODULE mod = GetModuleHandle(NULL);
|
HMODULE mod = GetModuleHandle(NULL);
|
||||||
GetModuleFileNameW(mod, modfilename, sizeof(modfilename)/sizeof(modfilename[0]));
|
GetModuleFileNameW(mod, modfilename, sizeof(modfilename)/sizeof(modfilename[0]));
|
||||||
|
Loading…
Reference in New Issue
Block a user