Bug 716722 - Remove unnecessary code and use Services.jsm in sanitize.js. r=mbrubeck

This commit is contained in:
Margaret Leibovic 2012-01-09 15:59:14 -08:00
parent 57988d55bb
commit 2ffa604881

View File

@ -113,8 +113,7 @@ Sanitizer.prototype = {
cookies: { cookies: {
clear: function () clear: function ()
{ {
var cookieMgr = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager); Services.cookies.removeAll();
cookieMgr.removeAll();
}, },
get canClear() get canClear()
@ -130,9 +129,6 @@ Sanitizer.prototype = {
try { try {
var branch = Services.prefs.getBranch("geo.wifi.access_token."); var branch = Services.prefs.getBranch("geo.wifi.access_token.");
branch.deleteBranch(""); branch.deleteBranch("");
branch = Services.prefs.getBranch("geo.request.remember.");
branch.deleteBranch("");
} catch (e) {dump(e);} } catch (e) {dump(e);}
}, },
@ -149,15 +145,13 @@ Sanitizer.prototype = {
Services.perms.removeAll(); Services.perms.removeAll();
// Clear site-specific settings like page-zoom level // Clear site-specific settings like page-zoom level
var cps = Cc["@mozilla.org/content-pref/service;1"].getService(Ci.nsIContentPrefService); Services.contentPrefs.removeGroupedPrefs();
cps.removeGroupedPrefs();
// Clear "Never remember passwords for this site", which is not handled by // Clear "Never remember passwords for this site", which is not handled by
// the permission manager // the permission manager
var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); var hosts = Services.logins.getAllDisabledHosts({})
var hosts = pwmgr.getAllDisabledHosts({})
for each (var host in hosts) { for each (var host in hosts) {
pwmgr.setLoginSavingEnabled(host, true); Services.logins.setLoginSavingEnabled(host, true);
} }
}, },
@ -252,14 +246,12 @@ Sanitizer.prototype = {
passwords: { passwords: {
clear: function () clear: function ()
{ {
var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); Services.logins.removeAllLogins();
pwmgr.removeAllLogins();
}, },
get canClear() get canClear()
{ {
var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); Services.logins.countLogins("", "", ""); // count all logins
var count = pwmgr.countLogins("", "", ""); // count all logins
return (count > 0); return (count > 0);
} }
}, },