mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Minor password manager code simplification b=390447 r=dolske
This commit is contained in:
parent
2eec9423fa
commit
8396c12932
@ -292,17 +292,17 @@ LoginManager.prototype = {
|
||||
|
||||
// STATE_START is too early, doc is still the old page.
|
||||
if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_TRANSFERRING))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (!this._pwmgr._remember)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
var domWin = aWebProgress.DOMWindow;
|
||||
var domDoc = domWin.document;
|
||||
|
||||
// Only process things which might have HTML forms.
|
||||
if (! domDoc instanceof Ci.nsIDOMHTMLDocument)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
this._pwmgr.log("onStateChange accepted: req = " + (aRequest ?
|
||||
aRequest.name : "(null)") + ", flags = " + aStateFlags);
|
||||
@ -318,7 +318,7 @@ LoginManager.prototype = {
|
||||
this._pwmgr.log("onStateChange: adding dom listeners");
|
||||
domDoc.addEventListener("DOMContentLoaded",
|
||||
this._domEventListener, false);
|
||||
return 0;
|
||||
return;
|
||||
},
|
||||
|
||||
// stubs for the nsIWebProgressListener interfaces which we don't use.
|
||||
@ -349,16 +349,18 @@ LoginManager.prototype = {
|
||||
switch (event.type) {
|
||||
case "DOMContentLoaded":
|
||||
doc = event.target;
|
||||
return this._pwmgr._fillDocument(doc);
|
||||
this._pwmgr._fillDocument(doc);
|
||||
return;
|
||||
|
||||
case "DOMAutoComplete":
|
||||
case "blur":
|
||||
inputElement = event.target;
|
||||
return this._pwmgr._fillPassword(inputElement);
|
||||
this._pwmgr._fillPassword(inputElement);
|
||||
return;
|
||||
|
||||
default:
|
||||
this._pwmgr.log("Oops! This event unexpected.");
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -435,9 +437,7 @@ LoginManager.prototype = {
|
||||
*/
|
||||
getAllLogins : function (count) {
|
||||
this.log("Getting a list of all logins");
|
||||
var logins = this._storage.getAllLogins({});
|
||||
count.value = logins.length;
|
||||
return logins;
|
||||
return this._storage.getAllLogins(count);
|
||||
},
|
||||
|
||||
|
||||
@ -463,9 +463,7 @@ LoginManager.prototype = {
|
||||
*/
|
||||
getAllDisabledHosts : function (count) {
|
||||
this.log("Getting a list of all disabled hosts");
|
||||
var hosts = this._storage.getAllDisabledHosts({});
|
||||
count.value = hosts.length;
|
||||
return hosts;
|
||||
return this._storage.getAllDisabledHosts(count);
|
||||
},
|
||||
|
||||
|
||||
@ -479,10 +477,8 @@ LoginManager.prototype = {
|
||||
this.log("Searching for logins matching host: " + hostname +
|
||||
", formSubmitURL: " + formSubmitURL + ", httpRealm: " + httpRealm);
|
||||
|
||||
var logins = this._storage.findLogins({}, hostname, formSubmitURL,
|
||||
httpRealm);
|
||||
count.value = logins.length;
|
||||
return logins;
|
||||
return this._storage.findLogins(count, hostname, formSubmitURL,
|
||||
httpRealm);
|
||||
},
|
||||
|
||||
|
||||
|
@ -76,14 +76,8 @@ LoginManagerPromptFactory.prototype = {
|
||||
this._initialized = true;
|
||||
}
|
||||
|
||||
if (!aIID.equals(Ci.nsIAuthPrompt2))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
var prompter = new LoginManagerPrompter();
|
||||
prompter.init(this._pwmgr, this._promptService, aWindow);
|
||||
prompter.QueryInterface(Ci.nsIAuthPrompt2);
|
||||
|
||||
return prompter;
|
||||
return new LoginManagerPrompter(this._pwmgr, this._promptService,
|
||||
aWindow).QueryInterface(aIID);
|
||||
}
|
||||
}; // end of LoginManagerPromptFactory implementation
|
||||
|
||||
@ -103,7 +97,13 @@ LoginManagerPromptFactory.prototype = {
|
||||
* Invoked by a channel for protocol-based authentication (eg HTTP
|
||||
* Authenticate, FTP login)
|
||||
*/
|
||||
function LoginManagerPrompter() {}
|
||||
function LoginManagerPrompter(pwmgr, promptService, window) {
|
||||
this._pwmgr = pwmgr;
|
||||
this._promptService = promptService;
|
||||
this._window = window;
|
||||
|
||||
this.log("===== initialized =====");
|
||||
}
|
||||
LoginManagerPrompter.prototype = {
|
||||
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAuthPrompt2]),
|
||||
@ -123,15 +123,6 @@ LoginManagerPrompter.prototype = {
|
||||
_debug : false,
|
||||
|
||||
|
||||
init : function (aPWManager, aPromptService, aWindow) {
|
||||
this._pwmgr = aPWManager;
|
||||
this._promptService = aPromptService;
|
||||
this._window = aWindow;
|
||||
|
||||
this.log("===== initialized =====");
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* log
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user