Bug 1401982 - Add restart confirmation prompt when accessibility.force_disable is toggled. r=jaws, a=sledru
authorYura Zenevich <yura.zenevich@gmail.com>
Thu, 21 Sep 2017 11:42:27 -0400
changeset 669789 b36a7a8a26a4882115a7ddc5c641b662bc15e32a
parent 669788 da0d57213476b54b0d1786124a327029a63d7ce2
child 669790 df744fbcedc4cb24d6f339a0027bfd8caaaf616a
push id81427
push userluca.greco@alcacoop.it
push dateMon, 25 Sep 2017 11:52:41 +0000
reviewersjaws, sledru
bugs1401982
milestone57.0
Bug 1401982 - Add restart confirmation prompt when accessibility.force_disable is toggled. r=jaws, a=sledru MozReview-Commit-ID: 4VIu3Dl7zlr
browser/components/preferences/in-content/privacy.js
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -1642,11 +1642,18 @@ var gPrivacyPane = {
   _initA11yString() {
     let a11yLearnMoreLink =
       Services.urlFormatter.formatURLPref("accessibility.support.url");
     document.getElementById("a11yLearnMoreLink")
       .setAttribute("href", a11yLearnMoreLink);
   },
 
   updateA11yPrefs(checked) {
-    Services.prefs.setIntPref("accessibility.force_disabled", checked ? 1 : 0);
+    let buttonIndex = confirmRestartPrompt(checked, 0, true, false);
+    if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
+      Services.prefs.setIntPref("accessibility.force_disabled", checked ? 1 : 0);
+      Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
+    }
+
+    // Revert the checkbox in case we didn't quit
+    document.getElementById("a11yPrivacyCheckbox").checked = !checked;
   }
 };