diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/components/passwordmgr/nsLoginInfo.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/passwordmgr/nsLoginInfo.js')
-rw-r--r-- | toolkit/components/passwordmgr/nsLoginInfo.js | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/toolkit/components/passwordmgr/nsLoginInfo.js b/toolkit/components/passwordmgr/nsLoginInfo.js new file mode 100644 index 000000000..d6ea86446 --- /dev/null +++ b/toolkit/components/passwordmgr/nsLoginInfo.js @@ -0,0 +1,93 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper", + "resource://gre/modules/LoginHelper.jsm"); + + +function nsLoginInfo() {} + +nsLoginInfo.prototype = { + + classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"), + QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]), + + // + // nsILoginInfo interfaces... + // + + hostname : null, + formSubmitURL : null, + httpRealm : null, + username : null, + password : null, + usernameField : null, + passwordField : null, + + init : function (aHostname, aFormSubmitURL, aHttpRealm, + aUsername, aPassword, + aUsernameField, aPasswordField) { + this.hostname = aHostname; + this.formSubmitURL = aFormSubmitURL; + this.httpRealm = aHttpRealm; + this.username = aUsername; + this.password = aPassword; + this.usernameField = aUsernameField; + this.passwordField = aPasswordField; + }, + + matches(aLogin, ignorePassword) { + return LoginHelper.doLoginsMatch(this, aLogin, { + ignorePassword, + }); + }, + + equals : function (aLogin) { + if (this.hostname != aLogin.hostname || + this.formSubmitURL != aLogin.formSubmitURL || + this.httpRealm != aLogin.httpRealm || + this.username != aLogin.username || + this.password != aLogin.password || + this.usernameField != aLogin.usernameField || + this.passwordField != aLogin.passwordField) + return false; + + return true; + }, + + clone : function() { + let clone = Cc["@mozilla.org/login-manager/loginInfo;1"]. + createInstance(Ci.nsILoginInfo); + clone.init(this.hostname, this.formSubmitURL, this.httpRealm, + this.username, this.password, + this.usernameField, this.passwordField); + + // Copy nsILoginMetaInfo props + clone.QueryInterface(Ci.nsILoginMetaInfo); + clone.guid = this.guid; + clone.timeCreated = this.timeCreated; + clone.timeLastUsed = this.timeLastUsed; + clone.timePasswordChanged = this.timePasswordChanged; + clone.timesUsed = this.timesUsed; + + return clone; + }, + + // + // nsILoginMetaInfo interfaces... + // + + guid : null, + timeCreated : null, + timeLastUsed : null, + timePasswordChanged : null, + timesUsed : null + +}; // end of nsLoginInfo implementation + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsLoginInfo]); |