Bug 1423564 - Correctly set disabled and checked states of custom history pref checkboxes. r=johannh draft
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 06 Dec 2017 16:03:14 -0800
changeset 710993 dfcea62d925d019b880e87bc0f1551e78d756e9e
parent 708379 c0c5e19a32b8b1b74b9dc0360800aec01665f9b0
child 743714 a245f9f87038a257ed417b67d2a258de834ff9cd
push id92965
push usernhnt11@gmail.com
push dateTue, 12 Dec 2017 23:22:55 +0000
reviewersjohannh
bugs1423564, 1375870
milestone59.0a1
Bug 1423564 - Correctly set disabled and checked states of custom history pref checkboxes. r=johannh This seemed to be working before by a fluke: > Before bug 1375870, _constructAfterChildren was getting called several times, resulting in change events triggering updatePrivacyMicroControls repeatedly. > updatePrivacyMicroControls was using the auto-private-browsing checkbox to decide whether to disable and hide the checkmarks of the other checkboxes. > After bug 1375870, at the point when updatePrivacyMicroControls is called, the preference value has not yet propagated to the auto-private-browsing checkbox, so uPMC doesn't work correctly and is not called again. Solution: use the actual preference value in uPMC. MozReview-Commit-ID: 2AhRQwkjH5Q
browser/components/preferences/in-content/privacy.js
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -491,17 +491,17 @@ var gPrivacyPane = {
 
   /**
    * Update the privacy micro-management controls based on the
    * value of the private browsing auto-start checkbox.
    */
   updatePrivacyMicroControls() {
     if (document.getElementById("historyMode").value == "custom") {
       let disabled = this._autoStartPrivateBrowsing =
-        document.getElementById("privateBrowsingAutoStart").checked;
+        document.getElementById("browser.privatebrowsing.autostart").value;
       this.dependentControls.forEach(function(aElement) {
         let control = document.getElementById(aElement);
         let preferenceId = control.getAttribute("preference");
         if (!preferenceId) {
           let dependentControlId = control.getAttribute("control");
           if (dependentControlId) {
             let dependentControl = document.getElementById(dependentControlId);
             preferenceId = dependentControl.getAttribute("preference");