Bug 1058442 - sanitize.js now passes the date range being cleared to the permission manager and content pref service. r=MattN
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 14 Oct 2014 16:03:31 +1100
changeset 210225 e997cbe0c5b6ec69fb837fc62125eb1c63ca91e9
parent 210208 54217864bae9ce772dabcb68d9a9cb0654431d34
child 210226 474d1663c2e0beecf74d6b58ee010d577172f752
push id27647
push usercbook@mozilla.com
push dateTue, 14 Oct 2014 13:36:02 +0000
treeherdermozilla-central@a0a389aaffc1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1058442
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1058442 - sanitize.js now passes the date range being cleared to the permission manager and content pref service. r=MattN
browser/base/content/sanitize.js
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -389,35 +389,50 @@ Sanitizer.prototype = {
         return true;
       }
     },
 
     siteSettings: {
       clear: function ()
       {
         // Clear site-specific permissions like "Allow this site to open popups"
+        // we ignore the "end" range and hope it is now() - none of the
+        // interfaces used here support a true range anyway.
+        let startDateMS = this.range == null ? null : this.range[0] / 1000;
         var pm = Components.classes["@mozilla.org/permissionmanager;1"]
                            .getService(Components.interfaces.nsIPermissionManager);
-        pm.removeAll();
+        if (startDateMS == null) {
+          pm.removeAll();
+        } else {
+          pm.removeAllSince(startDateMS);
+        }
 
         // Clear site-specific settings like page-zoom level
         var cps = Components.classes["@mozilla.org/content-pref/service;1"]
                             .getService(Components.interfaces.nsIContentPrefService2);
-        cps.removeAllDomains(null);
+        if (startDateMS == null) {
+          cps.removeAllDomains(null);
+        } else {
+          cps.removeAllDomainsSince(startDateMS, null);
+        }
 
         // Clear "Never remember passwords for this site", which is not handled by
         // the permission manager
+        // (Note the login manager doesn't support date ranges yet, and bug
+        //  1058438 is calling for loginSaving stuff to end up in the
+        // permission manager)
         var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
                               .getService(Components.interfaces.nsILoginManager);
         var hosts = pwmgr.getAllDisabledHosts();
         for each (var host in hosts) {
           pwmgr.setLoginSavingEnabled(host, true);
         }
 
-        // Clear site security settings
+        // Clear site security settings - no support for ranges in this
+        // interface either, so we clearAll().
         var sss = Cc["@mozilla.org/ssservice;1"]
                     .getService(Ci.nsISiteSecurityService);
         sss.clearAll();
       },
 
       get canClear()
       {
         return true;