function promiseInsertLoginInfo(aConnection, aLoginInfo)
{
  aLoginInfo.QueryInterface(Ci.nsILoginMetaInfo);

  // We can't use the aLoginInfo object directly in the execute statement
  // because the bind code in Sqlite.jsm doesn't allow objects with extra
  // properties beyond those being binded. So we might as well use an array as
  // it is simpler.
  let values = [
    aLoginInfo.hostname,
    aLoginInfo.httpRealm,
    aLoginInfo.formSubmitURL,
    aLoginInfo.usernameField,
    aLoginInfo.passwordField,
    gLoginManagerCrypto.encrypt(aLoginInfo.username),
    gLoginManagerCrypto.encrypt(aLoginInfo.password),
    aLoginInfo.guid,
    aLoginInfo.encType,
    aLoginInfo.timeCreated,
    aLoginInfo.timeLastUsed,
    aLoginInfo.timePasswordChanged,
    aLoginInfo.timesUsed,
  ];

  return aConnection.execute("INSERT INTO moz_logins (hostname, " +
                             "httpRealm, formSubmitURL, usernameField, " +
                             "passwordField, encryptedUsername, " +
                             "encryptedPassword, guid, encType, timeCreated, " +
                             "timeLastUsed, timePasswordChanged, timesUsed) " +
                             "VALUES (?" + ",?".repeat(12) + ")", values);
}
/**
 * Inserts a new entry in the database resembling the given nsILoginInfo object.
 */
Inserts a new entry in the database resembling the given nsILoginInfo object.
Inserts a new entry in the database resembling the given nsILoginInfo object .
function promiseInsertLoginInfo(aConnection, aLoginInfo)
{
  aLoginInfo.QueryInterface(Ci.nsILoginMetaInfo);
  let values = [
    aLoginInfo.hostname,
    aLoginInfo.httpRealm,
    aLoginInfo.formSubmitURL,
    aLoginInfo.usernameField,
    aLoginInfo.passwordField,
    gLoginManagerCrypto.encrypt(aLoginInfo.username),
    gLoginManagerCrypto.encrypt(aLoginInfo.password),
    aLoginInfo.guid,
    aLoginInfo.encType,
    aLoginInfo.timeCreated,
    aLoginInfo.timeLastUsed,
    aLoginInfo.timePasswordChanged,
    aLoginInfo.timesUsed,
  ];
  return aConnection.execute("INSERT INTO moz_logins (hostname, " +
                             "httpRealm, formSubmitURL, usernameField, " +
                             "passwordField, encryptedUsername, " +
                             "encryptedPassword, guid, encType, timeCreated, " +
                             "timeLastUsed, timePasswordChanged, timesUsed) " +
                             "VALUES (?" + ",?".repeat(12) + ")", values);
}
function promiseInsertLoginInfo ( aConnection , aLoginInfo ) { aLoginInfo . QueryInterface ( Ci . nsILoginMetaInfo ) ; let values = [ aLoginInfo . hostname , aLoginInfo . httpRealm , aLoginInfo . formSubmitURL , aLoginInfo . usernameField , aLoginInfo . passwordField , gLoginManagerCrypto . encrypt ( aLoginInfo . username ) , gLoginManagerCrypto . encrypt ( aLoginInfo . password ) , aLoginInfo . guid , aLoginInfo . encType , aLoginInfo . timeCreated , aLoginInfo . timeLastUsed , aLoginInfo . timePasswordChanged , aLoginInfo . timesUsed , ] ; return aConnection . execute ( "INSERT INTO moz_logins (hostname, " + "httpRealm, formSubmitURL, usernameField, " + "passwordField, encryptedUsername, " + "encryptedPassword, guid, encType, timeCreated, " + "timeLastUsed, timePasswordChanged, timesUsed) " + "VALUES (?" + ",?" . repeat ( 12 ) + ")" , values ) ; }
Inserts a new entry in the database resembling the given nsILoginInfo object.
Inserts a new entry in the database resembling the given nsILoginInfo object .
// We can't use the aLoginInfo object directly in the execute statement // because the bind code in Sqlite.jsm doesn't allow objects with extra // properties beyond those being binded. So we might as well use an array as // it is simpler.