michael@0: // Bug 474792 - Clear "Never remember passwords for this site" when michael@0: // clearing site-specific settings in Clear Recent History dialog michael@0: michael@0: let tempScope = {}; michael@0: Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader) michael@0: .loadSubScript("chrome://browser/content/sanitize.js", tempScope); michael@0: let Sanitizer = tempScope.Sanitizer; michael@0: michael@0: function test() { michael@0: michael@0: var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); michael@0: michael@0: // Add a disabled host michael@0: pwmgr.setLoginSavingEnabled("http://example.com", false); michael@0: michael@0: // Sanity check michael@0: is(pwmgr.getLoginSavingEnabled("http://example.com"), false, michael@0: "example.com should be disabled for password saving since we haven't cleared that yet."); michael@0: michael@0: // Set up the sanitizer to just clear siteSettings michael@0: let s = new Sanitizer(); michael@0: s.ignoreTimespan = false; michael@0: s.prefDomain = "privacy.cpd."; michael@0: var itemPrefs = gPrefService.getBranch(s.prefDomain); michael@0: itemPrefs.setBoolPref("history", false); michael@0: itemPrefs.setBoolPref("downloads", false); michael@0: itemPrefs.setBoolPref("cache", false); michael@0: itemPrefs.setBoolPref("cookies", false); michael@0: itemPrefs.setBoolPref("formdata", false); michael@0: itemPrefs.setBoolPref("offlineApps", false); michael@0: itemPrefs.setBoolPref("passwords", false); michael@0: itemPrefs.setBoolPref("sessions", false); michael@0: itemPrefs.setBoolPref("siteSettings", true); michael@0: michael@0: // Clear it michael@0: s.sanitize(); michael@0: michael@0: // Make sure it's gone michael@0: is(pwmgr.getLoginSavingEnabled("http://example.com"), true, michael@0: "example.com should be enabled for password saving again now that we've cleared."); michael@0: }