Bug 542122 - Replace safe mode shortcut with keyboard modifier and menu command r=rs a=beta7+

This commit is contained in:
David Dahl 2010-09-21 19:36:53 -07:00
parent 4bceb1c597
commit adb16bb744
7 changed files with 41 additions and 1 deletions

View File

@ -108,6 +108,11 @@
label="&helpFeedbackPage.label;"
oncommand="openFeedbackPage()"
onclick="checkForMiddleClick(this, event);"/>
<menuitem id="helpSafeMode"
accesskey="&helpSafeMode.accesskey;"
label="&helpSafeMode.label;"
oncommand="safeModeRestart();"/>
<menuseparator/>
<menuseparator id="updateSeparator"/>
#ifdef XP_MACOSX
#ifdef MOZ_UPDATER

View File

@ -52,6 +52,7 @@
# Gavin Sharp <gavin@gavinsharp.com>
# Justin Dolske <dolske@mozilla.com>
# Rob Campbell <rcampbell@mozilla.com>
# David Dahl <ddahl@mozilla.com>
# Patrick Walton <pcwalton@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
@ -7993,7 +7994,21 @@ XPCOMUtils.defineLazyGetter(this, "HUDConsoleUI", function () {
}
});
/* duplicateTabIn duplicates tab in a place specified by the parameter |where|.
// Prompt user to restart the browser in safe mode
function safeModeRestart()
{
// prompt the user to confirm
let promptTitle = gNavigatorBundle.getString("safeModeRestartPromptTitle");
let promptMessage =
gNavigatorBundle.getString("safeModeRestartPromptMessage");
let rv = Services.prompt.confirm(window, promptTitle, promptMessage);
if (rv) {
let environment = Components.classes["@mozilla.org/process/environment;1"].
getService(Components.interfaces.nsIEnvironment);
environment.set("MOZ_SAFE_MODE_RESTART", "1");
Application.restart();
}
}/* duplicateTabIn duplicates tab in a place specified by the parameter |where|.
*
* |where| can be:
* "tab" new tab

View File

@ -35,6 +35,7 @@
# Robert Strong <robert.bugzilla@gmail.com>
# Rob Campbell <rcampbell@mozilla.com>
# Patrick Walton <pcwalton@mozilla.com>
# David Dahl <ddahl@mozilla.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -770,6 +771,11 @@
oncommand="openTroubleshootingPage()"
onclick="checkForMiddleClick(this,event);"/>
<menuseparator/>
<menuitem id="appmenu_safeMode"
accesskey="&appMenuSafeMode.accesskey;"
label="&appMenuSafeMode.label;"
oncommand="safeModeRestart();"/>
<menuseparator/>
<menuitem id="appmenu_about"
label="&aboutProduct.label;"
oncommand="openAboutDialog();"/>

View File

@ -17,6 +17,8 @@
<!ENTITY helpForIEUsers.label "For Internet Explorer Users">
<!ENTITY helpForIEUsers.accesskey "I">
<!ENTITY helpMac.commandkey "?">
<!ENTITY helpSafeMode.label "Restart with Add-ons Disabled…">
<!ENTITY helpSafeMode.accesskey "R">
<!ENTITY helpReleaseNotes.label "Release Notes">
<!ENTITY helpReleaseNotes.accesskey "N">

View File

@ -283,6 +283,8 @@ can reach it easily. -->
<!ENTITY appMenuUnsorted.label "Unsorted Bookmarks">
<!ENTITY appMenuWebDeveloper.label "Web Developer">
<!ENTITY appMenuGettingStarted.label "Getting Started">
<!ENTITY appMenuSafeMode.label "Restart with Add-ons Disabled…">
<!ENTITY appMenuSafeMode.accesskey "R">
<!ENTITY openCmd.commandkey "l">
<!ENTITY urlbar.placeholder "Go to a Web Site">

View File

@ -319,6 +319,10 @@ tabView2.title=%S - Group Your Tabs
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.name=Default
extensions.{972ce4c6-7e08-4474-a285-3208198ce6fd}.description=The default theme.
# safeModeRestart
safeModeRestartPromptTitle=Restart with Add-ons Disabled
safeModeRestartPromptMessage=Are you sure you want to disable all add-ons and restart?
# LOCALIZATION NOTE (browser.menu.showCharacterEncoding): Set to the string
# "true" (spelled and capitalized exactly that way) to show the "Character
# Encoding" menu in the main Firefox button on Windows. Any other value will

View File

@ -3046,6 +3046,12 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
ScopedFPHandler handler;
#endif /* XP_OS2 */
if (PR_GetEnv("MOZ_SAFE_MODE_RESTART")) {
gSafeMode = PR_TRUE;
// unset the env variable
PR_SetEnv("MOZ_SAFE_MODE_RESTART=");
}
ar = CheckArg("safe-mode", PR_TRUE);
if (ar == ARG_BAD) {
PR_fprintf(PR_STDERR, "Error: argument -safe-mode is invalid when argument -osint is specified\n");