Bug 1128203 - Reduce indentation from 4 to 2 spaces. rs=dolske DONTBUILD CLOSED TREE

This commit is contained in:
Paolo Amadini 2015-01-31 21:25:49 +00:00
Родитель cb6a64404f
Коммит 174ae94f90
14 изменённых файлов: 5846 добавлений и 5846 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,4 +1,4 @@
/* vim: set ts=4 sts=4 sw=4 et tw=80: */
/* vim: set ts=2 sts=2 sw=2 et tw=80: */
/* 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/. */
@ -22,301 +22,301 @@ this.EXPORTED_SYMBOLS = [ "LoginManagerParent" ];
var gDebug;
function log(...pieces) {
function generateLogMessage(args) {
let strings = ['Login Manager (parent):'];
function generateLogMessage(args) {
let strings = ['Login Manager (parent):'];
args.forEach(function(arg) {
if (typeof arg === 'string') {
strings.push(arg);
} else if (typeof arg === 'undefined') {
strings.push('undefined');
} else if (arg === null) {
strings.push('null');
} else {
try {
strings.push(JSON.stringify(arg, null, 2));
} catch(err) {
strings.push("<<something>>");
}
}
});
return strings.join(' ');
}
args.forEach(function(arg) {
if (typeof arg === 'string') {
strings.push(arg);
} else if (typeof arg === 'undefined') {
strings.push('undefined');
} else if (arg === null) {
strings.push('null');
} else {
try {
strings.push(JSON.stringify(arg, null, 2));
} catch(err) {
strings.push("<<something>>");
}
}
});
return strings.join(' ');
}
if (!gDebug)
return;
if (!gDebug)
return;
let message = generateLogMessage(pieces);
dump(message + "\n");
Services.console.logStringMessage(message);
let message = generateLogMessage(pieces);
dump(message + "\n");
Services.console.logStringMessage(message);
}
function prefChanged() {
gDebug = Services.prefs.getBoolPref("signon.debug");
gDebug = Services.prefs.getBoolPref("signon.debug");
}
Services.prefs.addObserver("signon.debug", prefChanged, false);
prefChanged();
var LoginManagerParent = {
init: function() {
let mm = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);
mm.addMessageListener("RemoteLogins:findLogins", this);
mm.addMessageListener("RemoteLogins:onFormSubmit", this);
mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
},
init: function() {
let mm = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);
mm.addMessageListener("RemoteLogins:findLogins", this);
mm.addMessageListener("RemoteLogins:onFormSubmit", this);
mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
},
receiveMessage: function (msg) {
let data = msg.data;
switch (msg.name) {
case "RemoteLogins:findLogins": {
// TODO Verify msg.target's principals against the formOrigin?
this.findLogins(data.options.showMasterPassword,
data.formOrigin,
data.actionOrigin,
data.requestId,
msg.target.messageManager);
break;
}
receiveMessage: function (msg) {
let data = msg.data;
switch (msg.name) {
case "RemoteLogins:findLogins": {
// TODO Verify msg.target's principals against the formOrigin?
this.findLogins(data.options.showMasterPassword,
data.formOrigin,
data.actionOrigin,
data.requestId,
msg.target.messageManager);
break;
}
case "RemoteLogins:onFormSubmit": {
// TODO Verify msg.target's principals against the formOrigin?
this.onFormSubmit(data.hostname,
data.formSubmitURL,
data.usernameField,
data.newPasswordField,
data.oldPasswordField,
msg.objects.openerWin,
msg.target);
break;
}
case "RemoteLogins:onFormSubmit": {
// TODO Verify msg.target's principals against the formOrigin?
this.onFormSubmit(data.hostname,
data.formSubmitURL,
data.usernameField,
data.newPasswordField,
data.oldPasswordField,
msg.objects.openerWin,
msg.target);
break;
}
case "RemoteLogins:autoCompleteLogins": {
this.doAutocompleteSearch(data, msg.target);
break;
}
}
},
findLogins: function(showMasterPassword, formOrigin, actionOrigin,
requestId, target) {
if (!showMasterPassword && !Services.logins.isLoggedIn) {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
// If there are no logins for this site, bail out now.
if (!Services.logins.countLogins(formOrigin, "", null)) {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
// If we're currently displaying a master password prompt, defer
// processing this form until the user handles the prompt.
if (Services.logins.uiBusy) {
log("deferring onFormPassword for", formOrigin);
let self = this;
let observer = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe: function (subject, topic, data) {
log("Got deferred onFormPassword notification:", topic);
// Only run observer once.
Services.obs.removeObserver(this, "passwordmgr-crypto-login");
Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
if (topic == "passwordmgr-crypto-loginCanceled") {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
self.findLogins(showMasterPassword, formOrigin, actionOrigin,
requestId, target);
},
};
// Possible leak: it's possible that neither of these notifications
// will fire, and if that happens, we'll leak the observer (and
// never return). We should guarantee that at least one of these
// will fire.
// See bug XXX.
Services.obs.addObserver(observer, "passwordmgr-crypto-login", false);
Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", false);
return;
}
var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: logins });
},
doAutocompleteSearch: function({ formOrigin, actionOrigin,
searchString, previousResult,
rect, requestId, remote }, target) {
// Note: previousResult is a regular object, not an
// nsIAutoCompleteResult.
var result;
let searchStringLower = searchString.toLowerCase();
let logins;
if (previousResult &&
searchStringLower.startsWith(previousResult.searchString.toLowerCase())) {
log("Using previous autocomplete result");
// We have a list of results for a shorter search string, so just
// filter them further based on the new search string.
logins = previousResult.logins;
} else {
log("Creating new autocomplete search result.");
// Grab the logins from the database.
logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
}
let matchingLogins = logins.filter(function(fullMatch) {
let match = fullMatch.username;
// Remove results that are too short, or have different prefix.
// Also don't offer empty usernames as possible results.
return match && match.toLowerCase().startsWith(searchStringLower);
});
// XXX In the E10S case, we're responsible for showing our own
// autocomplete popup here because the autocomplete protocol hasn't
// been e10s-ized yet. In the non-e10s case, our caller is responsible
// for showing the autocomplete popup (via the regular
// nsAutoCompleteController).
if (remote) {
result = new UserAutoCompleteResult(searchString, matchingLogins);
AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result);
}
target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted",
{ requestId: requestId,
logins: matchingLogins });
},
onFormSubmit: function(hostname, formSubmitURL,
usernameField, newPasswordField,
oldPasswordField, opener,
target) {
function getPrompter() {
var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
createInstance(Ci.nsILoginManagerPrompter);
// XXX For E10S, we don't want to use the browser's contentWindow
// because it's in another process, so we use our chrome window as
// the window parent (the content process is responsible for
// making sure that its window is not in private browsing mode).
// In the same-process case, we can simply use the content window.
prompterSvc.init(target.isRemoteBrowser ?
target.ownerDocument.defaultView :
target.contentWindow);
if (target.isRemoteBrowser)
prompterSvc.setE10sData(target, opener);
return prompterSvc;
}
if (!Services.logins.getLoginSavingEnabled(hostname)) {
log("(form submission ignored -- saving is disabled for:", hostname, ")");
return;
}
var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
formLogin.init(hostname, formSubmitURL, null,
(usernameField ? usernameField.value : ""),
newPasswordField.value,
(usernameField ? usernameField.name : ""),
newPasswordField.name);
// If we didn't find a username field, but seem to be changing a
// password, allow the user to select from a list of applicable
// logins to update the password for.
if (!usernameField && oldPasswordField) {
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
if (logins.length == 0) {
// Could prompt to save this as a new password-only login.
// This seems uncommon, and might be wrong, so ignore.
log("(no logins for this host -- pwchange ignored)");
return;
}
var prompter = getPrompter();
if (logins.length == 1) {
var oldLogin = logins[0];
formLogin.username = oldLogin.username;
formLogin.usernameField = oldLogin.usernameField;
prompter.promptToChangePassword(oldLogin, formLogin);
} else {
prompter.promptToChangePasswordWithUsernames(
logins, logins.length, formLogin);
}
return;
}
// Look for an existing login that matches the form login.
var existingLogin = null;
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
for (var i = 0; i < logins.length; i++) {
var same, login = logins[i];
// If one login has a username but the other doesn't, ignore
// the username when comparing and only match if they have the
// same password. Otherwise, compare the logins and match even
// if the passwords differ.
if (!login.username && formLogin.username) {
var restoreMe = formLogin.username;
formLogin.username = "";
same = formLogin.matches(login, false);
formLogin.username = restoreMe;
} else if (!formLogin.username && login.username) {
formLogin.username = login.username;
same = formLogin.matches(login, false);
formLogin.username = ""; // we know it's always blank.
} else {
same = formLogin.matches(login, true);
}
if (same) {
existingLogin = login;
break;
}
}
if (existingLogin) {
log("Found an existing login matching this form submission");
// Change password if needed.
if (existingLogin.password != formLogin.password) {
log("...passwords differ, prompting to change.");
prompter = getPrompter();
prompter.promptToChangePassword(existingLogin, formLogin);
} else {
// Update the lastUsed timestamp.
var propBag = Cc["@mozilla.org/hash-property-bag;1"].
createInstance(Ci.nsIWritablePropertyBag);
propBag.setProperty("timeLastUsed", Date.now());
propBag.setProperty("timesUsedIncrement", 1);
Services.logins.modifyLogin(existingLogin, propBag);
}
return;
}
// Prompt user to save login (via dialog or notification bar)
prompter = getPrompter();
prompter.promptToSavePassword(formLogin);
case "RemoteLogins:autoCompleteLogins": {
this.doAutocompleteSearch(data, msg.target);
break;
}
}
},
findLogins: function(showMasterPassword, formOrigin, actionOrigin,
requestId, target) {
if (!showMasterPassword && !Services.logins.isLoggedIn) {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
// If there are no logins for this site, bail out now.
if (!Services.logins.countLogins(formOrigin, "", null)) {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
// If we're currently displaying a master password prompt, defer
// processing this form until the user handles the prompt.
if (Services.logins.uiBusy) {
log("deferring onFormPassword for", formOrigin);
let self = this;
let observer = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
observe: function (subject, topic, data) {
log("Got deferred onFormPassword notification:", topic);
// Only run observer once.
Services.obs.removeObserver(this, "passwordmgr-crypto-login");
Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
if (topic == "passwordmgr-crypto-loginCanceled") {
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: [] });
return;
}
self.findLogins(showMasterPassword, formOrigin, actionOrigin,
requestId, target);
},
};
// Possible leak: it's possible that neither of these notifications
// will fire, and if that happens, we'll leak the observer (and
// never return). We should guarantee that at least one of these
// will fire.
// See bug XXX.
Services.obs.addObserver(observer, "passwordmgr-crypto-login", false);
Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", false);
return;
}
var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
target.sendAsyncMessage("RemoteLogins:loginsFound",
{ requestId: requestId, logins: logins });
},
doAutocompleteSearch: function({ formOrigin, actionOrigin,
searchString, previousResult,
rect, requestId, remote }, target) {
// Note: previousResult is a regular object, not an
// nsIAutoCompleteResult.
var result;
let searchStringLower = searchString.toLowerCase();
let logins;
if (previousResult &&
searchStringLower.startsWith(previousResult.searchString.toLowerCase())) {
log("Using previous autocomplete result");
// We have a list of results for a shorter search string, so just
// filter them further based on the new search string.
logins = previousResult.logins;
} else {
log("Creating new autocomplete search result.");
// Grab the logins from the database.
logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
}
let matchingLogins = logins.filter(function(fullMatch) {
let match = fullMatch.username;
// Remove results that are too short, or have different prefix.
// Also don't offer empty usernames as possible results.
return match && match.toLowerCase().startsWith(searchStringLower);
});
// XXX In the E10S case, we're responsible for showing our own
// autocomplete popup here because the autocomplete protocol hasn't
// been e10s-ized yet. In the non-e10s case, our caller is responsible
// for showing the autocomplete popup (via the regular
// nsAutoCompleteController).
if (remote) {
result = new UserAutoCompleteResult(searchString, matchingLogins);
AutoCompleteE10S.showPopupWithResults(target.ownerDocument.defaultView, rect, result);
}
target.messageManager.sendAsyncMessage("RemoteLogins:loginsAutoCompleted",
{ requestId: requestId,
logins: matchingLogins });
},
onFormSubmit: function(hostname, formSubmitURL,
usernameField, newPasswordField,
oldPasswordField, opener,
target) {
function getPrompter() {
var prompterSvc = Cc["@mozilla.org/login-manager/prompter;1"].
createInstance(Ci.nsILoginManagerPrompter);
// XXX For E10S, we don't want to use the browser's contentWindow
// because it's in another process, so we use our chrome window as
// the window parent (the content process is responsible for
// making sure that its window is not in private browsing mode).
// In the same-process case, we can simply use the content window.
prompterSvc.init(target.isRemoteBrowser ?
target.ownerDocument.defaultView :
target.contentWindow);
if (target.isRemoteBrowser)
prompterSvc.setE10sData(target, opener);
return prompterSvc;
}
if (!Services.logins.getLoginSavingEnabled(hostname)) {
log("(form submission ignored -- saving is disabled for:", hostname, ")");
return;
}
var formLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
formLogin.init(hostname, formSubmitURL, null,
(usernameField ? usernameField.value : ""),
newPasswordField.value,
(usernameField ? usernameField.name : ""),
newPasswordField.name);
// If we didn't find a username field, but seem to be changing a
// password, allow the user to select from a list of applicable
// logins to update the password for.
if (!usernameField && oldPasswordField) {
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
if (logins.length == 0) {
// Could prompt to save this as a new password-only login.
// This seems uncommon, and might be wrong, so ignore.
log("(no logins for this host -- pwchange ignored)");
return;
}
var prompter = getPrompter();
if (logins.length == 1) {
var oldLogin = logins[0];
formLogin.username = oldLogin.username;
formLogin.usernameField = oldLogin.usernameField;
prompter.promptToChangePassword(oldLogin, formLogin);
} else {
prompter.promptToChangePasswordWithUsernames(
logins, logins.length, formLogin);
}
return;
}
// Look for an existing login that matches the form login.
var existingLogin = null;
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
for (var i = 0; i < logins.length; i++) {
var same, login = logins[i];
// If one login has a username but the other doesn't, ignore
// the username when comparing and only match if they have the
// same password. Otherwise, compare the logins and match even
// if the passwords differ.
if (!login.username && formLogin.username) {
var restoreMe = formLogin.username;
formLogin.username = "";
same = formLogin.matches(login, false);
formLogin.username = restoreMe;
} else if (!formLogin.username && login.username) {
formLogin.username = login.username;
same = formLogin.matches(login, false);
formLogin.username = ""; // we know it's always blank.
} else {
same = formLogin.matches(login, true);
}
if (same) {
existingLogin = login;
break;
}
}
if (existingLogin) {
log("Found an existing login matching this form submission");
// Change password if needed.
if (existingLogin.password != formLogin.password) {
log("...passwords differ, prompting to change.");
prompter = getPrompter();
prompter.promptToChangePassword(existingLogin, formLogin);
} else {
// Update the lastUsed timestamp.
var propBag = Cc["@mozilla.org/hash-property-bag;1"].
createInstance(Ci.nsIWritablePropertyBag);
propBag.setProperty("timeLastUsed", Date.now());
propBag.setProperty("timesUsedIncrement", 1);
Services.logins.modifyLogin(existingLogin, propBag);
}
return;
}
// Prompt user to save login (via dialog or notification bar)
prompter = getPrompter();
prompter.promptToSavePassword(formLogin);
}
};

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

