Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Bug 380852 - Delete permission manager entries in Clear Recent History |
michael@0 | 2 | |
michael@0 | 3 | let tempScope = {}; |
michael@0 | 4 | Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader) |
michael@0 | 5 | .loadSubScript("chrome://browser/content/sanitize.js", tempScope); |
michael@0 | 6 | let Sanitizer = tempScope.Sanitizer; |
michael@0 | 7 | |
michael@0 | 8 | function test() { |
michael@0 | 9 | |
michael@0 | 10 | // Add a permission entry |
michael@0 | 11 | var pm = Services.perms; |
michael@0 | 12 | pm.add(makeURI("http://example.com"), "testing", pm.ALLOW_ACTION); |
michael@0 | 13 | |
michael@0 | 14 | // Sanity check |
michael@0 | 15 | ok(pm.enumerator.hasMoreElements(), "Permission manager should have elements, since we just added one"); |
michael@0 | 16 | |
michael@0 | 17 | // Set up the sanitizer to just clear siteSettings |
michael@0 | 18 | let s = new Sanitizer(); |
michael@0 | 19 | s.ignoreTimespan = false; |
michael@0 | 20 | s.prefDomain = "privacy.cpd."; |
michael@0 | 21 | var itemPrefs = gPrefService.getBranch(s.prefDomain); |
michael@0 | 22 | itemPrefs.setBoolPref("history", false); |
michael@0 | 23 | itemPrefs.setBoolPref("downloads", false); |
michael@0 | 24 | itemPrefs.setBoolPref("cache", false); |
michael@0 | 25 | itemPrefs.setBoolPref("cookies", false); |
michael@0 | 26 | itemPrefs.setBoolPref("formdata", false); |
michael@0 | 27 | itemPrefs.setBoolPref("offlineApps", false); |
michael@0 | 28 | itemPrefs.setBoolPref("passwords", false); |
michael@0 | 29 | itemPrefs.setBoolPref("sessions", false); |
michael@0 | 30 | itemPrefs.setBoolPref("siteSettings", true); |
michael@0 | 31 | |
michael@0 | 32 | // Clear it |
michael@0 | 33 | s.sanitize(); |
michael@0 | 34 | |
michael@0 | 35 | // Make sure it's gone |
michael@0 | 36 | ok(!pm.enumerator.hasMoreElements(), "Permission manager shouldn't have entries after Sanitizing"); |
michael@0 | 37 | } |