Bug 407567 - Can't add login with empty formSubmitURL and null httpRealm. r=gavin, a1.9=damons
git-svn-id: svn://10.0.0.236/trunk@251086 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0f92ae9659
commit
819bbcd228
@ -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…
x
Reference in New Issue
Block a user