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