@ -11,210 +11,210 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
function LoginManagerCrypto_SDR() {
this.init();
this.init();
};
LoginManagerCrypto_SDR.prototype = {
classID : Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerCrypto]),
classID : Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerCrypto]),
__sdrSlot : null, // PKCS#11 slot being used by the SDR.
get _sdrSlot() {
if (!this.__sdrSlot) {
let modules = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
this.__sdrSlot = modules.findSlotByName("");
}
return this.__sdrSlot;
},
__sdrSlot : null, // PKCS#11 slot being used by the SDR.
get _sdrSlot() {
if (!this.__sdrSlot) {
let modules = Cc["@mozilla.org/security/pkcs11moduledb;1"].
getService(Ci.nsIPKCS11ModuleDB);
this.__sdrSlot = modules.findSlotByName("");
}
return this.__sdrSlot;
},
__decoderRing : null, // nsSecretDecoderRing service
get _decoderRing() {
if (!this.__decoderRing)
this.__decoderRing = Cc["@mozilla.org/security/sdr;1"].
getService(Ci.nsISecretDecoderRing);
return this.__decoderRing;
},
__decoderRing : null, // nsSecretDecoderRing service
get _decoderRing() {
if (!this.__decoderRing)
this.__decoderRing = Cc["@mozilla.org/security/sdr;1"].
getService(Ci.nsISecretDecoderRing);
return this.__decoderRing;
},
__utfConverter : null, // UCS2 <--> UTF8 string conversion
get _utfConverter() {
if (!this.__utfConverter) {
this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
this.__utfConverter.charset = "UTF-8";
}
return this.__utfConverter;
},
__utfConverter : null, // UCS2 <--> UTF8 string conversion
get _utfConverter() {
if (!this.__utfConverter) {
this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Ci.nsIScriptableUnicodeConverter);
this.__utfConverter.charset = "UTF-8";
}
return this.__utfConverter;
},
_utfConverterReset : function() {
this.__utfConverter = null;
},
_utfConverterReset : function() {
this.__utfConverter = null;
},
_debug : false, // mirrors signon.debug
_uiBusy : false,
_debug : false, // mirrors signon.debug
_uiBusy : false,
/*
* log
*
* Internal function for logging debug messages to the Error Console.
*/
log : function (message) {
if (!this._debug)
return;
dump("PwMgr cryptoSDR: " + message + "\n");
Services.console.logStringMessage("PwMgr cryptoSDR: " + message);
},
/*
* log
*
* Internal function for logging debug messages to the Error Console.
*/
log : function (message) {
if (!this._debug)
return;
dump("PwMgr cryptoSDR: " + message + "\n");
Services.console.logStringMessage("PwMgr cryptoSDR: " + message);
},
init : function () {
// Connect to the correct preferences branch.
this._prefBranch = Services.prefs.getBranch("signon.");
init : function () {
// Connect to the correct preferences branch.
this._prefBranch = Services.prefs.getBranch("signon.");
this._debug = this._prefBranch.getBoolPref("debug");
this._debug = this._prefBranch.getBoolPref("debug");
// Check to see if the internal PKCS#11 token has been initialized.
// If not, set a blank password.
let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
getService(Ci.nsIPK11TokenDB);
// Check to see if the internal PKCS#11 token has been initialized.
// If not, set a blank password.
let tokenDB = Cc["@mozilla.org/security/pk11tokendb;1"].
getService(Ci.nsIPK11TokenDB);
let token = tokenDB.getInternalKeyToken();
if (token.needsUserInit) {
this.log("Initializing key3.db with default blank password.");
token.initPassword("");
}
},
let token = tokenDB.getInternalKeyToken();
if (token.needsUserInit) {
this.log("Initializing key3.db with default blank password.");
token.initPassword("");
}
},
/*
* encrypt
*
* Encrypts the specified string, using the SecretDecoderRing.
*
* Returns the encrypted string, or throws an exception if there was a
* problem.
*/
encrypt : function (plainText) {
let cipherText = null;
/*
* encrypt
*
* Encrypts the specified string, using the SecretDecoderRing.
*
* Returns the encrypted string, or throws an exception if there was a
* problem.
*/
encrypt : function (plainText) {
let cipherText = null;
let wasLoggedIn = this.isLoggedIn;
let canceledMP = false;
let wasLoggedIn = this.isLoggedIn;
let canceledMP = false;
this._uiBusy = true;
try {
let plainOctet = this._utfConverter.ConvertFromUnicode(plainText);
plainOctet += this._utfConverter.Finish();
cipherText = this._decoderRing.encryptString(plainOctet);
} catch (e) {
this.log("Failed to encrypt string. (" + e.name + ")");
// If the user clicks Cancel, we get NS_ERROR_FAILURE.
// (unlike decrypting, which gets NS_ERROR_NOT_AVAILABLE).
if (e.result == Cr.NS_ERROR_FAILURE) {
canceledMP = true;
throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
} else {
throw Components.Exception("Couldn't encrypt string", Cr.NS_ERROR_FAILURE);
}
} finally {
this._uiBusy = false;
// If we triggered a master password prompt, notify observers.
if (!wasLoggedIn && this.isLoggedIn)
this._notifyObservers("passwordmgr-crypto-login");
else if (canceledMP)
this._notifyObservers("passwordmgr-crypto-loginCanceled");
}
return cipherText;
},
this._uiBusy = true;
try {
let plainOctet = this._utfConverter.ConvertFromUnicode(plainText);
plainOctet += this._utfConverter.Finish();
cipherText = this._decoderRing.encryptString(plainOctet);
} catch (e) {
this.log("Failed to encrypt string. (" + e.name + ")");
// If the user clicks Cancel, we get NS_ERROR_FAILURE.
// (unlike decrypting, which gets NS_ERROR_NOT_AVAILABLE).
if (e.result == Cr.NS_ERROR_FAILURE) {
canceledMP = true;
throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
} else {
throw Components.Exception("Couldn't encrypt string", Cr.NS_ERROR_FAILURE);
}
} finally {
this._uiBusy = false;
// If we triggered a master password prompt, notify observers.
if (!wasLoggedIn && this.isLoggedIn)
this._notifyObservers("passwordmgr-crypto-login");
else if (canceledMP)
this._notifyObservers("passwordmgr-crypto-loginCanceled");
}
return cipherText;
},
/*
* decrypt
*
* Decrypts the specified string, using the SecretDecoderRing.
*
* Returns the decrypted string, or throws an exception if there was a
* problem.
*/
decrypt : function (cipherText) {
let plainText = null;
/*
* decrypt
*
* Decrypts the specified string, using the SecretDecoderRing.
*
* Returns the decrypted string, or throws an exception if there was a
* problem.
*/
decrypt : function (cipherText) {
let plainText = null;
let wasLoggedIn = this.isLoggedIn;
let canceledMP = false;
let wasLoggedIn = this.isLoggedIn;
let canceledMP = false;
this._uiBusy = true;
try {
let plainOctet;
plainOctet = this._decoderRing.decryptString(cipherText);
plainText = this._utfConverter.ConvertToUnicode(plainOctet);
} catch (e) {
this.log("Failed to decrypt string: " + cipherText +
" (" + e.name + ")");
this._uiBusy = true;
try {
let plainOctet;
plainOctet = this._decoderRing.decryptString(cipherText);
plainText = this._utfConverter.ConvertToUnicode(plainOctet);
} catch (e) {
this.log("Failed to decrypt string: " + cipherText +
" (" + e.name + ")");
// In the unlikely event the converter threw, reset it.
this._utfConverterReset();
// In the unlikely event the converter threw, reset it.
this._utfConverterReset();
// If the user clicks Cancel, we get NS_ERROR_NOT_AVAILABLE.
// If the cipherText is bad / wrong key, we get NS_ERROR_FAILURE
// Wrong passwords are handled by the decoderRing reprompting;
// we get no notification.
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
canceledMP = true;
throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
} else {
throw Components.Exception("Couldn't decrypt string", Cr.NS_ERROR_FAILURE);
}
} finally {
this._uiBusy = false;
// If we triggered a master password prompt, notify observers.
if (!wasLoggedIn && this.isLoggedIn)
this._notifyObservers("passwordmgr-crypto-login");
else if (canceledMP)
this._notifyObservers("passwordmgr-crypto-loginCanceled");
}
// If the user clicks Cancel, we get NS_ERROR_NOT_AVAILABLE.
// If the cipherText is bad / wrong key, we get NS_ERROR_FAILURE
// Wrong passwords are handled by the decoderRing reprompting;
// we get no notification.
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
canceledMP = true;
throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
} else {
throw Components.Exception("Couldn't decrypt string", Cr.NS_ERROR_FAILURE);
}
} finally {
this._uiBusy = false;
// If we triggered a master password prompt, notify observers.
if (!wasLoggedIn && this.isLoggedIn)
this._notifyObservers("passwordmgr-crypto-login");
else if (canceledMP)
this._notifyObservers("passwordmgr-crypto-loginCanceled");
}
return plainText;
},
return plainText;
},
/*
* uiBusy
*/
get uiBusy() {
return this._uiBusy;
},
/*
* uiBusy
*/
get uiBusy() {
return this._uiBusy;
},
/*
* isLoggedIn
*/
get isLoggedIn() {
let status = this._sdrSlot.status;
this.log("SDR slot status is " + status);
if (status == Ci.nsIPKCS11Slot.SLOT_READY ||
status == Ci.nsIPKCS11Slot.SLOT_LOGGED_IN)
return true;
if (status == Ci.nsIPKCS11Slot.SLOT_NOT_LOGGED_IN)
return false;
throw Components.Exception("unexpected slot status: " + status, Cr.NS_ERROR_FAILURE);
},
/*
* isLoggedIn
*/
get isLoggedIn() {
let status = this._sdrSlot.status;
this.log("SDR slot status is " + status);
if (status == Ci.nsIPKCS11Slot.SLOT_READY ||
status == Ci.nsIPKCS11Slot.SLOT_LOGGED_IN)
return true;
if (status == Ci.nsIPKCS11Slot.SLOT_NOT_LOGGED_IN)
return false;
throw Components.Exception("unexpected slot status: " + status, Cr.NS_ERROR_FAILURE);
},
/*
* defaultEncType
*/
get defaultEncType() {
return Ci.nsILoginManagerCrypto.ENCTYPE_SDR;
},
/*
* defaultEncType
*/
get defaultEncType() {
return Ci.nsILoginManagerCrypto.ENCTYPE_SDR;
},
/*
* _notifyObservers
*/
_notifyObservers : function(topic) {
this.log("Prompted for a master password, notifying for " + topic);
Services.obs.notifyObservers(null, topic, null);
},
/*
* _notifyObservers
*/
_notifyObservers : function(topic) {
this.log("Prompted for a master password, notifying for " + topic);
Services.obs.notifyObservers(null, topic, null);
},
}; // end of nsLoginManagerCrypto_SDR implementation
let component = [LoginManagerCrypto_SDR];

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

