Bug 1824112 - switch to `addLoginAsync` r=credential-management-reviewers,sgalich,sync-reviewers,markh

Differential Revision: https://phabricator.services.mozilla.com/D175666
This commit is contained in:
Johannes J. Schmidt 2023-05-08 06:51:46 +00:00
Родитель 98c90cbf40
Коммит 53bb7cd608
4 изменённых файлов: 6 добавлений и 3 удалений

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

@ -562,7 +562,7 @@ LoginManagerStorage.prototype = {
if (existingLogins.length) {
Services.logins.modifyLogin(existingLogins[0], login);
} else {
Services.logins.addLogin(login);
await Services.logins.addLoginAsync(login);
}
log.trace("finished write of user data to the login manager");
} catch (ex) {

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

@ -346,7 +346,7 @@ PasswordStore.prototype = {
"formSubmitURL: " +
JSON.stringify(login.formActionOrigin)
);
Services.logins.addLogin(login);
await Services.logins.addLoginAsync(login);
},
async remove(record) {

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

@ -99,6 +99,7 @@ Password.prototype = {
this.props.usernameField,
this.props.passwordField
);
// TODO: use `addLoginAsync` instead, see https://bugzilla.mozilla.org/show_bug.cgi?id=1829396
Services.logins.addLogin(login);
login.QueryInterface(Ci.nsILoginMetaInfo);
return login.guid;

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

@ -1414,7 +1414,9 @@ export class LoginManagerParent extends JSWindowActorParent {
existingLogin.password = formLogin.password;
} else if (!autoSavedLogin) {
lazy.log("Auto-saving new login with empty username.");
existingLogin = Services.logins.addLogin(formLoginWithoutUsername);
existingLogin = await Services.logins.addLoginAsync(
formLoginWithoutUsername
);
// Remember the GUID where we saved the generated password so we can update
// the login if the user later edits the generated password.
generatedPW.storageGUID = existingLogin.guid;