mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1164226 - Add option to restart into safemode from GCLI restart command. r=jryans
This commit is contained in:
parent
201de3e3ff
commit
d509b26b0b
@ -16,6 +16,7 @@ function test() {
|
||||
status: 'VALID',
|
||||
args: {
|
||||
nocache: { value: false },
|
||||
safemode: { value: false },
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -27,6 +28,31 @@ function test() {
|
||||
status: 'VALID',
|
||||
args: {
|
||||
nocache: { value: true },
|
||||
safemode: { value: false },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: 'restart --safemode',
|
||||
check: {
|
||||
input: 'restart --safemode',
|
||||
markup: 'VVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
nocache: { value: false },
|
||||
safemode: { value: true },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: 'restart --safemode --nocache',
|
||||
check: {
|
||||
input: 'restart --safemode --nocache',
|
||||
markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV',
|
||||
status: 'VALID',
|
||||
args: {
|
||||
nocache: { value: true },
|
||||
safemode: { value: true },
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -31,13 +31,21 @@ exports.items = [
|
||||
runAt: "client",
|
||||
name: "restart",
|
||||
description: l10n.lookupFormat("restartBrowserDesc", [ BRAND_SHORT_NAME ]),
|
||||
params: [
|
||||
{
|
||||
name: "nocache",
|
||||
type: "boolean",
|
||||
description: l10n.lookup("restartBrowserNocacheDesc")
|
||||
}
|
||||
],
|
||||
params: [{
|
||||
group: l10n.lookup("restartBrowserGroupOptions"),
|
||||
params: [
|
||||
{
|
||||
name: "nocache",
|
||||
type: "boolean",
|
||||
description: l10n.lookup("restartBrowserNocacheDesc")
|
||||
},
|
||||
{
|
||||
name: "safemode",
|
||||
type: "boolean",
|
||||
description: l10n.lookup("restartBrowserSafemodeDesc")
|
||||
}
|
||||
]
|
||||
}],
|
||||
returnType: "string",
|
||||
exec: function Restart(args, context) {
|
||||
let canceled = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
@ -52,10 +60,17 @@ exports.items = [
|
||||
Services.appinfo.invalidateCachesOnRestart();
|
||||
}
|
||||
|
||||
// restart
|
||||
Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup)
|
||||
.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
const appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
|
||||
.getService(Ci.nsIAppStartup);
|
||||
|
||||
if (args.safemode) {
|
||||
// restart in safemode
|
||||
appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
} else {
|
||||
// restart normally
|
||||
appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
|
||||
}
|
||||
|
||||
return l10n.lookupFormat("restartBrowserRestarting", [ BRAND_SHORT_NAME ]);
|
||||
}
|
||||
}
|
||||
|
@ -282,6 +282,15 @@ restartBrowserRequestCancelled=Restart request cancelled by user.
|
||||
# The argument (%1$S) is the browser name.
|
||||
restartBrowserRestarting=Restarting %1$S…
|
||||
|
||||
# LOCALIZATION NOTE (restartBrowserGroupOptions) A label for the optional options of
|
||||
# the restart command.
|
||||
restartBrowserGroupOptions=Options
|
||||
|
||||
# LOCALIZATION NOTE (restartBrowserSafemodeDesc) A very short string to
|
||||
# describe the 'safemode' parameter to the 'restart' command, which is
|
||||
# displayed in a dialog when the user is using this command.
|
||||
restartBrowserSafemodeDesc=Enables Safe Mode upon restart
|
||||
|
||||
# LOCALIZATION NOTE (inspectDesc) A very short description of the 'inspect'
|
||||
# command. See inspectManual for a fuller description of what it does. This
|
||||
# string is designed to be shown in a menu alongside the command name, which
|
||||
|
Loading…
Reference in New Issue
Block a user