@ -12,105 +12,105 @@
* password manager.
*/
interface nsILoginInfo : nsISupports {
/**
* The hostname the login applies to.
*
* The hostname should be formatted as an URL. For example,
* "https://site.com", "http://site.com:1234", "ftp://ftp.site.com".
*/
attribute AString hostname;
/**
* The hostname the login applies to.
*
* The hostname should be formatted as an URL. For example,
* "https://site.com", "http://site.com:1234", "ftp://ftp.site.com".
*/
attribute AString hostname;
/**
* The URL a form-based login was submitted to.
*
* For logins obtained from HTML forms, this field is the |action|
* attribute from the |form| element, with the path removed. For
* example "http://www.site.com". [Forms with no |action| attribute
* default to submitting to their origin URL, so we store that.]
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is NULL.
*/
attribute AString formSubmitURL;
/**
* The URL a form-based login was submitted to.
*
* For logins obtained from HTML forms, this field is the |action|
* attribute from the |form| element, with the path removed. For
* example "http://www.site.com". [Forms with no |action| attribute
* default to submitting to their origin URL, so we store that.]
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is NULL.
*/
attribute AString formSubmitURL;
/**
* The HTTP Realm a login was requested for.
*
* When an HTTP server sends a 401 result, the WWW-Authenticate
* header includes a realm to identify the "protection space." See
* RFC2617. If the response sent has a missing or blank realm, the
* hostname is used instead.
*
* For logins obtained from HTML forms, this field is NULL.
*/
attribute AString httpRealm;
/**
* The HTTP Realm a login was requested for.
*
* When an HTTP server sends a 401 result, the WWW-Authenticate
* header includes a realm to identify the "protection space." See
* RFC2617. If the response sent has a missing or blank realm, the
* hostname is used instead.
*
* For logins obtained from HTML forms, this field is NULL.
*/
attribute AString httpRealm;
/**
* The username for the login.
*/
attribute AString username;
/**
* The username for the login.
*/
attribute AString username;
/**
* The |name| attribute for the username input field.
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is an empty string.
*/
attribute AString usernameField;
/**
* The |name| attribute for the username input field.
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is an empty string.
*/
attribute AString usernameField;
/**
* The password for the login.
*/
attribute AString password;
/**
* The password for the login.
*/
attribute AString password;
/**
* The |name| attribute for the password input field.
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is an empty string.
*/
attribute AString passwordField;
/**
* The |name| attribute for the password input field.
*
* For logins obtained from a HTTP or FTP protocol authentication,
* this field is an empty string.
*/
attribute AString passwordField;
/**
* Initialize a newly created nsLoginInfo object.
*
* The arguments are the fields for the new object.
*/
void init(in AString aHostname,
in AString aFormSubmitURL, in AString aHttpRealm,
in AString aUsername, in AString aPassword,
in AString aUsernameField, in AString aPasswordField);
/**
* Initialize a newly created nsLoginInfo object.
*
* The arguments are the fields for the new object.
*/
void init(in AString aHostname,
in AString aFormSubmitURL, in AString aHttpRealm,
in AString aUsername, in AString aPassword,
in AString aUsernameField, in AString aPasswordField);
/**
* Test for strict equality with another nsILoginInfo object.
*
* @param aLoginInfo
* The other object to test.
*/
boolean equals(in nsILoginInfo aLoginInfo);
/**
* Test for strict equality with another nsILoginInfo object.
*
* @param aLoginInfo
* The other object to test.
*/
boolean equals(in nsILoginInfo aLoginInfo);
/**
* Test for loose equivalency with another nsILoginInfo object. The
* passwordField and usernameField values are ignored, and the password
* values may be optionally ignored. If one login's formSubmitURL is an
* empty string (but not null), it will be treated as a wildcard. [The
* blank value indicates the login was stored before bug 360493 was fixed.]
*
* @param aLoginInfo
* The other object to test.
* @param ignorePassword
* If true, ignore the password when checking for match.
*/
boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);
/**
* Test for loose equivalency with another nsILoginInfo object. The
* passwordField and usernameField values are ignored, and the password
* values may be optionally ignored. If one login's formSubmitURL is an
* empty string (but not null), it will be treated as a wildcard. [The
* blank value indicates the login was stored before bug 360493 was fixed.]
*
* @param aLoginInfo
* The other object to test.
* @param ignorePassword
* If true, ignore the password when checking for match.
*/
boolean matches(in nsILoginInfo aLoginInfo, in boolean ignorePassword);
/**
* Create an identical copy of the login, duplicating all of the login's
* nsILoginInfo and nsILoginMetaInfo properties.
*
* This allows code to be forwards-compatible, when additional properties
* are added to nsILoginMetaInfo (or nsILoginInfo) in the future.
*/
nsILoginInfo clone();
/**
* Create an identical copy of the login, duplicating all of the login's
* nsILoginInfo and nsILoginMetaInfo properties.
*
* This allows code to be forwards-compatible, when additional properties
* are added to nsILoginMetaInfo (or nsILoginInfo) in the future.
*/
nsILoginInfo clone();
};
%{C++

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

@ -15,248 +15,248 @@ interface nsIPropertyBag;
[scriptable, uuid(f0c5ca21-db71-4b32-993e-ab63054cc6f5)]
interface nsILoginManager : nsISupports {
/**
* This promise is resolved when initialization is complete, and is rejected
* in case initialization failed. This includes the initial loading of the
* login data as well as any migration from previous versions.
*
* Calling any method of nsILoginManager before this promise is resolved
* might trigger the synchronous initialization fallback.
*/
readonly attribute jsval initializationPromise;
/**
* This promise is resolved when initialization is complete, and is rejected
* in case initialization failed. This includes the initial loading of the
* login data as well as any migration from previous versions.
*
* Calling any method of nsILoginManager before this promise is resolved
* might trigger the synchronous initialization fallback.
*/
readonly attribute jsval initializationPromise;
/**
* Store a new login in the login manager.
*
* @param aLogin
* The login to be added.
*
* Default values for the login's nsILoginMetaInfo properties will be
* created. However, if the caller specifies non-default values, they will
* be used instead.
*/
void addLogin(in nsILoginInfo aLogin);
/**
* Store a new login in the login manager.
*
* @param aLogin
* The login to be added.
*
* Default values for the login's nsILoginMetaInfo properties will be
* created. However, if the caller specifies non-default values, they will
* be used instead.
*/
void addLogin(in nsILoginInfo aLogin);
/**
* Remove a login from the login manager.
*
* @param aLogin
* The login to be removed.
*
* The specified login must exactly match a stored login. However, the
* values of any nsILoginMetaInfo properties are ignored.
*/
void removeLogin(in nsILoginInfo aLogin);
/**
* Remove a login from the login manager.
*
* @param aLogin
* The login to be removed.
*
* The specified login must exactly match a stored login. However, the
* values of any nsILoginMetaInfo properties are ignored.
*/
void removeLogin(in nsILoginInfo aLogin);
/**
* Modify an existing login in the login manager.
*
* @param oldLogin
* The login to be modified.
* @param newLoginData
* The new login values (either a nsILoginInfo or nsIProperyBag)
*
* If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
* properties are changed to the values from newLoginData (but the old
* login's nsILoginMetaInfo properties are unmodified).
*
* If newLoginData is a nsIPropertyBag, only the specified properties
* will be changed. The nsILoginMetaInfo properties of oldLogin can be
* changed in this manner.
*
* If the propertybag contains an item named "timesUsedIncrement", the
* login's timesUsed property will be incremented by the item's value.
*/
void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
/**
* Modify an existing login in the login manager.
*
* @param oldLogin
* The login to be modified.
* @param newLoginData
* The new login values (either a nsILoginInfo or nsIProperyBag)
*
* If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
* properties are changed to the values from newLoginData (but the old
* login's nsILoginMetaInfo properties are unmodified).
*
* If newLoginData is a nsIPropertyBag, only the specified properties
* will be changed. The nsILoginMetaInfo properties of oldLogin can be
* changed in this manner.
*
* If the propertybag contains an item named "timesUsedIncrement", the
* login's timesUsed property will be incremented by the item's value.
*/
void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
/**
* Remove all logins known to login manager.
*
* The browser sanitization feature allows the user to clear any stored
* passwords. This interface allows that to be done without getting each
* login first (which might require knowing the master password).
*
*/
void removeAllLogins();
/**
* Remove all logins known to login manager.
*
* The browser sanitization feature allows the user to clear any stored
* passwords. This interface allows that to be done without getting each
* login first (which might require knowing the master password).
*
*/
void removeAllLogins();
/**
* Fetch all logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllLogins();
* (|logins| is an array).
*/
void getAllLogins([optional] out unsigned long count,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Obtain a list of all hosts for which password saving is disabled.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param hostnames
* An array of hostname strings, in origin URL format without a
* pathname. For example: "https://www.site.com".
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getDisabledAllLogins();
*/
void getAllDisabledHosts([optional] out unsigned long count,
[retval, array, size_is(count)] out wstring hostnames);
/**
* Check to see if saving logins has been disabled for a host.
*
* @param aHost
* The hostname to check. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
*/
boolean getLoginSavingEnabled(in AString aHost);
/**
* Disable (or enable) storing logins for the specified host. When
* disabled, the login manager will not prompt to store logins for
* that host. Existing logins are not affected.
*
* @param aHost
* The hostname to set. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
* @param isEnabled
* Specify if saving logins should be enabled (true) or
* disabled (false)
*/
void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
/**
* Search for logins matching the specified criteria. Called when looking
* for logins that might be applicable to a form or authentication request.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |findLogins({}, hostname, ...)|
* @param aHostname
* The hostname to restrict searches to, in URL format. For
* example: "http://www.site.com".
* To find logins for a given nsIURI, you would typically pass in
* its prePath.
* @param aActionURL
* For form logins, this argument should be the URL to which the
* form will be submitted. For protocol logins, specify null.
* An empty string ("") will match any value (except null).
* @param aHttpRealm
* For protocol logins, this argument should be the HTTP Realm
* for which the login applies. This is obtained from the
* WWW-Authenticate header. See RFC2617. For form logins,
* specify null.
* An empty string ("") will match any value (except null).
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.findLogins({}, hostname, ...);
*
*/
void findLogins(out unsigned long count, in AString aHostname,
in AString aActionURL, in AString aHttpRealm,
/**
* Fetch all logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllLogins();
* (|logins| is an array).
*/
void getAllLogins([optional] out unsigned long count,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Search for logins matching the specified criteria, as with
* findLogins(). This interface only returns the number of matching
* logins (and not the logins themselves), which allows a caller to
* check for logins without causing the user to be prompted for a master
* password to decrypt the logins.
*
* @param aHostname
* The hostname to restrict searches to. Specify an empty string
* to match all hosts. A null value will not match any logins, and
* will thus always return a count of 0.
* @param aActionURL
* The URL to which a form login will be submitted. To match any
* form login, specify an empty string. To not match any form
* login, specify null.
* @param aHttpRealm
* The HTTP Realm for which the login applies. To match logins for
* any realm, specify an empty string. To not match logins for any
* realm, specify null.
*/
unsigned long countLogins(in AString aHostname, in AString aActionURL,
in AString aHttpRealm);
/**
* Obtain a list of all hosts for which password saving is disabled.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param hostnames
* An array of hostname strings, in origin URL format without a
* pathname. For example: "https://www.site.com".
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getDisabledAllLogins();
*/
void getAllDisabledHosts([optional] out unsigned long count,
[retval, array, size_is(count)] out wstring hostnames);
/**
* Generate results for a userfield autocomplete menu.
*
* NOTE: This interface is provided for use only by the FormFillController,
* which calls it directly. This isn't really ideal, it should
* probably be callback registered through the FFC.
*/
void autoCompleteSearchAsync(in AString aSearchString,
in nsIAutoCompleteResult aPreviousResult,
in nsIDOMHTMLInputElement aElement,
in nsIFormAutoCompleteObserver aListener);
/**
* Check to see if saving logins has been disabled for a host.
*
* @param aHost
* The hostname to check. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
*/
boolean getLoginSavingEnabled(in AString aHost);
/**
* Fill a form with login information if we have it. This method will fill
* aForm regardless of the signon.autofillForms preference.
*
* @param aForm
* The form to fill
* @return Promise that is resolved with whether or not the form was filled.
*/
jsval fillForm(in nsIDOMHTMLFormElement aForm);
/**
* Search for logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |searchLogins({}, matchData)|
* @param matchData
* The data used to search. This does not follow the same
* requirements as findLogins for those fields. Wildcard matches are
* simply not specified.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.searchLogins({}, matchData);
* (|logins| is an array).
*/
void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Disable (or enable) storing logins for the specified host. When
* disabled, the login manager will not prompt to store logins for
* that host. Existing logins are not affected.
*
* @param aHost
* The hostname to set. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
* @param isEnabled
* Specify if saving logins should be enabled (true) or
* disabled (false)
*/
void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
/**
* True when a master password prompt is being displayed.
*/
readonly attribute boolean uiBusy;
/**
* True when the master password has already been entered, and so a caller
* can ask for decrypted logins without triggering a prompt.
*/
readonly attribute boolean isLoggedIn;
/**
* Search for logins matching the specified criteria. Called when looking
* for logins that might be applicable to a form or authentication request.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |findLogins({}, hostname, ...)|
* @param aHostname
* The hostname to restrict searches to, in URL format. For
* example: "http://www.site.com".
* To find logins for a given nsIURI, you would typically pass in
* its prePath.
* @param aActionURL
* For form logins, this argument should be the URL to which the
* form will be submitted. For protocol logins, specify null.
* An empty string ("") will match any value (except null).
* @param aHttpRealm
* For protocol logins, this argument should be the HTTP Realm
* for which the login applies. This is obtained from the
* WWW-Authenticate header. See RFC2617. For form logins,
* specify null.
* An empty string ("") will match any value (except null).
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.findLogins({}, hostname, ...);
*
*/
void findLogins(out unsigned long count, in AString aHostname,
in AString aActionURL, in AString aHttpRealm,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Search for logins matching the specified criteria, as with
* findLogins(). This interface only returns the number of matching
* logins (and not the logins themselves), which allows a caller to
* check for logins without causing the user to be prompted for a master
* password to decrypt the logins.
*
* @param aHostname
* The hostname to restrict searches to. Specify an empty string
* to match all hosts. A null value will not match any logins, and
* will thus always return a count of 0.
* @param aActionURL
* The URL to which a form login will be submitted. To match any
* form login, specify an empty string. To not match any form
* login, specify null.
* @param aHttpRealm
* The HTTP Realm for which the login applies. To match logins for
* any realm, specify an empty string. To not match logins for any
* realm, specify null.
*/
unsigned long countLogins(in AString aHostname, in AString aActionURL,
in AString aHttpRealm);
/**
* Generate results for a userfield autocomplete menu.
*
* NOTE: This interface is provided for use only by the FormFillController,
* which calls it directly. This isn't really ideal, it should
* probably be callback registered through the FFC.
*/
void autoCompleteSearchAsync(in AString aSearchString,
in nsIAutoCompleteResult aPreviousResult,
in nsIDOMHTMLInputElement aElement,
in nsIFormAutoCompleteObserver aListener);
/**
* Fill a form with login information if we have it. This method will fill
* aForm regardless of the signon.autofillForms preference.
*
* @param aForm
* The form to fill
* @return Promise that is resolved with whether or not the form was filled.
*/
jsval fillForm(in nsIDOMHTMLFormElement aForm);
/**
* Search for logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |searchLogins({}, matchData)|
* @param matchData
* The data used to search. This does not follow the same
* requirements as findLogins for those fields. Wildcard matches are
* simply not specified.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.searchLogins({}, matchData);
* (|logins| is an array).
*/
void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* True when a master password prompt is being displayed.
*/
readonly attribute boolean uiBusy;
/**
* True when the master password has already been entered, and so a caller
* can ask for decrypted logins without triggering a prompt.
*/
readonly attribute boolean isLoggedIn;
};
%{C++

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

@ -9,59 +9,59 @@
interface nsILoginManagerCrypto : nsISupports {
const unsigned long ENCTYPE_BASE64 = 0; // obsolete
const unsigned long ENCTYPE_SDR = 1;
const unsigned long ENCTYPE_BASE64 = 0; // obsolete
const unsigned long ENCTYPE_SDR = 1;
/**
* encrypt
*
* @param plainText
* The string to be encrypted.
*
* Encrypts the specified string, returning the ciphertext value.
*
* NOTE: The current implemention of this inferface simply uses NSS/PSM's
* "Secret Decoder Ring" service. It is not recommended for general
* purpose encryption/decryption.
*
* Can throw if the user cancels entry of their master password.
*/
AString encrypt(in AString plainText);
/**
* encrypt
*
* @param plainText
* The string to be encrypted.
*
* Encrypts the specified string, returning the ciphertext value.
*
* NOTE: The current implemention of this inferface simply uses NSS/PSM's
* "Secret Decoder Ring" service. It is not recommended for general
* purpose encryption/decryption.
*
* Can throw if the user cancels entry of their master password.
*/
AString encrypt(in AString plainText);
/**
* decrypt
*
* @param cipherText
* The string to be decrypted.
*
* Decrypts the specified string, returning the plaintext value.
*
* Can throw if the user cancels entry of their master password, or if the
* cipherText value can not be successfully decrypted (eg, if it was
* encrypted with some other key).
*/
AString decrypt(in AString cipherText);
/**
* decrypt
*
* @param cipherText
* The string to be decrypted.
*
* Decrypts the specified string, returning the plaintext value.
*
* Can throw if the user cancels entry of their master password, or if the
* cipherText value can not be successfully decrypted (eg, if it was
* encrypted with some other key).
*/
AString decrypt(in AString cipherText);
/**
* uiBusy
*
* True when a master password prompt is being displayed.
*/
readonly attribute boolean uiBusy;
/**
* uiBusy
*
* True when a master password prompt is being displayed.
*/
readonly attribute boolean uiBusy;
/**
* isLoggedIn
*
* Current login state of the token used for encryption. If the user is
* not logged in, performing a crypto operation will result in a master
* password prompt.
*/
readonly attribute boolean isLoggedIn;
/**
* isLoggedIn
*
* Current login state of the token used for encryption. If the user is
* not logged in, performing a crypto operation will result in a master
* password prompt.
*/
readonly attribute boolean isLoggedIn;
/**
* defaultEncType
*
* Default encryption type used by an implementation of this interface.
*/
readonly attribute unsigned long defaultEncType;
/**
* defaultEncType
*
* Default encryption type used by an implementation of this interface.
*/
readonly attribute unsigned long defaultEncType;
};

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

@ -11,69 +11,69 @@ interface nsIDOMWindow;
[scriptable, uuid(425f73b9-b2db-4e8a-88c5-9ac2512934ce)]
interface nsILoginManagerPrompter : nsISupports {
/**
* Initialize the prompter. Must be called before using other interfaces.
*
* @param aWindow
* The in which the user is doing some login-related action that's
* resulting in a need to prompt them for something. The prompt
* will be associated with this window (or, if a notification bar
* is being used, topmost opener in some cases).
*/
void init(in nsIDOMWindow aWindow);
/**
* Initialize the prompter. Must be called before using other interfaces.
*
* @param aWindow
* The in which the user is doing some login-related action that's
* resulting in a need to prompt them for something. The prompt
* will be associated with this window (or, if a notification bar
* is being used, topmost opener in some cases).
*/
void init(in nsIDOMWindow aWindow);
/**
* If the caller knows which browser this prompter is being created for,
* they can call this function to avoid having to calculate it from the
* window passed to init.
*
* @param aBrowser the <browser> to use for this prompter.
* @param aOpener the opener to use for this prompter.
*/
void setE10sData(in nsIDOMElement aBrowser, in nsIDOMWindow aOpener);
/**
* If the caller knows which browser this prompter is being created for,
* they can call this function to avoid having to calculate it from the
* window passed to init.
*
* @param aBrowser the <browser> to use for this prompter.
* @param aOpener the opener to use for this prompter.
*/
void setE10sData(in nsIDOMElement aBrowser, in nsIDOMWindow aOpener);
/**
* Ask the user if they want to save a login (Yes, Never, Not Now)
*
* @param aLogin
* The login to be saved.
*/
void promptToSavePassword(in nsILoginInfo aLogin);
/**
* Ask the user if they want to save a login (Yes, Never, Not Now)
*
* @param aLogin
* The login to be saved.
*/
void promptToSavePassword(in nsILoginInfo aLogin);
/**
* Ask the user if they want to change a login's password. If the
* user consents, modifyLogin() will be called.
*
* @param aOldLogin
* The existing login (with the old password).
* @param aNewLogin
* The new login.
*/
void promptToChangePassword(in nsILoginInfo aOldLogin,
in nsILoginInfo aNewLogin);
/**
* Ask the user if they want to change a login's password. If the
* user consents, modifyLogin() will be called.
*
* @param aOldLogin
* The existing login (with the old password).
* @param aNewLogin
* The new login.
*/
void promptToChangePassword(in nsILoginInfo aOldLogin,
in nsILoginInfo aNewLogin);
/**
* Ask the user if they want to change the password for one of
* multiple logins, when the caller can't determine exactly which
* login should be changed. If the user consents, modifyLogin() will
* be called.
*
* @param logins
* An array of existing logins.
* @param count
* (length of the array)
* @param aNewLogin
* The new login.
*
* Note: Because the caller does not know the username of the login
* to be changed, aNewLogin.username and aNewLogin.usernameField
* will be set (using the user's selection) before modifyLogin()
* is called.
*/
void promptToChangePasswordWithUsernames(
[array, size_is(count)] in nsILoginInfo logins,
in uint32_t count,
in nsILoginInfo aNewLogin);
/**
* Ask the user if they want to change the password for one of
* multiple logins, when the caller can't determine exactly which
* login should be changed. If the user consents, modifyLogin() will
* be called.
*
* @param logins
* An array of existing logins.
* @param count
* (length of the array)
* @param aNewLogin
* The new login.
*
* Note: Because the caller does not know the username of the login
* to be changed, aNewLogin.username and aNewLogin.usernameField
* will be set (using the user's selection) before modifyLogin()
* is called.
*/
void promptToChangePasswordWithUsernames(
[array, size_is(count)] in nsILoginInfo logins,
in uint32_t count,
in nsILoginInfo aNewLogin);
};
%{C++

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

@ -19,234 +19,234 @@ interface nsIPropertyBag;
* directly.
*/
interface nsILoginManagerStorage : nsISupports {
/**
* Initialize the component.
*
* At present, other methods of this interface may be called before the
* returned promise is resolved or rejected.
*
* @return {Promise}
* @resolves When initialization is complete.
* @rejects JavaScript exception.
*/
jsval initialize();
/**
* Initialize the component.
*
* At present, other methods of this interface may be called before the
* returned promise is resolved or rejected.
*
* @return {Promise}
* @resolves When initialization is complete.
* @rejects JavaScript exception.
*/
jsval initialize();
/**
* Ensures that all data has been written to disk and all files are closed.
*
* At present, this method is called by regression tests only. Finalization
* on shutdown is done by observers within the component.
*
* @return {Promise}
* @resolves When finalization is complete.
* @rejects JavaScript exception.
*/
jsval terminate();
/**
* Ensures that all data has been written to disk and all files are closed.
*
* At present, this method is called by regression tests only. Finalization
* on shutdown is done by observers within the component.
*
* @return {Promise}
* @resolves When finalization is complete.
* @rejects JavaScript exception.
*/
jsval terminate();
/**
* Store a new login in the storage module.
*
* @param aLogin
* The login to be added.
*
* Default values for the login's nsILoginMetaInfo properties will be
* created. However, if the caller specifies non-default values, they will
* be used instead.
*/
void addLogin(in nsILoginInfo aLogin);
/**
* Store a new login in the storage module.
*
* @param aLogin
* The login to be added.
*
* Default values for the login's nsILoginMetaInfo properties will be
* created. However, if the caller specifies non-default values, they will
* be used instead.
*/
void addLogin(in nsILoginInfo aLogin);
/**
* Remove a login from the storage module.
*
* @param aLogin
* The login to be removed.
*
* The specified login must exactly match a stored login. However, the
* values of any nsILoginMetaInfo properties are ignored.
*/
void removeLogin(in nsILoginInfo aLogin);
/**
* Remove a login from the storage module.
*
* @param aLogin
* The login to be removed.
*
* The specified login must exactly match a stored login. However, the
* values of any nsILoginMetaInfo properties are ignored.
*/
void removeLogin(in nsILoginInfo aLogin);
/**
* Modify an existing login in the storage module.
*
* @param oldLogin
* The login to be modified.
* @param newLoginData
* The new login values (either a nsILoginInfo or nsIProperyBag)
*
* If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
* properties are changed to the values from newLoginData (but the old
* login's nsILoginMetaInfo properties are unmodified).
*
* If newLoginData is a nsIPropertyBag, only the specified properties
* will be changed. The nsILoginMetaInfo properties of oldLogin can be
* changed in this manner.
*
* If the propertybag contains an item named "timesUsedIncrement", the
* login's timesUsed property will be incremented by the item's value.
*/
void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
/**
* Modify an existing login in the storage module.
*
* @param oldLogin
* The login to be modified.
* @param newLoginData
* The new login values (either a nsILoginInfo or nsIProperyBag)
*
* If newLoginData is a nsILoginInfo, all of the old login's nsILoginInfo
* properties are changed to the values from newLoginData (but the old
* login's nsILoginMetaInfo properties are unmodified).
*
* If newLoginData is a nsIPropertyBag, only the specified properties
* will be changed. The nsILoginMetaInfo properties of oldLogin can be
* changed in this manner.
*
* If the propertybag contains an item named "timesUsedIncrement", the
* login's timesUsed property will be incremented by the item's value.
*/
void modifyLogin(in nsILoginInfo oldLogin, in nsISupports newLoginData);
/**
* Remove all stored logins.
*
* The browser sanitization feature allows the user to clear any stored
* passwords. This interface allows that to be done without getting each
* login first (which might require knowing the master password).
*
*/
void removeAllLogins();
/**
* Remove all stored logins.
*
* The browser sanitization feature allows the user to clear any stored
* passwords. This interface allows that to be done without getting each
* login first (which might require knowing the master password).
*
*/
void removeAllLogins();
/**
* Fetch all logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllLogins();
* (|logins| is an array).
*/
void getAllLogins([optional] out unsigned long count,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Search for logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |searchLogins({}, matchData)|
* @param matchData
* The data used to search. This does not follow the same
* requirements as findLogins for those fields. Wildcard matches are
* simply not specified.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.searchLogins({}, matchData);
* (|logins| is an array).
*/
void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Obtain a list of all hosts for which password saving is disabled.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param hostnames
* An array of hostname strings, in origin URL format without a
* pathname. For example: "https://www.site.com".
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllDisabledHosts();
*/
void getAllDisabledHosts([optional] out unsigned long count,
[retval, array, size_is(count)] out wstring hostnames);
/**
* Check to see if saving logins has been disabled for a host.
*
* @param aHost
* The hostname to check. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
*/
boolean getLoginSavingEnabled(in AString aHost);
/**
* Disable (or enable) storing logins for the specified host. When
* disabled, the login manager will not prompt to store logins for
* that host. Existing logins are not affected.
*
* @param aHost
* The hostname to set. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
* @param isEnabled
* Specify if saving logins should be enabled (true) or
* disabled (false)
*/
void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
/**
* Search for logins matching the specified criteria. Called when looking
* for logins that might be applicable to a form or authentication request.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |findLogins({}, hostname, ...)|
* @param aHostname
* The hostname to restrict searches to, in URL format. For
* example: "http://www.site.com".
* @param aActionURL
* For form logins, this argument should be the URL to which the
* form will be submitted. For protocol logins, specify null.
* @param aHttpRealm
* For protocol logins, this argument should be the HTTP Realm
* for which the login applies. This is obtained from the
* WWW-Authenticate header. See RFC2617. For form logins,
* specify null.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.findLogins({}, hostname, ...);
*
*/
void findLogins(out unsigned long count, in AString aHostname,
in AString aActionURL, in AString aHttpRealm,
/**
* Fetch all logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllLogins();
* (|logins| is an array).
*/
void getAllLogins([optional] out unsigned long count,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Search for logins matching the specified criteria, as with
* findLogins(). This interface only returns the number of matching
* logins (and not the logins themselves), which allows a caller to
* check for logins without causing the user to be prompted for a master
* password to decrypt the logins.
*
* @param aHostname
* The hostname to restrict searches to. Specify an empty string
* to match all hosts. A null value will not match any logins, and
* will thus always return a count of 0.
* @param aActionURL
* The URL to which a form login will be submitted. To match any
* form login, specify an empty string. To not match any form
* login, specify null.
* @param aHttpRealm
* The HTTP Realm for which the login applies. To match logins for
* any realm, specify an empty string. To not match logins for any
* realm, specify null.
*/
unsigned long countLogins(in AString aHostname, in AString aActionURL,
in AString aHttpRealm);
/**
* True when a master password prompt is being shown.
*/
readonly attribute boolean uiBusy;
/**
* Search for logins in the login manager. An array is always returned;
* if there are no logins the array is empty.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |searchLogins({}, matchData)|
* @param matchData
* The data used to search. This does not follow the same
* requirements as findLogins for those fields. Wildcard matches are
* simply not specified.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.searchLogins({}, matchData);
* (|logins| is an array).
*/
void searchLogins(out unsigned long count, in nsIPropertyBag matchData,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* True when the master password has already been entered, and so a caller
* can ask for decrypted logins without triggering a prompt.
*/
readonly attribute boolean isLoggedIn;
/**
* Obtain a list of all hosts for which password saving is disabled.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property and omit this param.
* @param hostnames
* An array of hostname strings, in origin URL format without a
* pathname. For example: "https://www.site.com".
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.getAllDisabledHosts();
*/
void getAllDisabledHosts([optional] out unsigned long count,
[retval, array, size_is(count)] out wstring hostnames);
/**
* Check to see if saving logins has been disabled for a host.
*
* @param aHost
* The hostname to check. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
*/
boolean getLoginSavingEnabled(in AString aHost);
/**
* Disable (or enable) storing logins for the specified host. When
* disabled, the login manager will not prompt to store logins for
* that host. Existing logins are not affected.
*
* @param aHost
* The hostname to set. This argument should be in the origin
* URL format, without a pathname. For example: "http://foo.com".
* @param isEnabled
* Specify if saving logins should be enabled (true) or
* disabled (false)
*/
void setLoginSavingEnabled(in AString aHost, in boolean isEnabled);
/**
* Search for logins matching the specified criteria. Called when looking
* for logins that might be applicable to a form or authentication request.
*
* @param count
* The number of elements in the array. JS callers can simply use
* the array's .length property, and supply an dummy object for
* this out param. For example: |findLogins({}, hostname, ...)|
* @param aHostname
* The hostname to restrict searches to, in URL format. For
* example: "http://www.site.com".
* @param aActionURL
* For form logins, this argument should be the URL to which the
* form will be submitted. For protocol logins, specify null.
* @param aHttpRealm
* For protocol logins, this argument should be the HTTP Realm
* for which the login applies. This is obtained from the
* WWW-Authenticate header. See RFC2617. For form logins,
* specify null.
* @param logins
* An array of nsILoginInfo objects.
*
* NOTE: This can be called from JS as:
* var logins = pwmgr.findLogins({}, hostname, ...);
*
*/
void findLogins(out unsigned long count, in AString aHostname,
in AString aActionURL, in AString aHttpRealm,
[retval, array, size_is(count)] out nsILoginInfo logins);
/**
* Search for logins matching the specified criteria, as with
* findLogins(). This interface only returns the number of matching
* logins (and not the logins themselves), which allows a caller to
* check for logins without causing the user to be prompted for a master
* password to decrypt the logins.
*
* @param aHostname
* The hostname to restrict searches to. Specify an empty string
* to match all hosts. A null value will not match any logins, and
* will thus always return a count of 0.
* @param aActionURL
* The URL to which a form login will be submitted. To match any
* form login, specify an empty string. To not match any form
* login, specify null.
* @param aHttpRealm
* The HTTP Realm for which the login applies. To match logins for
* any realm, specify an empty string. To not match logins for any
* realm, specify null.
*/
unsigned long countLogins(in AString aHostname, in AString aActionURL,
in AString aHttpRealm);
/**
* True when a master password prompt is being shown.
*/
readonly attribute boolean uiBusy;
/**
* True when the master password has already been entered, and so a caller
* can ask for decrypted logins without triggering a prompt.
*/
readonly attribute boolean isLoggedIn;
};

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

@ -17,37 +17,37 @@
* comparing logins, these properties are ignored.
*/
interface nsILoginMetaInfo : nsISupports {
/**
* The GUID to uniquely identify the login. This can be any arbitrary
* string, but a format as created by nsIUUIDGenerator is recommended.
* For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}"
*
* addLogin will generate a random value unless a value is provided.
*
* addLogin and modifyLogin will throw if the GUID already exists.
*/
attribute AString guid;
/**
* The GUID to uniquely identify the login. This can be any arbitrary
* string, but a format as created by nsIUUIDGenerator is recommended.
* For example, "{d4e1a1f6-5ea0-40ee-bff5-da57982f21cf}"
*
* addLogin will generate a random value unless a value is provided.
*
* addLogin and modifyLogin will throw if the GUID already exists.
*/
attribute AString guid;
/**
* The time, in Unix Epoch milliseconds, when the login was first created.
*/
attribute unsigned long long timeCreated;
/**
* The time, in Unix Epoch milliseconds, when the login was first created.
*/
attribute unsigned long long timeCreated;
/**
* The time, in Unix Epoch milliseconds, when the login was last submitted
* in a form or used to begin an HTTP auth session.
*/
attribute unsigned long long timeLastUsed;
/**
* The time, in Unix Epoch milliseconds, when the login was last submitted
* in a form or used to begin an HTTP auth session.
*/
attribute unsigned long long timeLastUsed;
/**
* The time, in Unix Epoch milliseconds, when the login's password was
* last modified.
*/
attribute unsigned long long timePasswordChanged;
/**
* The time, in Unix Epoch milliseconds, when the login's password was
* last modified.
*/
attribute unsigned long long timePasswordChanged;
/**
* The number of times the login was submitted in a form or used to begin
* an HTTP auth session.
*/
attribute unsigned long timesUsed;
/**
* The number of times the login was submitted in a form or used to begin
* an HTTP auth session.
*/
attribute unsigned long timesUsed;
};

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

@ -12,92 +12,92 @@ function nsLoginInfo() {}
nsLoginInfo.prototype = {
classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
//
// nsILoginInfo interfaces...
//
//
// nsILoginInfo interfaces...
//
hostname : null,
formSubmitURL : null,
httpRealm : null,
username : null,
password : null,
usernameField : null,
passwordField : null,
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;
},
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 : function (aLogin, ignorePassword) {
if (this.hostname != aLogin.hostname ||
this.httpRealm != aLogin.httpRealm ||
this.username != aLogin.username)
return false;
matches : function (aLogin, ignorePassword) {
if (this.hostname != aLogin.hostname ||
this.httpRealm != aLogin.httpRealm ||
this.username != aLogin.username)
return false;
if (!ignorePassword && this.password != aLogin.password)
return false;
if (!ignorePassword && this.password != aLogin.password)
return false;
// If either formSubmitURL is blank (but not null), then match.
if (this.formSubmitURL != "" && aLogin.formSubmitURL != "" &&
this.formSubmitURL != aLogin.formSubmitURL)
return false;
// If either formSubmitURL is blank (but not null), then match.
if (this.formSubmitURL != "" && aLogin.formSubmitURL != "" &&
this.formSubmitURL != aLogin.formSubmitURL)
return false;
// The .usernameField and .passwordField values are ignored.
// The .usernameField and .passwordField values are ignored.
return true;
},
return true;
},
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;
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;
},
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);
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;
// 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;
},
return clone;
},
//
// nsILoginMetaInfo interfaces...
//
//
// nsILoginMetaInfo interfaces...
//
guid : null,
timeCreated : null,
timeLastUsed : null,
timePasswordChanged : null,
timesUsed : null
guid : null,
timeCreated : null,
timeLastUsed : null,
timePasswordChanged : null,
timesUsed : null
}; // end of nsLoginInfo implementation

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу