mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 407567 - Can't add login with empty formSubmitURL and null httpRealm. r=gavin, a1.9=damons
This commit is contained in:
parent
93d80e8ee1
commit
0c16b2e102
@ -363,8 +363,19 @@ LoginManager.prototype = {
|
||||
if (login.password == null || login.password.length == 0)
|
||||
throw "Can't add a login with a null or empty password.";
|
||||
|
||||
if (!login.httpRealm && !login.formSubmitURL)
|
||||
if (login.formSubmitURL || login.formSubmitURL == "") {
|
||||
// We have a form submit URL. Can't have a HTTP realm.
|
||||
if (login.httpRealm != null)
|
||||
throw "Can't add a login with both a httpRealm and formSubmitURL.";
|
||||
} else if (login.httpRealm) {
|
||||
// We have a HTTP realm. Can't have a form submit URL.
|
||||
if (login.formSubmitURL != null)
|
||||
throw "Can't add a login with both a httpRealm and formSubmitURL.";
|
||||
} else {
|
||||
// Need one or the other!
|
||||
throw "Can't add a login without a httpRealm or formSubmitURL.";
|
||||
}
|
||||
|
||||
|
||||
// Look for an existing entry.
|
||||
var logins = this.findLogins({}, login.hostname, login.formSubmitURL,
|
||||
|
@ -81,15 +81,15 @@ const LoginTest = {
|
||||
checkExpectedError : function (aExpectedError, aActualError) {
|
||||
if (aExpectedError) {
|
||||
if (!aActualError)
|
||||
throw "Storage didn't throw as expected (" + aExpectedError + ")";
|
||||
throw "Test didn't throw as expected (" + aExpectedError + ")";
|
||||
|
||||
if (!aExpectedError.test(aActualError))
|
||||
throw "Storage threw (" + aActualError + "), not (" + aExpectedError;
|
||||
throw "Test threw (" + aActualError + "), not (" + aExpectedError;
|
||||
|
||||
// We got the expected error, so make a note in the test log.
|
||||
dump("...that error was expected.\n\n");
|
||||
} else if (aActualError) {
|
||||
throw "Component threw unexpected error: " + aActualError;
|
||||
throw "Test threw unexpected error: " + aActualError;
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user