Bug 374723: re-design password manager API and implement in JS rather than C++, patch by Justin Dolske <dolske@mozilla.com>, r=mconnor, r=me

This commit is contained in:
gavin@gavinsharp.com 2007-10-02 20:35:36 -07:00
Родитель 21ff70bf1d
Коммит 9a3e5ff87f
1 изменённых файлов: 7 добавлений и 14 удалений

Просмотреть файл

@ -194,24 +194,17 @@ Sanitizer.prototype = {
passwords: {
clear: function ()
{
var pwmgr = Components.classes["@mozilla.org/passwordmanager;1"]
.getService(Components.interfaces.nsIPasswordManager);
var e = pwmgr.enumerator;
var passwds = [];
while (e.hasMoreElements()) {
var passwd = e.getNext().QueryInterface(Components.interfaces.nsIPassword);
passwds.push(passwd);
}
for (var i = 0; i < passwds.length; ++i)
pwmgr.removeUser(passwds[i].host, passwds[i].user);
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
pwmgr.removeAllLogins();
},
get canClear()
{
var pwmgr = Components.classes["@mozilla.org/passwordmanager;1"]
.getService(Components.interfaces.nsIPasswordManager);
return pwmgr.enumerator.hasMoreElements();
var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
.getService(Components.interfaces.nsILoginManager);
var logins = pwmgr.getAllLogins({});
return (logins.length > 0);
}
},