function checkLoginInvalid(aLoginInfo, aExpectedError)
{
  // Try to add the new login, and verify that no data is stored.
  Assert.throws(() => Services.logins.addLogin(aLoginInfo), aExpectedError);
  LoginTest.checkLogins([]);

  // Add a login for the modification tests.
  let testLogin = TestData.formLogin({ hostname: "http://modify.example.com" });
  Services.logins.addLogin(testLogin);

  // Try to modify the existing login using nsILoginInfo and nsIPropertyBag.
  Assert.throws(() => Services.logins.modifyLogin(testLogin, aLoginInfo),
                aExpectedError);
  Assert.throws(() => Services.logins.modifyLogin(testLogin, newPropertyBag({
    hostname: aLoginInfo.hostname,
    formSubmitURL: aLoginInfo.formSubmitURL,
    httpRealm: aLoginInfo.httpRealm,
    username: aLoginInfo.username,
    password: aLoginInfo.password,
    usernameField: aLoginInfo.usernameField,
    passwordField: aLoginInfo.passwordField,
  })), aExpectedError);

  // Verify that no data was stored by the previous calls.
  LoginTest.checkLogins([testLogin]);
  Services.logins.removeLogin(testLogin);
}
/**
 * Verifies that the specified login is considered invalid by addLogin and by
 * modifyLogin with both nsILoginInfo and nsIPropertyBag arguments.
 *
 * This test requires that the login store is empty.
 *
 * @param aLoginInfo
 *        nsILoginInfo corresponding to an invalid login.
 * @param aExpectedError
 *        This argument is passed to the "Assert.throws" test to determine which
 *        error is expected from the modification functions.
 */
Verifies that the specified login is considered invalid by addLogin and by
modifyLogin with both nsILoginInfo and nsIPropertyBag arguments.

This test requires that the login store is empty.

@param aLoginInfo
nsILoginInfo corresponding to an invalid login.
@param aExpectedError
This argument is passed to the "Assert.throws" test to determine which
error is expected from the modification functions.
Verifies that the specified login is considered invalid by addLogin and by modifyLogin with both nsILoginInfo and nsIPropertyBag arguments . This test requires that the login store is empty . @param aLoginInfo nsILoginInfo corresponding to an invalid login . @param aExpectedError This argument is passed to the " Assert . throws " test to determine which error is expected from the modification functions .
function checkLoginInvalid(aLoginInfo, aExpectedError)
{
  Assert.throws(() => Services.logins.addLogin(aLoginInfo), aExpectedError);
  LoginTest.checkLogins([]);
  let testLogin = TestData.formLogin({ hostname: "http://modify.example.com" });
  Services.logins.addLogin(testLogin);
  Assert.throws(() => Services.logins.modifyLogin(testLogin, aLoginInfo),
                aExpectedError);
  Assert.throws(() => Services.logins.modifyLogin(testLogin, newPropertyBag({
    hostname: aLoginInfo.hostname,
    formSubmitURL: aLoginInfo.formSubmitURL,
    httpRealm: aLoginInfo.httpRealm,
    username: aLoginInfo.username,
    password: aLoginInfo.password,
    usernameField: aLoginInfo.usernameField,
    passwordField: aLoginInfo.passwordField,
  })), aExpectedError);
  LoginTest.checkLogins([testLogin]);
  Services.logins.removeLogin(testLogin);
}
function checkLoginInvalid ( aLoginInfo , aExpectedError ) { Assert . throws ( ( ) => Services . logins . addLogin ( aLoginInfo ) , aExpectedError ) ; LoginTest . checkLogins ( [ ] ) ; let testLogin = TestData . formLogin ( { hostname : "http://modify.example.com" } ) ; Services . logins . addLogin ( testLogin ) ; Assert . throws ( ( ) => Services . logins . modifyLogin ( testLogin , aLoginInfo ) , aExpectedError ) ; Assert . throws ( ( ) => Services . logins . modifyLogin ( testLogin , newPropertyBag ( { hostname : aLoginInfo . hostname , formSubmitURL : aLoginInfo . formSubmitURL , httpRealm : aLoginInfo . httpRealm , username : aLoginInfo . username , password : aLoginInfo . password , usernameField : aLoginInfo . usernameField , passwordField : aLoginInfo . passwordField , } ) ) , aExpectedError ) ; LoginTest . checkLogins ( [ testLogin ] ) ; Services . logins . removeLogin ( testLogin ) ; }
Verifies that the specified login is considered invalid by addLogin and by
 modifyLogin with both nsILoginInfo and nsIPropertyBag arguments.
Verifies that the specified login is considered invalid by addLogin and by modifyLogin with both nsILoginInfo and nsIPropertyBag arguments .
// Try to add the new login, and verify that no data is stored. // Add a login for the modification tests. // Try to modify the existing login using nsILoginInfo and nsIPropertyBag. // Verify that no data was stored by the previous calls.