gecko/browser/base/content/test/browser_sanitize-sitepermissions.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

// Bug 380852 - Delete permission manager entries in Clear Recent History
2009-07-27 23:18:29 -07:00
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://browser/content/sanitize.js");
function test() {
// Add a permission entry
2010-04-03 00:36:55 -07:00
var pm = Services.perms;
2009-07-28 00:09:50 -07:00
pm.add(makeURI("http://example.com"), "testing", pm.ALLOW_ACTION);
// Sanity check
ok(pm.enumerator.hasMoreElements(), "Permission manager should have elements, since we just added one");
// Set up the sanitizer to just clear siteSettings
let s = new Sanitizer();
s.ignoreTimespan = false;
s.prefDomain = "privacy.cpd.";
2009-07-27 23:18:29 -07:00
var itemPrefs = gPrefService.getBranch(s.prefDomain);
itemPrefs.setBoolPref("history", false);
itemPrefs.setBoolPref("downloads", false);
itemPrefs.setBoolPref("cache", false);
itemPrefs.setBoolPref("cookies", false);
itemPrefs.setBoolPref("formdata", false);
itemPrefs.setBoolPref("offlineApps", false);
itemPrefs.setBoolPref("passwords", false);
itemPrefs.setBoolPref("sessions", false);
itemPrefs.setBoolPref("siteSettings", true);
// Clear it
s.sanitize();
// Make sure it's gone
ok(!pm.enumerator.hasMoreElements(), "Permission manager shouldn't have entries after Sanitizing");
}