Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | // Bug 474792 - Clear "Never remember passwords for this site" when |
michael@0 | 2 | // clearing site-specific settings in Clear Recent History dialog |
michael@0 | 3 | |
michael@0 | 4 | let tempScope = {}; |
michael@0 | 5 | Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader) |
michael@0 | 6 | .loadSubScript("chrome://browser/content/sanitize.js", tempScope); |
michael@0 | 7 | let Sanitizer = tempScope.Sanitizer; |
michael@0 | 8 | |
michael@0 | 9 | function test() { |
michael@0 | 10 | |
michael@0 | 11 | var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); |
michael@0 | 12 | |
michael@0 | 13 | // Add a disabled host |
michael@0 | 14 | pwmgr.setLoginSavingEnabled("http://example.com", false); |
michael@0 | 15 | |
michael@0 | 16 | // Sanity check |
michael@0 | 17 | is(pwmgr.getLoginSavingEnabled("http://example.com"), false, |
michael@0 | 18 | "example.com should be disabled for password saving since we haven't cleared that yet."); |
michael@0 | 19 | |
michael@0 | 20 | // Set up the sanitizer to just clear siteSettings |
michael@0 | 21 | let s = new Sanitizer(); |
michael@0 | 22 | s.ignoreTimespan = false; |
michael@0 | 23 | s.prefDomain = "privacy.cpd."; |
michael@0 | 24 | var itemPrefs = gPrefService.getBranch(s.prefDomain); |
michael@0 | 25 | itemPrefs.setBoolPref("history", false); |
michael@0 | 26 | itemPrefs.setBoolPref("downloads", false); |
michael@0 | 27 | itemPrefs.setBoolPref("cache", false); |
michael@0 | 28 | itemPrefs.setBoolPref("cookies", false); |
michael@0 | 29 | itemPrefs.setBoolPref("formdata", false); |
michael@0 | 30 | itemPrefs.setBoolPref("offlineApps", false); |
michael@0 | 31 | itemPrefs.setBoolPref("passwords", false); |
michael@0 | 32 | itemPrefs.setBoolPref("sessions", false); |
michael@0 | 33 | itemPrefs.setBoolPref("siteSettings", true); |
michael@0 | 34 | |
michael@0 | 35 | // Clear it |
michael@0 | 36 | s.sanitize(); |
michael@0 | 37 | |
michael@0 | 38 | // Make sure it's gone |
michael@0 | 39 | is(pwmgr.getLoginSavingEnabled("http://example.com"), true, |
michael@0 | 40 | "example.com should be enabled for password saving again now that we've cleared."); |
michael@0 | 41 | } |