1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_sanitize-passwordDisabledHosts.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +// Bug 474792 - Clear "Never remember passwords for this site" when 1.5 +// clearing site-specific settings in Clear Recent History dialog 1.6 + 1.7 +let tempScope = {}; 1.8 +Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader) 1.9 + .loadSubScript("chrome://browser/content/sanitize.js", tempScope); 1.10 +let Sanitizer = tempScope.Sanitizer; 1.11 + 1.12 +function test() { 1.13 + 1.14 + var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); 1.15 + 1.16 + // Add a disabled host 1.17 + pwmgr.setLoginSavingEnabled("http://example.com", false); 1.18 + 1.19 + // Sanity check 1.20 + is(pwmgr.getLoginSavingEnabled("http://example.com"), false, 1.21 + "example.com should be disabled for password saving since we haven't cleared that yet."); 1.22 + 1.23 + // Set up the sanitizer to just clear siteSettings 1.24 + let s = new Sanitizer(); 1.25 + s.ignoreTimespan = false; 1.26 + s.prefDomain = "privacy.cpd."; 1.27 + var itemPrefs = gPrefService.getBranch(s.prefDomain); 1.28 + itemPrefs.setBoolPref("history", false); 1.29 + itemPrefs.setBoolPref("downloads", false); 1.30 + itemPrefs.setBoolPref("cache", false); 1.31 + itemPrefs.setBoolPref("cookies", false); 1.32 + itemPrefs.setBoolPref("formdata", false); 1.33 + itemPrefs.setBoolPref("offlineApps", false); 1.34 + itemPrefs.setBoolPref("passwords", false); 1.35 + itemPrefs.setBoolPref("sessions", false); 1.36 + itemPrefs.setBoolPref("siteSettings", true); 1.37 + 1.38 + // Clear it 1.39 + s.sanitize(); 1.40 + 1.41 + // Make sure it's gone 1.42 + is(pwmgr.getLoginSavingEnabled("http://example.com"), true, 1.43 + "example.com should be enabled for password saving again now that we've cleared."); 1.44 +}