Fix Clear Recent History timespan behaviour on platforms without instant-apply prefs. b=453440 r=gavin a=blocking-firefox3.1
☠☠ backed out by d18a673eb7fe ☠ ☠
authorJohnathan Nightingale <johnath@mozilla.com>
Mon, 10 Nov 2008 16:15:48 -0500
changeset 21561 bcbde22c762fa2e5d53c507b7acf2a43bc5d8c3a
parent 21560 ffeecd437beb41622074ad2b4144dd8b6145b580
child 21562 a33287a649fefb7fcc0d63cf790af4a99c0a5f22
child 21565 d18a673eb7fe4bcfd64bef7bf14d85fdf6926486
push id3579
push userjnightingale@mozilla.com
push dateMon, 10 Nov 2008 21:16:18 +0000
treeherdermozilla-central@bcbde22c762f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, blocking-firefox3
bugs453440
milestone1.9.1b2pre
Fix Clear Recent History timespan behaviour on platforms without instant-apply prefs. b=453440 r=gavin a=blocking-firefox3.1
browser/base/content/sanitize.xul
--- a/browser/base/content/sanitize.xul
+++ b/browser/base/content/sanitize.xul
@@ -97,20 +97,27 @@
           var itemArray = itemBranch.getChildList("", itemCount);
           itemArray.forEach(function (name) {
             cpdBranch.setBoolPref(name, itemBranch.getBoolPref(name));
           });
         },
         
         sanitize: function ()
         {
+          // Update pref values before handing off to the sanitizer (bug 453440)
+          this.updatePrefs();
           var s = new Sanitizer();
           s.ignoreTimespan = false;
           s.prefDomain = "privacy.cpd.";
-          s.sanitize();
+          try {
+            s.sanitize();
+          } catch (er) {
+            Components.utils.reportError("Exception during sanitize: " + er);
+          }
+          return true;
         },
         
         onReadGeneric: function ()
         {
           var preferences = document.getElementById("sanitizePreferences");
           var found = false;
           for (var i = 0; i < preferences.childNodes.length; ++i) {
             var preference = preferences.childNodes[i];
@@ -150,16 +157,28 @@
           let downloads = document.getElementById("downloads-checkbox");
           let history = document.getElementById("history-checkbox");
           let s = new Sanitizer();
           downloads.disabled = history.checked ||
                                !s.canClearItem("downloads");
           if (history.checked)
             downloads.checked = true;
         },
+        
+        updatePrefs : function ()
+        {
+          var tsPref = document.getElementById("privacy.sanitize.timeSpan");
+          Sanitizer.prefs.setIntPref("timeSpan", tsPref.value);
+          var sanitizePreferences = document.getElementById("sanitizePreferences");
+          var prefs = sanitizePreferences.rootBranch;
+          for (var i = 0; i < sanitizePreferences.childNodes.length; ++i) {
+            var p = sanitizePreferences.childNodes[i];
+            prefs.setBoolPref(p.name, p.value);
+          }
+        }
       };
     ]]>
     </script>
 
     <preferences id="sanitizePreferences">
       <preference id="privacy.cpd.history"               name="privacy.cpd.history"               type="bool"/>
       <preference id="privacy.cpd.formdata"              name="privacy.cpd.formdata"              type="bool"/>
       <preference id="privacy.cpd.passwords"             name="privacy.cpd.passwords"             type="bool"/>