Bug 1285328 - Reverse the buttons in the privacy change confirm dialog, to make sure escape reverts the change. r=jaws, a=sledru
authorMilan Sreckovic <milan@mozilla.com>
Tue, 19 Jul 2016 11:46:00 -0400
changeset 342138 4860a3b8fddf545baaf5ecbbe2d6ff22d0874efc
parent 342137 b1d798dd3579b91b05942393fd469b9c6edf51d3
child 342139 957bd28fba3e66a180faa5af11a5538b8388e983
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, sledru
bugs1285328
milestone49.0a2
Bug 1285328 - Reverse the buttons in the privacy change confirm dialog, to make sure escape reverts the change. r=jaws, a=sledru
browser/components/preferences/in-content/main.js
browser/components/preferences/in-content/privacy.js
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -201,18 +201,18 @@ var gMainPane = {
                                         "featureEnableRequiresRestart" : "featureDisableRequiresRestart",
                                         [brandName]);
     let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
     let check = {value: false};
     let prompts = Services.prompt;
     let flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_IS_STRING +
                   prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_CANCEL  +
                   prompts.BUTTON_POS_2 * prompts.BUTTON_TITLE_IS_STRING;
-    let button0Title = bundle.getString("restartNowButton");
-    let button2Title = bundle.getString("restartLaterButton");
+    let button0Title = bundle.getString("restartNow");
+    let button2Title = bundle.getString("restartLater");
     let button_index = prompts.confirmEx(window, title, msg, flags,
                          button0Title, null, button2Title, null, check)
     let RESTART_NOW_BUTTON_INDEX = 0;
     let CANCEL_BUTTON_INDEX = 1;
     let RESTART_LATER_BUTTON_INDEX = 2;
 
     switch (button_index) {
       case CANCEL_BUTTON_INDEX:
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -380,29 +380,27 @@ var gPrivacyPane = {
       let revertText = bundle.getString("revertNoRestartButton");
 
       let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);
       let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
       let buttonFlags = (Services.prompt.BUTTON_POS_0 *
 			 Services.prompt.BUTTON_TITLE_IS_STRING) +
                         (Services.prompt.BUTTON_POS_1 *
 			 Services.prompt.BUTTON_TITLE_IS_STRING) +
-                        Services.prompt.BUTTON_POS_0_DEFAULT;
+                        Services.prompt.BUTTON_POS_1_DEFAULT;
 
-      let shouldProceed = prompts.confirmEx(window, title, msg,
-					    buttonFlags, revertText, restartText,
-					    null, null, {});
-      if (shouldProceed) {
+      let buttonIndex = prompts.confirmEx(window, title, msg,
+             buttonFlags, restartText, revertText,
+             null, null, {});
+      if (buttonIndex == 0) {
         let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
                            .createInstance(Ci.nsISupportsPRBool);
         Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
                                      "restart");
-        shouldProceed = !cancelQuit.data;
-
-        if (shouldProceed) {
+        if (!cancelQuit.data) {
           pref.value = autoStart.hasAttribute('checked');
           let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
                              .getService(Ci.nsIAppStartup);
           appStartup.quit(Ci.nsIAppStartup.eAttemptQuit |  Ci.nsIAppStartup.eRestart);
           return;
         }
       }