mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 547623 - Add a button to about:support to enter safe mode. r=adw
This commit is contained in:
parent
dc818bf586
commit
cbad64de01
@ -7637,32 +7637,8 @@ Object.defineProperty(this, "HUDService", {
|
||||
});
|
||||
|
||||
// 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 restartText = gNavigatorBundle.getString("safeModeRestartButton");
|
||||
let buttonFlags = (Services.prompt.BUTTON_POS_0 *
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING) +
|
||||
(Services.prompt.BUTTON_POS_1 *
|
||||
Services.prompt.BUTTON_TITLE_CANCEL) +
|
||||
Services.prompt.BUTTON_POS_0_DEFAULT;
|
||||
|
||||
let rv = Services.prompt.confirmEx(window, promptTitle, promptMessage,
|
||||
buttonFlags, restartText, null, null,
|
||||
null, {});
|
||||
if (rv != 0)
|
||||
return;
|
||||
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
|
||||
if (!cancelQuit.data) {
|
||||
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
function safeModeRestart() {
|
||||
Services.obs.notifyObservers(null, "restart-in-safe-mode", "");
|
||||
}
|
||||
|
||||
/* duplicateTabIn duplicates tab in a place specified by the parameter |where|.
|
||||
|
@ -283,6 +283,9 @@ BrowserGlue.prototype = {
|
||||
Services.console.logStringMessage(null); // clear the console (in case it's open)
|
||||
Services.console.reset();
|
||||
break;
|
||||
case "restart-in-safe-mode":
|
||||
this._onSafeModeRestart();
|
||||
break;
|
||||
case "quit-application-requested":
|
||||
this._onQuitRequest(subject, data);
|
||||
break;
|
||||
@ -520,6 +523,7 @@ BrowserGlue.prototype = {
|
||||
#endif
|
||||
os.addObserver(this, "browser-search-engine-modified", false);
|
||||
os.addObserver(this, "browser-search-service", false);
|
||||
os.addObserver(this, "restart-in-safe-mode", false);
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
@ -531,6 +535,7 @@ BrowserGlue.prototype = {
|
||||
os.removeObserver(this, "browser:purge-session-history");
|
||||
os.removeObserver(this, "quit-application-requested");
|
||||
os.removeObserver(this, "quit-application-granted");
|
||||
os.removeObserver(this, "restart-in-safe-mode");
|
||||
#ifdef OBSERVE_LASTWINDOW_CLOSE_TOPICS
|
||||
os.removeObserver(this, "browser-lastwindow-close-requested");
|
||||
os.removeObserver(this, "browser-lastwindow-close-granted");
|
||||
@ -650,6 +655,33 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_onSafeModeRestart: function BG_onSafeModeRestart() {
|
||||
// prompt the user to confirm
|
||||
let strings = Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
||||
let promptTitle = strings.GetStringFromName("safeModeRestartPromptTitle");
|
||||
let promptMessage = strings.GetStringFromName("safeModeRestartPromptMessage");
|
||||
let restartText = strings.GetStringFromName("safeModeRestartButton");
|
||||
let buttonFlags = (Services.prompt.BUTTON_POS_0 *
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING) +
|
||||
(Services.prompt.BUTTON_POS_1 *
|
||||
Services.prompt.BUTTON_TITLE_CANCEL) +
|
||||
Services.prompt.BUTTON_POS_0_DEFAULT;
|
||||
|
||||
let rv = Services.prompt.confirmEx(null, promptTitle, promptMessage,
|
||||
buttonFlags, restartText, null, null,
|
||||
null, {});
|
||||
if (rv != 0)
|
||||
return;
|
||||
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
|
||||
if (!cancelQuit.data) {
|
||||
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
},
|
||||
|
||||
_trackSlowStartup: function () {
|
||||
if (Services.startup.interrupted ||
|
||||
Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
|
||||
|
@ -21,7 +21,7 @@ window.addEventListener("load", function onload(event) {
|
||||
for (let prop in snapshotFormatters)
|
||||
snapshotFormatters[prop](snapshot[prop]);
|
||||
});
|
||||
populateResetBox();
|
||||
populateActionBox();
|
||||
setupEventListeners();
|
||||
} catch (e) {
|
||||
Cu.reportError("stack of load error for about:support: " + e + ": " + e.stack);
|
||||
@ -684,11 +684,27 @@ function openProfileDirectory() {
|
||||
/**
|
||||
* Profile reset is only supported for the default profile if the appropriate migrator exists.
|
||||
*/
|
||||
function populateResetBox() {
|
||||
if (ResetProfile.resetSupported())
|
||||
$("reset-box").style.visibility = "visible";
|
||||
function populateActionBox() {
|
||||
if (ResetProfile.resetSupported()) {
|
||||
$("reset-box").style.display = "block";
|
||||
$("action-box").style.display = "block";
|
||||
}
|
||||
if (!Services.appinfo.inSafeMode) {
|
||||
$("safe-mode-box").style.display = "block";
|
||||
$("action-box").style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
// Prompt user to restart the browser in safe mode
|
||||
function safeModeRestart() {
|
||||
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
|
||||
|
||||
if (!cancelQuit.data) {
|
||||
Services.startup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set up event listeners for buttons.
|
||||
*/
|
||||
@ -709,4 +725,12 @@ function setupEventListeners(){
|
||||
$("profile-dir-button").addEventListener("click", function (event){
|
||||
openProfileDirectory();
|
||||
});
|
||||
$("restart-in-safe-mode-button").addEventListener("click", function (event) {
|
||||
if (Services.obs.enumerateObservers("restart-in-safe-mode").hasMoreElements()) {
|
||||
Services.obs.notifyObservers(null, "restart-in-safe-mode", "");
|
||||
}
|
||||
else {
|
||||
safeModeRestart();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -29,13 +29,21 @@
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
|
||||
<div id="reset-box">
|
||||
<h3>&refreshProfile.title;</h3>
|
||||
<button id="reset-box-button">
|
||||
&refreshProfile.button.label;
|
||||
</button>
|
||||
</div>
|
||||
<div id="action-box">
|
||||
<div id="reset-box">
|
||||
<h3>&refreshProfile.title;</h3>
|
||||
<button id="reset-box-button">
|
||||
&refreshProfile.button.label;
|
||||
</button>
|
||||
</div>
|
||||
<div id="safe-mode-box">
|
||||
<h3>&aboutSupport.safeModeTitle;</h3>
|
||||
<button id="restart-in-safe-mode-button">
|
||||
&aboutSupport.restartInSafeMode.label;
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h1>
|
||||
&aboutSupport.pageTitle;
|
||||
</h1>
|
||||
|
@ -97,3 +97,6 @@ variant of aboutSupport.showDir.label. -->
|
||||
<!ENTITY aboutSupport.copyRawDataToClipboard.label "Copy raw data to clipboard">
|
||||
|
||||
<!ENTITY aboutSupport.sandboxTitle "Sandbox">
|
||||
|
||||
<!ENTITY aboutSupport.safeModeTitle "Try Safe Mode">
|
||||
<!ENTITY aboutSupport.restartInSafeMode.label "Restart with Add-ons Disabled…">
|
||||
|
@ -78,7 +78,7 @@ td {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#reset-box {
|
||||
#action-box {
|
||||
background-color: -moz-Dialog;
|
||||
border: 1px solid ThreeDShadow;
|
||||
color: -moz-DialogText;
|
||||
@ -89,10 +89,15 @@ td {
|
||||
-moz-margin-end: 0;
|
||||
padding: 16px;
|
||||
width: 30%;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#reset-box:-moz-dir(rtl) {
|
||||
#action-box,
|
||||
#reset-box,
|
||||
#safe-mode-box {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#action-box:-moz-dir(rtl) {
|
||||
float: left;
|
||||
}
|
||||
|
||||
@ -100,7 +105,7 @@ td {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#reset-box > button {
|
||||
#action-box button {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user