зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1807618, replace all usage of getAllLogins with the asynchronous version, removing the syncronous version, r=credential-management-reviewers,sync-reviewers,sgalich,skhamis
Differential Revision: https://phabricator.services.mozilla.com/D178406
This commit is contained in:
Родитель
2040df86f8
Коммит
4339c71887
|
@ -257,9 +257,10 @@ class TestFirefoxRefresh(MarionetteTestCase):
|
|||
self.assertEqual(loginInfo[0]["username"], self._username)
|
||||
self.assertEqual(loginInfo[0]["password"], self._password)
|
||||
|
||||
loginCount = self.marionette.execute_script(
|
||||
loginCount = self.runAsyncCode(
|
||||
"""
|
||||
return Services.logins.getAllLogins().length;
|
||||
let resolve = arguments[arguments.length - 1];
|
||||
Services.logins.getAllLogins().then(logins => resolve(logins.length));
|
||||
"""
|
||||
)
|
||||
# Note that we expect 2 logins - one from us, one from sync.
|
||||
|
|
|
@ -285,7 +285,7 @@ add_task(async function test_importIntoEmptyDB() {
|
|||
"Sanity check the source exists"
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "There are no logins initially");
|
||||
|
||||
// Migrate the logins.
|
||||
|
@ -296,7 +296,7 @@ add_task(async function test_importIntoEmptyDB() {
|
|||
true
|
||||
);
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
TEST_LOGINS.length,
|
||||
|
@ -322,7 +322,7 @@ add_task(async function test_importExistingLogins() {
|
|||
);
|
||||
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
0,
|
||||
|
@ -337,7 +337,7 @@ add_task(async function test_importExistingLogins() {
|
|||
await Services.logins.addLoginAsync(newLogins[i]);
|
||||
}
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
newLogins.length,
|
||||
|
@ -355,7 +355,7 @@ add_task(async function test_importExistingLogins() {
|
|||
true
|
||||
);
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
TEST_LOGINS.length,
|
||||
|
|
|
@ -384,7 +384,7 @@ add_task(async function test_passwordsNotAvailable() {
|
|||
MigrationUtils.resourceTypes.PASSWORDS
|
||||
);
|
||||
Assert.ok(migrator.exists, "The migrator has to exist");
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
0,
|
||||
|
@ -397,7 +397,7 @@ add_task(async function test_passwordsNotAvailable() {
|
|||
// in this test, there is no IE login data in the registry, so after the migration, the number
|
||||
// of logins in the store should be 0
|
||||
await migrator._migrateURIs(uris);
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
0,
|
||||
|
@ -414,9 +414,9 @@ add_task(async function test_passwordsAvailable() {
|
|||
let crypto = new OSCrypto();
|
||||
let hashes = []; // the hashes of all migrator websites, this is going to be used for the clean up
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
registerCleanupFunction(async () => {
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "There are no logins after the cleanup");
|
||||
// remove all the values created in this test from the registry
|
||||
removeAllValues(Storage2Key, hashes);
|
||||
|
@ -435,7 +435,7 @@ add_task(async function test_passwordsAvailable() {
|
|||
MigrationUtils.resourceTypes.PASSWORDS
|
||||
);
|
||||
Assert.ok(migrator.exists, "The migrator has to exist");
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
logins.length,
|
||||
0,
|
||||
|
@ -459,7 +459,7 @@ add_task(async function test_passwordsAvailable() {
|
|||
hashes.push(website.hash);
|
||||
|
||||
await migrator._migrateURIs(uris);
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
// check that the number of logins in the password manager has increased as expected which means
|
||||
// that all the values for the current website were imported
|
||||
loginCount += website.logins.length;
|
||||
|
|
|
@ -86,7 +86,7 @@ void LoginDetectionService::FetchLogins() {
|
|||
return;
|
||||
}
|
||||
|
||||
Unused << loginManager->GetAllLoginsWithCallbackAsync(this);
|
||||
Unused << loginManager->GetAllLoginsWithCallback(this);
|
||||
}
|
||||
|
||||
void LoginDetectionService::UnregisterObserver() {
|
||||
|
|
|
@ -129,7 +129,7 @@ PasswordEngine.prototype = {
|
|||
async _getChangedIDs(getAll) {
|
||||
let changes = {};
|
||||
|
||||
let logins = await this._store.storage.getAllLoginsAsync(true);
|
||||
let logins = await this._store.storage.getAllLogins(true);
|
||||
for (let login of logins) {
|
||||
if (getAll || login.syncCounter > 0) {
|
||||
if (Utils.getSyncCredentialsHosts().has(login.origin)) {
|
||||
|
@ -306,7 +306,7 @@ PasswordStore.prototype = {
|
|||
|
||||
async getAllIDs() {
|
||||
let items = {};
|
||||
let logins = await this.storage.getAllLoginsAsync(true);
|
||||
let logins = await this.storage.getAllLogins(true);
|
||||
|
||||
for (let i = 0; i < logins.length; i++) {
|
||||
// Skip over Weave password/passphrase entries.
|
||||
|
@ -496,8 +496,8 @@ export class PasswordValidator extends CollectionValidator {
|
|||
]);
|
||||
}
|
||||
|
||||
getClientItems() {
|
||||
let logins = Services.logins.getAllLogins();
|
||||
async getClientItems() {
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
let syncHosts = Utils.getSyncCredentialsHosts();
|
||||
let result = logins
|
||||
.map(l => l.QueryInterface(Ci.nsILoginMetaInfo))
|
||||
|
|
|
@ -373,8 +373,7 @@ add_task(async function test_sync_outgoing() {
|
|||
equal(collection.count(), 1);
|
||||
equal(Services.logins.countLogins("", "", ""), 2);
|
||||
equal(Services.logins.findLogins("", "", "").length, 2);
|
||||
equal(Services.logins.getAllLogins().length, 2);
|
||||
equal((await Services.logins.getAllLoginsAsync()).length, 2);
|
||||
equal((await Services.logins.getAllLogins()).length, 2);
|
||||
ok(await engine._store.itemExists(guid));
|
||||
|
||||
ok((await engine._store.getAllIDs())[guid]);
|
||||
|
@ -403,8 +402,7 @@ add_task(async function test_sync_outgoing() {
|
|||
// All of these should not include the deleted login. Only the FxA password should exist.
|
||||
equal(Services.logins.countLogins("", "", ""), 1);
|
||||
equal(Services.logins.findLogins("", "", "").length, 1);
|
||||
equal(Services.logins.getAllLogins().length, 1);
|
||||
equal((await Services.logins.getAllLoginsAsync()).length, 1);
|
||||
equal((await Services.logins.getAllLogins()).length, 1);
|
||||
ok(!(await engine._store.itemExists(guid)));
|
||||
|
||||
// getAllIDs includes deleted items but skips the FxA login.
|
||||
|
|
|
@ -155,7 +155,7 @@ add_task(async function test_removeAllLogins() {
|
|||
Assert.equal(tracker.score, SCORE_INCREMENT_XLARGE * 2);
|
||||
|
||||
if (syncBeforeRemove) {
|
||||
let logins = await Services.logins.getAllLoginsAsync(true);
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
for (let login of logins) {
|
||||
engine.markSynced(login.guid);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ var nsLoginInfo = new Components.Constructor(
|
|||
"init"
|
||||
);
|
||||
|
||||
export var DumpPasswords = function TPS__Passwords__DumpPasswords() {
|
||||
let logins = Services.logins.getAllLogins();
|
||||
export var DumpPasswords = async function TPS__Passwords__DumpPasswords() {
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Logger.logInfo("\ndumping password list\n", true);
|
||||
for (var i = 0; i < logins.length; i++) {
|
||||
Logger.logInfo(
|
||||
|
|
|
@ -522,7 +522,7 @@ var TPS = {
|
|||
"executing action " + action.toUpperCase() + " on passwords"
|
||||
);
|
||||
} catch (e) {
|
||||
lazy.DumpPasswords();
|
||||
await lazy.DumpPasswords();
|
||||
throw e;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -426,7 +426,7 @@ const PasswordsCleaner = {
|
|||
|
||||
async _deleteInternal(aCb) {
|
||||
try {
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
for (let login of logins) {
|
||||
if (aCb(login)) {
|
||||
Services.logins.removeLogin(login);
|
||||
|
|
|
@ -22,7 +22,7 @@ add_task(async function test_principal_downloads() {
|
|||
});
|
||||
await Services.logins.addLoginAsync(loginInfo);
|
||||
|
||||
Assert.equal(countLogins(URL), 1);
|
||||
Assert.equal(await countLogins(URL), 1);
|
||||
|
||||
let uri = Services.io.newURI(URL);
|
||||
let principal = Services.scriptSecurityManager.createContentPrincipal(
|
||||
|
@ -42,7 +42,7 @@ add_task(async function test_principal_downloads() {
|
|||
);
|
||||
});
|
||||
|
||||
Assert.equal(countLogins(URL), 0);
|
||||
Assert.equal(await countLogins(URL), 0);
|
||||
|
||||
LoginTestUtils.clearData();
|
||||
});
|
||||
|
@ -59,7 +59,7 @@ add_task(async function test_all() {
|
|||
});
|
||||
await Services.logins.addLoginAsync(loginInfo);
|
||||
|
||||
Assert.equal(countLogins(URL), 1);
|
||||
Assert.equal(await countLogins(URL), 1);
|
||||
|
||||
await new Promise(resolve => {
|
||||
Services.clearData.deleteData(
|
||||
|
@ -71,14 +71,14 @@ add_task(async function test_all() {
|
|||
);
|
||||
});
|
||||
|
||||
Assert.equal(countLogins(URL), 0);
|
||||
Assert.equal(await countLogins(URL), 0);
|
||||
|
||||
LoginTestUtils.clearData();
|
||||
});
|
||||
|
||||
function countLogins(origin) {
|
||||
async function countLogins(origin) {
|
||||
let count = 0;
|
||||
const logins = Services.logins.getAllLogins();
|
||||
const logins = await Services.logins.getAllLogins();
|
||||
for (const login of logins) {
|
||||
if (login.origin == origin) {
|
||||
++count;
|
||||
|
|
|
@ -42,7 +42,7 @@ export class LoginExport {
|
|||
*/
|
||||
static async exportAsCSV(path, logins = null) {
|
||||
if (!logins) {
|
||||
logins = await Services.logins.getAllLoginsAsync();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
}
|
||||
let columns = [
|
||||
"origin",
|
||||
|
|
|
@ -1734,7 +1734,7 @@ export const LoginHelper = {
|
|||
|
||||
async getAllUserFacingLogins() {
|
||||
try {
|
||||
let logins = await Services.logins.getAllLoginsAsync();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
return logins.filter(this.isUserFacingLogin);
|
||||
} catch (e) {
|
||||
if (e.result == Cr.NS_ERROR_ABORT) {
|
||||
|
|
|
@ -186,7 +186,7 @@ LoginManager.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let logins = await this.getAllLoginsAsync();
|
||||
let logins = await this.getAllLogins();
|
||||
|
||||
let usernamePresentHistogram = clearAndGetHistogram(
|
||||
"PWMGR_USERNAME_PRESENT"
|
||||
|
@ -387,32 +387,22 @@ LoginManager.prototype = {
|
|||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a dump of all stored logins. Used by the login manager UI.
|
||||
*
|
||||
* @return {nsILoginInfo[]} - If there are no logins, the array is empty.
|
||||
*/
|
||||
getAllLogins() {
|
||||
lazy.log.debug("Getting a list of all logins.");
|
||||
return this._storage.getAllLogins();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a dump of all stored logins asynchronously. Used by the login manager UI.
|
||||
*
|
||||
* @return {nsILoginInfo[]} - If there are no logins, the array is empty.
|
||||
*/
|
||||
async getAllLoginsAsync() {
|
||||
async getAllLogins() {
|
||||
lazy.log.debug("Getting a list of all logins asynchronously.");
|
||||
return this._storage.getAllLoginsAsync();
|
||||
return this._storage.getAllLogins();
|
||||
},
|
||||
|
||||
/**
|
||||
* Get a dump of all stored logins asynchronously. Used by the login detection service.
|
||||
*/
|
||||
getAllLoginsWithCallbackAsync(aCallback) {
|
||||
getAllLoginsWithCallback(aCallback) {
|
||||
lazy.log.debug("Searching a list of all logins asynchronously.");
|
||||
this._storage.getAllLoginsAsync().then(logins => {
|
||||
this._storage.getAllLogins().then(logins => {
|
||||
aCallback.onSearchComplete(logins);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -147,30 +147,21 @@ interface nsILoginManager : nsISupports {
|
|||
|
||||
/**
|
||||
* Fetch all logins in the login manager. An array is always returned;
|
||||
* if there are no logins the array is empty.
|
||||
*
|
||||
* @deprecated Use `getAllLoginsAsync` instead.
|
||||
*
|
||||
* @return An array of nsILoginInfo objects.
|
||||
*/
|
||||
Array<nsILoginInfo> getAllLogins();
|
||||
|
||||
/**
|
||||
* Like getAllLogins, but asynchronous. This method is faster when large
|
||||
* amounts of logins are present since it will handle decryption in one batch.
|
||||
* if there are no logins the array is empty. Decryption is handled in
|
||||
* one batch.
|
||||
*
|
||||
* @return A promise which resolves with a JS Array of nsILoginInfo objects.
|
||||
*/
|
||||
Promise getAllLoginsAsync();
|
||||
Promise getAllLogins();
|
||||
|
||||
/**
|
||||
* Like getAllLoginsAsync, but with a callback returning the search results.
|
||||
* Like getAllLogins, but with a callback returning the search results.
|
||||
*
|
||||
* @param {nsILoginSearchCallback} aCallback
|
||||
* The interface to notify when the search is complete.
|
||||
*
|
||||
*/
|
||||
void getAllLoginsWithCallbackAsync(in nsILoginSearchCallback aCallback);
|
||||
void getAllLoginsWithCallback(in nsILoginSearchCallback aCallback);
|
||||
|
||||
/**
|
||||
* Obtain a list of all origins for which password saving is disabled.
|
||||
|
|
|
@ -69,16 +69,12 @@ export class LoginManagerStorage extends LoginManagerStorage_json {
|
|||
);
|
||||
}
|
||||
|
||||
getAllLogins() {
|
||||
throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a promise resolving to an array of all saved logins that can be decrypted.
|
||||
*
|
||||
* @resolve {nsILoginInfo[]}
|
||||
*/
|
||||
getAllLoginsAsync(includeDeleted) {
|
||||
getAllLogins(includeDeleted) {
|
||||
return this._getLoginsAsync({}, includeDeleted);
|
||||
}
|
||||
|
||||
|
|
|
@ -460,21 +460,6 @@ export class LoginManagerStorage_json {
|
|||
return this._store._data.dismissedBreachAlertsByLoginGUID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {nsILoginInfo[]}
|
||||
*/
|
||||
getAllLogins() {
|
||||
this._store.ensureDataReady();
|
||||
|
||||
let [logins] = this._searchLogins({});
|
||||
|
||||
// decrypt entries for caller.
|
||||
logins = this._decryptLogins(logins);
|
||||
|
||||
this.log(`Returning ${logins.length} logins.`);
|
||||
return logins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of nsILoginInfo. If decryption of a login
|
||||
* fails due to a corrupt entry, the login is not included in
|
||||
|
@ -482,7 +467,7 @@ export class LoginManagerStorage_json {
|
|||
*
|
||||
* @resolve {nsILoginInfo[]}
|
||||
*/
|
||||
async getAllLoginsAsync(includeDeleted) {
|
||||
async getAllLogins(includeDeleted) {
|
||||
this._store.ensureDataReady();
|
||||
|
||||
let [logins] = this._searchLogins({}, includeDeleted);
|
||||
|
|
|
@ -88,9 +88,9 @@ export const LoginTestUtils = {
|
|||
* array. If no `checkFn` is provided, the comparison uses the "equals"
|
||||
* method of nsILoginInfo, that does not include nsILoginMetaInfo properties in the test.
|
||||
*/
|
||||
checkLogins(expectedLogins, msg = "checkLogins", checkFn = undefined) {
|
||||
async checkLogins(expectedLogins, msg = "checkLogins", checkFn = undefined) {
|
||||
this.assertLoginListsEqual(
|
||||
Services.logins.getAllLogins(),
|
||||
await Services.logins.getAllLogins(),
|
||||
expectedLogins,
|
||||
msg,
|
||||
checkFn
|
||||
|
|
|
@ -93,7 +93,7 @@ add_task(async function test() {
|
|||
});
|
||||
await processedPromise;
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
|
||||
Assert.equal(logins.length, 1, "There should only be one login saved");
|
||||
Assert.equal(
|
||||
|
@ -101,7 +101,7 @@ add_task(async function test() {
|
|||
login.guid,
|
||||
"The saved login should match the one added and used above"
|
||||
);
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ add_setup(async function () {
|
|||
],
|
||||
});
|
||||
// assert that there are no logins
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "There are no logins");
|
||||
});
|
||||
|
||||
|
@ -365,7 +365,7 @@ add_task(async function fill_generated_password_with_matching_logins() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Check 2 logins");
|
||||
isnot(
|
||||
logins[0].password,
|
||||
|
|
|
@ -391,7 +391,7 @@ async function testPasswordChange(
|
|||
await LoginTestUtils.addLogin(login);
|
||||
}
|
||||
|
||||
for (let login of Services.logins.getAllLogins()) {
|
||||
for (let login of await Services.logins.getAllLogins()) {
|
||||
info(`Saved login: ${login.username}, ${login.password}, ${login.origin}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ async function setup_withNoLogins() {
|
|||
// Reset to a single, known login
|
||||
await task_setup();
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"0 logins at the start of the test"
|
||||
);
|
||||
|
@ -288,7 +288,7 @@ add_setup(async function () {
|
|||
],
|
||||
});
|
||||
// assert that there are no logins
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "There are no logins");
|
||||
});
|
||||
|
||||
|
@ -355,11 +355,11 @@ add_task(async function autocomplete_generated_password_auto_saved() {
|
|||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
);
|
||||
let [autoSavedLogin] = Services.logins.getAllLogins();
|
||||
let [autoSavedLogin] = await Services.logins.getAllLogins();
|
||||
info("waiting for submitForm");
|
||||
await submitForm(browser);
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: autoSavedLogin.timesUsed + 1,
|
||||
username: "",
|
||||
|
@ -440,11 +440,11 @@ add_task(
|
|||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
);
|
||||
let [autoSavedLogin] = Services.logins.getAllLogins();
|
||||
let [autoSavedLogin] = await Services.logins.getAllLogins();
|
||||
info("waiting for submitForm");
|
||||
await submitForm(browser);
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: autoSavedLogin.timesUsed + 1,
|
||||
username: "",
|
||||
|
@ -471,7 +471,7 @@ add_task(async function autocomplete_generated_password_saved_empty_username() {
|
|||
username: { selector: usernameInputSelector, expectedValue: "" },
|
||||
},
|
||||
async function taskFn(browser) {
|
||||
let [savedLogin] = Services.logins.getAllLogins();
|
||||
let [savedLogin] = await Services.logins.getAllLogins();
|
||||
let storageChangedPromise = TestUtils.topicObserved(
|
||||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
|
@ -507,7 +507,7 @@ add_task(async function autocomplete_generated_password_saved_empty_username() {
|
|||
|
||||
info("Waiting for modifyLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: savedLogin.timesUsed + 1,
|
||||
username: "",
|
||||
|
@ -559,7 +559,7 @@ add_task(async function autocomplete_generated_password_saved_username() {
|
|||
await verifyGeneratedPasswordWasFilled(browser, passwordInputSelector);
|
||||
|
||||
// Check properties of the newly auto-saved login
|
||||
let [user1LoginSnapshot, autoSavedLogin] = verifyLogins([
|
||||
let [user1LoginSnapshot, autoSavedLogin] = await verifyLogins([
|
||||
{
|
||||
username: "user1",
|
||||
password: "xyzpassword", // user1 is unchanged
|
||||
|
@ -605,7 +605,7 @@ add_task(async function autocomplete_generated_password_saved_username() {
|
|||
clickDoorhangerButton(notif, CHANGE_BUTTON);
|
||||
await promiseHidden;
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: user1LoginSnapshot.timesUsed + 1,
|
||||
username: "user1",
|
||||
|
@ -638,7 +638,7 @@ add_task(async function ac_gen_pw_saved_empty_un_stored_non_empty_un_in_form() {
|
|||
},
|
||||
},
|
||||
async function taskFn(browser) {
|
||||
let [savedLogin] = Services.logins.getAllLogins();
|
||||
let [savedLogin] = await Services.logins.getAllLogins();
|
||||
let storageChangedPromise = TestUtils.topicObserved(
|
||||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "addLogin"
|
||||
|
@ -674,7 +674,7 @@ add_task(async function ac_gen_pw_saved_empty_un_stored_non_empty_un_in_form() {
|
|||
|
||||
info("Waiting for addLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: savedLogin.timesUsed,
|
||||
username: "",
|
||||
|
@ -706,7 +706,7 @@ add_task(async function contextfill_generated_password_saved_empty_username() {
|
|||
username: { selector: usernameInputSelector, expectedValue: "" },
|
||||
},
|
||||
async function taskFn(browser) {
|
||||
let [savedLogin] = Services.logins.getAllLogins();
|
||||
let [savedLogin] = await Services.logins.getAllLogins();
|
||||
let storageChangedPromise = TestUtils.topicObserved(
|
||||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
|
@ -745,7 +745,7 @@ add_task(async function contextfill_generated_password_saved_empty_username() {
|
|||
|
||||
info("Waiting for modifyLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: savedLogin.timesUsed + 1,
|
||||
username: "",
|
||||
|
@ -776,7 +776,7 @@ async function autocomplete_generated_password_edited_no_auto_save(
|
|||
username: { selector: usernameInputSelector, expectedValue: "" },
|
||||
},
|
||||
async function taskFn(browser) {
|
||||
let [savedLogin] = Services.logins.getAllLogins();
|
||||
let [savedLogin] = await Services.logins.getAllLogins();
|
||||
let storageChangedPromise = TestUtils.topicObserved(
|
||||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
|
@ -824,7 +824,7 @@ async function autocomplete_generated_password_edited_no_auto_save(
|
|||
clickDoorhangerButton(notif, DONT_CHANGE_BUTTON);
|
||||
await promiseHidden;
|
||||
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: savedLogin.timesUsed,
|
||||
username: "",
|
||||
|
@ -850,7 +850,7 @@ async function autocomplete_generated_password_edited_no_auto_save(
|
|||
|
||||
info("Waiting for modifyLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
timesUsed: savedLogin.timesUsed + 1,
|
||||
username: "",
|
||||
|
@ -933,7 +933,7 @@ add_task(async function contextmenu_fill_generated_password_and_set_username() {
|
|||
await storageChangedPromise;
|
||||
|
||||
// Check properties of the newly auto-saved login
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
null, // ignore the first one
|
||||
{
|
||||
timesUsed: 1,
|
||||
|
@ -976,7 +976,7 @@ add_task(async function contextmenu_fill_generated_password_and_set_username() {
|
|||
|
||||
info("Waiting for modifyLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
null,
|
||||
{
|
||||
username: "differentuser",
|
||||
|
@ -1036,7 +1036,7 @@ add_task(async function contextmenu_password_change_form_without_username() {
|
|||
info("waiting for addLogin");
|
||||
await storageChangedPromise;
|
||||
// Check properties of the newly auto-saved login
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
null, // ignore the first one
|
||||
null, // ignore the 2nd one
|
||||
{
|
||||
|
@ -1063,14 +1063,14 @@ add_task(async function contextmenu_password_change_form_without_username() {
|
|||
"passwordmgr-storage-changed",
|
||||
(_, data) => data == "modifyLogin"
|
||||
);
|
||||
let { timeLastUsed } = Services.logins.getAllLogins()[2];
|
||||
let { timeLastUsed } = (await Services.logins.getAllLogins())[2];
|
||||
|
||||
info("waiting for submitForm");
|
||||
await submitForm(browser);
|
||||
|
||||
info("Waiting for modifyLogin");
|
||||
await storageChangedPromise;
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
null, // ignore the first one
|
||||
null, // ignore the 2nd one
|
||||
{
|
||||
|
@ -1142,7 +1142,7 @@ add_task(
|
|||
await storageChangedPromise;
|
||||
info("addLogin promise resolved");
|
||||
// Check properties of the newly auto-saved login
|
||||
let [user1LoginSnapshot, unused, autoSavedLogin] = verifyLogins([
|
||||
let [user1LoginSnapshot, unused, autoSavedLogin] = await verifyLogins([
|
||||
null, // ignore the first one
|
||||
null, // ignore the 2nd one
|
||||
{
|
||||
|
@ -1230,7 +1230,7 @@ add_task(
|
|||
|
||||
info("storage-change promises resolved");
|
||||
// Check the auto-saved login was removed and the original login updated
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
username: "user1",
|
||||
password: autoSavedLogin.password,
|
||||
|
@ -1320,7 +1320,7 @@ add_task(async function autosaved_login_updated_to_existing_login_onsubmit() {
|
|||
await storageChangedPromise;
|
||||
info("addLogin promise resolved");
|
||||
// Check properties of the newly auto-saved login
|
||||
let [user1LoginSnapshot, autoSavedLogin] = verifyLogins([
|
||||
let [user1LoginSnapshot, autoSavedLogin] = await verifyLogins([
|
||||
null, // ignore the first one
|
||||
{
|
||||
timesUsed: 1,
|
||||
|
@ -1430,7 +1430,7 @@ add_task(async function autosaved_login_updated_to_existing_login_onsubmit() {
|
|||
|
||||
info("storage-change promises resolved");
|
||||
// Check the auto-saved login was removed and the original login updated
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
username: "user1",
|
||||
password: autoSavedLogin.password,
|
||||
|
@ -1512,7 +1512,7 @@ add_task(async function form_change_from_autosaved_login_to_existing_login() {
|
|||
await storageChangedPromise;
|
||||
info("addLogin promise resolved");
|
||||
// Check properties of the newly auto-saved login
|
||||
let [user1LoginSnapshot, autoSavedLogin] = verifyLogins([
|
||||
let [user1LoginSnapshot, autoSavedLogin] = await verifyLogins([
|
||||
null, // ignore the first one
|
||||
{
|
||||
timesUsed: 1,
|
||||
|
@ -1628,7 +1628,7 @@ add_task(async function form_change_from_autosaved_login_to_existing_login() {
|
|||
await storageChangedPromise;
|
||||
|
||||
// Check the auto-saved login has not changed and only metadata on the original login updated
|
||||
verifyLogins([
|
||||
await verifyLogins([
|
||||
{
|
||||
username: "user1",
|
||||
password: "xyzpassword",
|
||||
|
@ -1706,7 +1706,7 @@ add_task(async function form_edit_username_and_password_of_generated_login() {
|
|||
await storageChangedPromise;
|
||||
info("addLogin promise resolved");
|
||||
// Check properties of the newly auto-saved login
|
||||
let [autoSavedLoginSnapshot] = verifyLogins([
|
||||
let [autoSavedLoginSnapshot] = await verifyLogins([
|
||||
{
|
||||
timesUsed: 1,
|
||||
username: "",
|
||||
|
|
|
@ -32,7 +32,7 @@ add_task(async function test_httpsUpgradeCaptureFields_noChange() {
|
|||
);
|
||||
await Services.logins.addLoginAsync(login1);
|
||||
// Sanity check the HTTP login exists.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should have the HTTP login");
|
||||
|
||||
await testSubmittingLoginForm(
|
||||
|
@ -54,7 +54,7 @@ add_task(async function test_httpsUpgradeCaptureFields_noChange() {
|
|||
"https://example.com"
|
||||
); // This is HTTPS whereas the saved login is HTTP
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login still");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
@ -75,7 +75,7 @@ add_task(async function test_httpsUpgradeCaptureFields_changePW() {
|
|||
);
|
||||
await Services.logins.addLoginAsync(login1);
|
||||
// Sanity check the HTTP login exists.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should have the HTTP login");
|
||||
|
||||
await testSubmittingLoginForm(
|
||||
|
@ -105,8 +105,8 @@ add_task(async function test_httpsUpgradeCaptureFields_changePW() {
|
|||
"https://example.com"
|
||||
); // This is HTTPS whereas the saved login is HTTP
|
||||
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
logins = Services.logins.getAllLogins();
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login still");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
@ -133,7 +133,7 @@ add_task(
|
|||
);
|
||||
await Services.logins.addLogins([login1, login1HTTPS]);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have both HTTP and HTTPS logins");
|
||||
|
||||
await testSubmittingLoginForm(
|
||||
|
@ -163,7 +163,7 @@ add_task(
|
|||
"https://example.com"
|
||||
);
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have 2 logins still");
|
||||
let loginHTTP = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
let loginHTTPS = logins[1].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
|
@ -236,7 +236,7 @@ add_task(async function test_httpsUpgradeCaptureFields_captureMatchingHTTP() {
|
|||
Assert.ok(notif, "got notification popup");
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should only have the HTTPS login"
|
||||
);
|
||||
|
@ -248,7 +248,7 @@ add_task(async function test_httpsUpgradeCaptureFields_captureMatchingHTTP() {
|
|||
|
||||
await storageChangedPromise;
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have both HTTP and HTTPS logins");
|
||||
for (let login of logins) {
|
||||
login = login.QueryInterface(Ci.nsILoginMetaInfo);
|
||||
|
@ -286,7 +286,7 @@ add_task(async function test_httpsUpgradeCaptureFields_captureMatchingHTTP() {
|
|||
}
|
||||
);
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have both HTTP and HTTPS still");
|
||||
|
||||
let httpsLogins = LoginHelper.searchLoginsWithObject({
|
||||
|
|
|
@ -173,7 +173,7 @@ async function test_save_change(testData) {
|
|||
await cleanupDoorhanger(notif); // clean slate for the next test
|
||||
|
||||
// Check that the values in the database match the expected values.
|
||||
verifyLogins(expectOutcome);
|
||||
await verifyLogins(expectOutcome);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ add_task(async function test_edit_password() {
|
|||
expectedLogin.usedSince = meta.timeCreated;
|
||||
expectedLogin.timeCreated = meta.timePasswordChanged;
|
||||
}
|
||||
verifyLogins([expectedLogin]);
|
||||
await verifyLogins([expectedLogin]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ async function promptToChangePasswordTest(testData) {
|
|||
info(testData.resultDescription);
|
||||
|
||||
finalLoginsByGuid.clear();
|
||||
finalLogins = Services.logins.getAllLogins();
|
||||
finalLogins = await Services.logins.getAllLogins();
|
||||
finalLogins.sort((a, b) => a.timeCreated > b.timeCreated);
|
||||
|
||||
for (let l of finalLogins) {
|
||||
|
@ -173,7 +173,7 @@ async function promptToChangePasswordTest(testData) {
|
|||
finalLoginsByGuid.set(l.guid, l);
|
||||
}
|
||||
info("verifyLogins next");
|
||||
verifyLogins(testData.expectedResultLogins);
|
||||
await verifyLogins(testData.expectedResultLogins);
|
||||
if (testData.resultCheck) {
|
||||
testData.resultCheck();
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ add_task(async function test_clickNever() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -148,7 +148,7 @@ add_task(async function test_clickNever() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -178,7 +178,7 @@ add_task(async function test_clickRemember() {
|
|||
Assert.ok(!notif.dismissed, "doorhanger is not dismissed");
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -195,7 +195,7 @@ add_task(async function test_clickRemember() {
|
|||
|
||||
await storageChangedPromise;
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
@ -232,7 +232,7 @@ add_task(async function test_clickRemember() {
|
|||
}
|
||||
);
|
||||
|
||||
logins = Services.logins.getAllLogins();
|
||||
logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username used");
|
||||
|
@ -271,7 +271,7 @@ add_task(async function test_rememberSignonsFalse() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -302,7 +302,7 @@ add_task(async function test_rememberSignonsTrue() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -336,7 +336,7 @@ add_task(async function test_autocompleteOffUsername() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -368,7 +368,7 @@ add_task(async function test_autocompleteOffPassword() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -398,7 +398,7 @@ add_task(async function test_autocompleteOffForm() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -422,7 +422,7 @@ add_task(async function test_noPasswordField() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -473,7 +473,7 @@ add_task(async function test_pwOnlyNewLoginMatchesUPForm() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username");
|
||||
|
@ -540,7 +540,7 @@ add_task(async function test_pwOnlyOldLoginMatchesUPForm() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username");
|
||||
|
@ -570,7 +570,7 @@ add_task(async function test_pwOnlyFormMatchesLogin() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username");
|
||||
|
@ -602,7 +602,7 @@ add_task(async function test_pwOnlyFormDoesntMatchExisting() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1B", "Check the username unchanged");
|
||||
|
@ -643,7 +643,7 @@ add_task(async function test_changeUPLoginOnUPForm_dont() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username unchanged");
|
||||
|
@ -690,7 +690,7 @@ add_task(async function test_changeUPLoginOnUPForm_remove() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "Should have 0 logins");
|
||||
});
|
||||
|
||||
|
@ -735,14 +735,14 @@ add_task(async function test_changeUPLoginOnUPForm_change() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username unchanged");
|
||||
Assert.equal(login.password, "pass2", "Check the password changed");
|
||||
Assert.equal(login.timesUsed, 2, "Check times used");
|
||||
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
|
||||
// cleanup
|
||||
login1.password = "pass2";
|
||||
|
@ -782,7 +782,7 @@ add_task(async function test_changePLoginOnUPForm() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "", "Check the username unchanged");
|
||||
|
@ -823,7 +823,7 @@ add_task(async function test_changePLoginOnPForm() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "", "Check the username unchanged");
|
||||
|
@ -865,7 +865,7 @@ add_task(async function test_checkUPSaveText() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -899,7 +899,7 @@ add_task(async function test_checkPSaveText() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -928,7 +928,7 @@ add_task(async function test_capture2pw0un() {
|
|||
);
|
||||
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -958,7 +958,7 @@ add_task(async function test_change2pw0unExistingDifferentUP() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1B", "Check the username unchanged");
|
||||
|
@ -992,7 +992,7 @@ add_task(async function test_change2pw0unExistingDifferentP() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "", "Check the username unchanged");
|
||||
|
@ -1024,14 +1024,14 @@ add_task(async function test_change2pw0unExistingWithSameP() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "", "Check the username unchanged");
|
||||
Assert.equal(login.password, "notifyp1", "Check the password unchanged");
|
||||
Assert.equal(login.timesUsed, 2, "Check times used incremented");
|
||||
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
|
||||
Services.logins.removeLogin(login2);
|
||||
});
|
||||
|
@ -1063,14 +1063,14 @@ add_task(async function test_changeUPLoginOnPUpdateForm() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username unchanged");
|
||||
Assert.equal(login.password, "pass2", "Check the password changed");
|
||||
Assert.equal(login.timesUsed, 2, "Check times used");
|
||||
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: true });
|
||||
|
||||
// cleanup
|
||||
login1.password = "pass2";
|
||||
|
@ -1106,7 +1106,7 @@ add_task(async function test_recipeCaptureFields_NewLogin() {
|
|||
Assert.ok(!notif.dismissed, "doorhanger is not dismissed");
|
||||
|
||||
// Sanity check, no logins should exist yet.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "Should not have any logins yet");
|
||||
|
||||
await checkDoorhangerUsernamePassword("notifyu1", "notifyp1");
|
||||
|
@ -1117,7 +1117,7 @@ add_task(async function test_recipeCaptureFields_NewLogin() {
|
|||
|
||||
await storageChangedPromise;
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username unchanged");
|
||||
|
@ -1150,8 +1150,8 @@ add_task(async function test_recipeCaptureFields_ExistingLogin() {
|
|||
"http://example.org"
|
||||
);
|
||||
|
||||
checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
let logins = Services.logins.getAllLogins();
|
||||
await checkOnlyLoginWasUsedTwice({ justChanged: false });
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username unchanged");
|
||||
|
@ -1186,7 +1186,7 @@ add_task(async function test_saveUsingEnter() {
|
|||
Assert.ok(notif, "got notification popup");
|
||||
Assert.ok(!notif.dismissed, "doorhanger is not dismissed");
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should not have any logins yet"
|
||||
);
|
||||
|
@ -1200,7 +1200,7 @@ add_task(async function test_saveUsingEnter() {
|
|||
|
||||
await storageChangedPromise;
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
|
|
@ -150,7 +150,7 @@ async function test_save_change(testData) {
|
|||
await cleanupDoorhanger(notif); // clean slate for the next test
|
||||
|
||||
// Check that the values in the database match the expected values.
|
||||
verifyLogins(expectOutcome);
|
||||
await verifyLogins(expectOutcome);
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ add_task(async function test_saveTargetBlank() {
|
|||
);
|
||||
|
||||
// Check result of clicking Remember
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login now");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
|
|
@ -75,13 +75,13 @@ add_task(async function test_saveChromeHiddenAutoClose() {
|
|||
Assert.ok(popup, "got notification popup");
|
||||
await checkDoorhangerUsernamePassword("notifyu1", "notifyp1");
|
||||
// Sanity check, no logins should exist yet.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 0, "Should not have any logins yet");
|
||||
|
||||
clickDoorhangerButton(popup, REMEMBER_BUTTON);
|
||||
});
|
||||
// Check result of clicking Remember
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.timesUsed, 1, "Check times used on new entry");
|
||||
|
@ -115,7 +115,7 @@ add_task(async function test_changeChromeHiddenAutoClose() {
|
|||
|
||||
// Check to make sure we updated the password, timestamps and use count for
|
||||
// the login being changed with this form.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu1", "Check the username");
|
||||
|
@ -149,7 +149,7 @@ add_task(async function test_saveChromeVisibleSameWindow() {
|
|||
});
|
||||
|
||||
// Check result of clicking Remember
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login now");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(
|
||||
|
@ -182,7 +182,7 @@ add_task(async function test_changeChromeVisibleSameWindow() {
|
|||
|
||||
// Check to make sure we updated the password, timestamps and use count for
|
||||
// the login being changed with this form.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should have 1 login");
|
||||
let login = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
Assert.equal(login.username, "notifyu2", "Check the username");
|
||||
|
|
|
@ -33,7 +33,7 @@ add_task(
|
|||
|
||||
await storageChangedPromise;
|
||||
|
||||
const loginEntries = Services.logins.getAllLogins().length;
|
||||
const loginEntries = (await Services.logins.getAllLogins()).length;
|
||||
const historyEntries = await FormHistoryTestUtils.count(usernameFieldName);
|
||||
|
||||
Assert.equal(
|
||||
|
@ -57,7 +57,7 @@ add_task(
|
|||
|
||||
await testSubmittingLoginFormHTTP("subtst_notifications_1.html");
|
||||
|
||||
const loginEntries = Services.logins.getAllLogins().length;
|
||||
const loginEntries = (await Services.logins.getAllLogins()).length;
|
||||
const historyEntries = await FormHistoryTestUtils.count(usernameFieldName);
|
||||
|
||||
Assert.equal(
|
||||
|
|
|
@ -251,7 +251,7 @@ add_task(async function test_private_popup_notification_2() {
|
|||
}
|
||||
);
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"No logins were saved"
|
||||
);
|
||||
|
@ -315,7 +315,7 @@ add_task(async function test_private_popup_notification_no_capture_pref_2b() {
|
|||
}
|
||||
);
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"No logins were saved"
|
||||
);
|
||||
|
@ -329,7 +329,7 @@ add_task(async function test_normal_popup_notification_3() {
|
|||
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
await Services.logins.addLoginAsync(login);
|
||||
let allLogins = Services.logins.getAllLogins();
|
||||
let allLogins = await Services.logins.getAllLogins();
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(allLogins.length, 1, "Should have the HTTP login");
|
||||
let timeLastUsed = allLogins[0].timeLastUsed;
|
||||
|
@ -368,7 +368,7 @@ add_task(async function test_normal_popup_notification_3() {
|
|||
}
|
||||
}
|
||||
);
|
||||
allLogins = Services.logins.getAllLogins();
|
||||
allLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
allLogins[0].guid,
|
||||
loginGuid,
|
||||
|
@ -388,7 +388,7 @@ add_task(async function test_private_popup_notification_3b() {
|
|||
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
await Services.logins.addLoginAsync(login);
|
||||
let allLogins = Services.logins.getAllLogins();
|
||||
let allLogins = await Services.logins.getAllLogins();
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(allLogins.length, 1, "Should have the HTTP login");
|
||||
let timeLastUsed = allLogins[0].timeLastUsed;
|
||||
|
@ -428,7 +428,7 @@ add_task(async function test_private_popup_notification_3b() {
|
|||
}
|
||||
}
|
||||
);
|
||||
allLogins = Services.logins.getAllLogins();
|
||||
allLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
allLogins[0].guid,
|
||||
loginGuid,
|
||||
|
@ -448,7 +448,7 @@ add_task(async function test_normal_new_password_4() {
|
|||
);
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
await Services.logins.addLoginAsync(login);
|
||||
let allLogins = Services.logins.getAllLogins();
|
||||
let allLogins = await Services.logins.getAllLogins();
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(allLogins.length, 1, "Should have the HTTP login");
|
||||
let timeLastUsed = allLogins[0].timeLastUsed;
|
||||
|
@ -491,7 +491,7 @@ add_task(async function test_normal_new_password_4() {
|
|||
);
|
||||
// We put up a doorhanger, but didn't interact with it, so we expect the login timestamps
|
||||
// to be unchanged
|
||||
allLogins = Services.logins.getAllLogins();
|
||||
allLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
allLogins[0].guid,
|
||||
loginGuid,
|
||||
|
@ -518,7 +518,7 @@ add_task(async function test_private_new_password_5() {
|
|||
`Expect ${PRIVATE_BROWSING_CAPTURE_PREF} to default to true`
|
||||
);
|
||||
|
||||
let allLogins = Services.logins.getAllLogins();
|
||||
let allLogins = await Services.logins.getAllLogins();
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(allLogins.length, 1, "Should have the HTTP login");
|
||||
let timeLastUsed = allLogins[0].timeLastUsed;
|
||||
|
@ -561,7 +561,7 @@ add_task(async function test_private_new_password_5() {
|
|||
);
|
||||
// We put up a doorhanger, but didn't interact with it, so we expect the login timestamps
|
||||
// to be unchanged
|
||||
allLogins = Services.logins.getAllLogins();
|
||||
allLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
allLogins[0].guid,
|
||||
loginGuid,
|
||||
|
@ -624,7 +624,7 @@ add_task(async function test_normal_autofilled_7() {
|
|||
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have the HTTP login"
|
||||
);
|
||||
|
@ -666,7 +666,7 @@ add_task(async function test_private_not_autofilled_8() {
|
|||
info("test 8: verify that the user/pass pair was not autofilled");
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have the HTTP login"
|
||||
);
|
||||
|
@ -696,7 +696,7 @@ add_task(async function test_private_not_autofilled_8() {
|
|||
// add_task(async function test_private_autocomplete_9() {
|
||||
// info("test 9: verify that the user/pass pair was available for autocomplete");
|
||||
// // Sanity check the HTTP login exists.
|
||||
// Assert.equal(Services.logins.getAllLogins().length, 1, "Should have the HTTP login");
|
||||
// Assert.equal((await Services.logins.getAllLogins()).length, 1, "Should have the HTTP login");
|
||||
|
||||
// await focusWindow(privateWin);
|
||||
// await BrowserTestUtils.withNewTab({
|
||||
|
@ -740,7 +740,7 @@ add_task(async function test_normal_autofilled_10() {
|
|||
);
|
||||
// Sanity check the HTTP login exists.
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have the HTTP login"
|
||||
);
|
||||
|
|
|
@ -96,7 +96,7 @@ add_task(async function test_changeUPLoginOnPUpdateForm_accept() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have 2 logins");
|
||||
|
||||
let login = SpecialPowers.wrap(logins[0]).QueryInterface(Ci.nsILoginMetaInfo);
|
||||
|
@ -158,7 +158,7 @@ add_task(async function test_changeUPLoginOnPUpdateForm_cancel() {
|
|||
}
|
||||
);
|
||||
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 2, "Should have 2 logins");
|
||||
|
||||
let login = SpecialPowers.wrap(logins[0]).QueryInterface(Ci.nsILoginMetaInfo);
|
||||
|
|
|
@ -58,8 +58,8 @@ registerCleanupFunction(
|
|||
* An array of expected login properties
|
||||
* @return {nsILoginInfo[]} - All saved logins sorted by timeCreated
|
||||
*/
|
||||
function verifyLogins(expectedLogins = []) {
|
||||
let allLogins = Services.logins.getAllLogins();
|
||||
async function verifyLogins(expectedLogins = []) {
|
||||
let allLogins = await Services.logins.getAllLogins();
|
||||
allLogins.sort((a, b) => a.timeCreated > b.timeCreated);
|
||||
Assert.equal(
|
||||
allLogins.length,
|
||||
|
@ -268,10 +268,10 @@ function testSubmittingLoginFormHTTP(
|
|||
return testSubmittingLoginForm(aPageFile, aTaskFn, aOrigin);
|
||||
}
|
||||
|
||||
function checkOnlyLoginWasUsedTwice({ justChanged }) {
|
||||
async function checkOnlyLoginWasUsedTwice({ justChanged }) {
|
||||
// Check to make sure we updated the timestamps and use count on the
|
||||
// existing login that was submitted for the test.
|
||||
let logins = Services.logins.getAllLogins();
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
Assert.equal(logins.length, 1, "Should only have 1 login");
|
||||
Assert.ok(logins[0] instanceof Ci.nsILoginMetaInfo, "metainfo QI");
|
||||
Assert.equal(
|
||||
|
|
|
@ -46,7 +46,7 @@ async function commonInit(selfFilling, testDependsOnDeprecatedLogin) {
|
|||
assert.ok(pwmgr != null, "Access LoginManager");
|
||||
|
||||
// Check that initial state has no logins
|
||||
var logins = pwmgr.getAllLogins();
|
||||
var logins = await pwmgr.getAllLogins();
|
||||
assert.equal(logins.length, 0, "Not expecting logins to be present");
|
||||
var disabledHosts = pwmgr.getAllDisabledHosts();
|
||||
if (disabledHosts.length) {
|
||||
|
@ -74,7 +74,7 @@ async function commonInit(selfFilling, testDependsOnDeprecatedLogin) {
|
|||
}
|
||||
|
||||
// Last sanity check
|
||||
logins = pwmgr.getAllLogins();
|
||||
logins = await pwmgr.getAllLogins();
|
||||
assert.equal(
|
||||
logins.length,
|
||||
testDependsOnDeprecatedLogin ? 1 : 0,
|
||||
|
@ -91,8 +91,8 @@ async function commonInit(selfFilling, testDependsOnDeprecatedLogin) {
|
|||
sendAsyncMessage("registerRunTests");
|
||||
}
|
||||
|
||||
function dumpLogins() {
|
||||
let logins = Services.logins.getAllLogins();
|
||||
async function dumpLogins() {
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
assert.ok(true, "----- dumpLogins: have " + logins.length + " logins. -----");
|
||||
for (var i = 0; i < logins.length; i++) {
|
||||
dumpLogin("login #" + i + " --- ", logins[i]);
|
||||
|
|
|
@ -72,9 +72,9 @@ add_task(async function test_autocomplete_https_downgrade() {
|
|||
info("test_autocomplete_http, setup with " + HTTP_FORM_URL);
|
||||
await setup(HTTP_FORM_URL);
|
||||
|
||||
LoginManager.getAllLogins().then(logins => {
|
||||
info("got logins: " + logins.map(l => l.origin));
|
||||
});
|
||||
let logins = await LoginManager.getAllLogins();
|
||||
info("got logins: " + logins.map(l => l.origin));
|
||||
|
||||
// from a HTTP page, look for matching logins, we should never offer a login with an HTTPS scheme
|
||||
// we're expecting just login2 as a match
|
||||
let isCrossOrigin = false;
|
||||
|
|
|
@ -42,8 +42,9 @@ async function setupWithOneLogin(pageUrl) {
|
|||
let origin = window.location.origin;
|
||||
await setStoredLoginsAsync([origin, origin, null, "user1", "pass1"]);
|
||||
|
||||
let chromeScript = runInParent(function testSetup() {
|
||||
for (let l of Services.logins.getAllLogins()) {
|
||||
let chromeScript = runInParent(async function testSetup() {
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
for (let l of logins) {
|
||||
info("Got login: " + l.username + ", " + l.password);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -178,7 +178,7 @@ async function startTestConditions(contextId) {
|
|||
"Empty cache to start"
|
||||
);
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should have no saved logins at the start of the test"
|
||||
);
|
||||
|
@ -223,7 +223,7 @@ add_task(async function test_onPasswordEditedOrGenerated_generatedPassword() {
|
|||
);
|
||||
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should have no saved logins at the start of the test"
|
||||
);
|
||||
|
@ -293,7 +293,7 @@ add_task(async function test_onPasswordEditedOrGenerated_generatedPassword() {
|
|||
expected.password = newPassword;
|
||||
Assert.ok(login.equals(expected), "Check updated login");
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
|
@ -327,7 +327,7 @@ add_task(async function test_onPasswordEditedOrGenerated_generatedPassword() {
|
|||
expected.password = newerPassword;
|
||||
Assert.ok(login.equals(expected), "Check updated login");
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
|
@ -356,7 +356,7 @@ add_task(
|
|||
);
|
||||
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should have no saved logins at the start of the test"
|
||||
);
|
||||
|
@ -456,7 +456,7 @@ add_task(async function test_addUsernameBeforeAutoSaveEdit() {
|
|||
);
|
||||
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should have no saved logins at the start of the test"
|
||||
);
|
||||
|
@ -540,7 +540,7 @@ add_task(async function test_addUsernameBeforeAutoSaveEdit() {
|
|||
assertLoginProperties(login, loginWithUsername);
|
||||
Assert.ok(login.matches(loginWithUsername, false), "Check updated login");
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
|
@ -596,7 +596,7 @@ add_task(async function test_addUsernameBeforeAutoSaveEdit() {
|
|||
assertLoginProperties(login, loginWithUsername);
|
||||
Assert.ok(login.matches(loginWithUsername, false), "Check updated login");
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
|
@ -653,15 +653,10 @@ add_task(async function test_editUsernameOfFilledSavedLogin() {
|
|||
info("Adding initial login: " + JSON.stringify(login0Props));
|
||||
let savedLogin = await LoginTestUtils.addLogin(login0Props);
|
||||
|
||||
info(
|
||||
"Saved initial login: " + JSON.stringify(Services.logins.getAllLogins()[0])
|
||||
);
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
info("Saved initial login: " + JSON.stringify(logins[0]));
|
||||
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
1,
|
||||
"Should have 1 saved login at the start of the test"
|
||||
);
|
||||
equal(logins.length, 1, "Should have 1 saved login at the start of the test");
|
||||
|
||||
// first prompt to save a new login
|
||||
let newUsername = "differentuser";
|
||||
|
@ -784,7 +779,7 @@ add_task(
|
|||
}
|
||||
);
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
0,
|
||||
"Should have no saved logins since saving is disabled"
|
||||
);
|
||||
|
@ -832,12 +827,13 @@ add_task(
|
|||
triggeredByFillingGenerated: true,
|
||||
}
|
||||
);
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
logins.length,
|
||||
1,
|
||||
"Should just have the previously-saved login with empty username"
|
||||
);
|
||||
assertLoginProperties(Services.logins.getAllLogins()[0], login0Props);
|
||||
assertLoginProperties(logins[0], login0Props);
|
||||
|
||||
Assert.ok(LMP._getPrompter.calledOnce, "Checking _getPrompter was called");
|
||||
Assert.ok(
|
||||
|
@ -873,16 +869,10 @@ add_task(
|
|||
Assert.ok(generatedPW.edited, "Cached edited boolean should be true");
|
||||
equal(generatedPW.storageGUID, null, "Should have no storageGUID");
|
||||
equal(generatedPW.value, newPassword, "Cached password should be updated");
|
||||
assertLoginProperties(Services.logins.getAllLogins()[0], login0Props);
|
||||
Assert.ok(
|
||||
Services.logins.getAllLogins()[0].equals(expected),
|
||||
"Ensure no changes"
|
||||
);
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
logins = await Services.logins.getAllLogins();
|
||||
assertLoginProperties(logins[0], login0Props);
|
||||
Assert.ok(logins[0].equals(expected), "Ensure no changes");
|
||||
equal(logins.length, 1, "Should have 1 saved login still");
|
||||
|
||||
checkEditTelemetryRecorded(1, "Updating cache, not storage (no auto-save)");
|
||||
|
||||
|
@ -907,7 +897,7 @@ add_task(
|
|||
|
||||
info(
|
||||
"Saved initial login: " +
|
||||
JSON.stringify(Services.logins.getAllLogins()[0])
|
||||
JSON.stringify(await Services.logins.getAllLogins()[0])
|
||||
);
|
||||
|
||||
let { generatedPassword: password1 } =
|
||||
|
@ -930,12 +920,13 @@ add_task(
|
|||
triggeredByFillingGenerated: true,
|
||||
}
|
||||
);
|
||||
let logins = await Services.logins.getAllLogins();
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
logins.length,
|
||||
1,
|
||||
"Should just have the previously-saved login with empty username"
|
||||
);
|
||||
assertLoginProperties(Services.logins.getAllLogins()[0], login0Props);
|
||||
assertLoginProperties(logins[0], login0Props);
|
||||
|
||||
Assert.ok(LMP._getPrompter.calledOnce, "Checking _getPrompter was called");
|
||||
Assert.ok(
|
||||
|
@ -992,16 +983,10 @@ add_task(
|
|||
Assert.ok(generatedPW.edited, "Cached edited boolean should be true");
|
||||
equal(generatedPW.storageGUID, null, "Should have no storageGUID");
|
||||
equal(generatedPW.value, newPassword, "Cached password should be updated");
|
||||
assertLoginProperties(Services.logins.getAllLogins()[0], login0Props);
|
||||
Assert.ok(
|
||||
Services.logins.getAllLogins()[0].equals(expected),
|
||||
"Ensure no changes"
|
||||
);
|
||||
equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
1,
|
||||
"Should have 1 saved login still"
|
||||
);
|
||||
logins = await Services.logins.getAllLogins();
|
||||
assertLoginProperties(logins[0], login0Props);
|
||||
Assert.ok(logins[0].equals(expected), "Ensure no changes");
|
||||
equal(logins.length, 1, "Should have 1 saved login still");
|
||||
|
||||
checkEditTelemetryRecorded(
|
||||
1,
|
||||
|
@ -1041,7 +1026,7 @@ add_task(
|
|||
}
|
||||
);
|
||||
|
||||
let savedLogins = Services.logins.getAllLogins();
|
||||
let savedLogins = await Services.logins.getAllLogins();
|
||||
equal(
|
||||
savedLogins.length,
|
||||
2,
|
||||
|
@ -1104,13 +1089,13 @@ add_task(
|
|||
}
|
||||
);
|
||||
|
||||
let savedLogins = Services.logins.getAllLogins();
|
||||
let savedLogins = await Services.logins.getAllLogins();
|
||||
equal(
|
||||
savedLogins.length,
|
||||
2,
|
||||
"Should have saved the generated-password login"
|
||||
);
|
||||
assertLoginProperties(Services.logins.getAllLogins()[0], login0Props);
|
||||
assertLoginProperties(savedLogins[0], login0Props);
|
||||
assertLoginProperties(
|
||||
savedLogins[1],
|
||||
Object.assign({}, loginTemplate, {
|
||||
|
|
|
@ -29,7 +29,7 @@ async function checkLoginInvalid(aLoginInfo, aExpectedError) {
|
|||
Services.logins.addLoginAsync(aLoginInfo),
|
||||
aExpectedError
|
||||
);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
// Add a login for the modification tests.
|
||||
let testLogin = TestData.formLogin({ origin: "http://modify.example.com" });
|
||||
|
@ -58,7 +58,7 @@ async function checkLoginInvalid(aLoginInfo, aExpectedError) {
|
|||
);
|
||||
|
||||
// Verify that no data was stored by the previous calls.
|
||||
LoginTestUtils.checkLogins([testLogin]);
|
||||
await LoginTestUtils.checkLogins([testLogin]);
|
||||
Services.logins.removeLogin(testLogin);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ function compareAttributes(objectA, objectB, attributes) {
|
|||
add_task(async function test_addLogin_removeLogin() {
|
||||
// Each login from the test data should be valid and added to the list.
|
||||
await Services.logins.addLogins(TestData.loginList());
|
||||
LoginTestUtils.checkLogins(TestData.loginList());
|
||||
await LoginTestUtils.checkLogins(TestData.loginList());
|
||||
|
||||
// Trying to add each login again should result in an error.
|
||||
for (let loginInfo of TestData.loginList()) {
|
||||
|
@ -108,7 +108,7 @@ add_task(async function test_addLogin_removeLogin() {
|
|||
Services.logins.removeLogin(loginInfo);
|
||||
}
|
||||
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
});
|
||||
|
||||
add_task(async function add_login_works_with_empty_array() {
|
||||
|
@ -292,7 +292,7 @@ add_task(async function test_removeAllUserFacingLogins() {
|
|||
await Services.logins.addLogins(TestData.loginList());
|
||||
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
// The function should also work when there are no logins to delete.
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
|
@ -322,7 +322,7 @@ add_task(async function test_modifyLogin_nsILoginInfo() {
|
|||
Services.logins.modifyLogin(loginInfo, updatedLoginInfo);
|
||||
|
||||
// The data should now match the second login.
|
||||
LoginTestUtils.checkLogins([updatedLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([updatedLoginInfo]);
|
||||
Assert.throws(
|
||||
() => Services.logins.modifyLogin(loginInfo, updatedLoginInfo),
|
||||
/No matching logins/
|
||||
|
@ -330,18 +330,18 @@ add_task(async function test_modifyLogin_nsILoginInfo() {
|
|||
|
||||
// The login can be changed to have a different type and origin.
|
||||
Services.logins.modifyLogin(updatedLoginInfo, differentLoginInfo);
|
||||
LoginTestUtils.checkLogins([differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([differentLoginInfo]);
|
||||
|
||||
// It is now possible to add a login with the old type and origin.
|
||||
await Services.logins.addLoginAsync(loginInfo);
|
||||
LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
|
||||
// Modifying a login to match an existing one should not be possible.
|
||||
Assert.throws(
|
||||
() => Services.logins.modifyLogin(loginInfo, differentLoginInfo),
|
||||
/already exists/
|
||||
);
|
||||
LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
|
||||
LoginTestUtils.clearData();
|
||||
});
|
||||
|
@ -388,7 +388,7 @@ add_task(async function test_modifyLogin_nsIProperyBag() {
|
|||
);
|
||||
|
||||
// The data should now match the second login.
|
||||
LoginTestUtils.checkLogins([updatedLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([updatedLoginInfo]);
|
||||
Assert.throws(
|
||||
() => Services.logins.modifyLogin(loginInfo, newPropertyBag()),
|
||||
/No matching logins/
|
||||
|
@ -411,18 +411,18 @@ add_task(async function test_modifyLogin_nsIProperyBag() {
|
|||
|
||||
// The login can be changed to have a different type and origin.
|
||||
Services.logins.modifyLogin(updatedLoginInfo, differentLoginProperties);
|
||||
LoginTestUtils.checkLogins([differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([differentLoginInfo]);
|
||||
|
||||
// It is now possible to add a login with the old type and origin.
|
||||
await Services.logins.addLoginAsync(loginInfo);
|
||||
LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
|
||||
// Modifying a login to match an existing one should not be possible.
|
||||
Assert.throws(
|
||||
() => Services.logins.modifyLogin(loginInfo, differentLoginProperties),
|
||||
/already exists/
|
||||
);
|
||||
LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
await LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
|
||||
|
||||
LoginTestUtils.clearData();
|
||||
});
|
||||
|
@ -579,10 +579,10 @@ add_task(async function test_addLogin_badDates() {
|
|||
Services.logins.addLoginAsync(loginInfo),
|
||||
/invalid date properties/
|
||||
);
|
||||
Assert.equal(Services.logins.getAllLogins().length, 0);
|
||||
Assert.equal((await Services.logins.getAllLogins()).length, 0);
|
||||
}
|
||||
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,12 +34,9 @@ add_task(async function test_logins_decrypt_failure() {
|
|||
resetPrimaryPassword();
|
||||
|
||||
// These functions don't see the non-decryptable entries anymore.
|
||||
Assert.equal(Services.logins.getAllLogins().length, 0);
|
||||
Assert.equal(
|
||||
(await Services.logins.getAllLoginsAsync()).length,
|
||||
0,
|
||||
"getAllLoginsAsync length"
|
||||
);
|
||||
let savedLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(savedLogins.length, 0);
|
||||
Assert.equal(savedLogins.length, 0, "getAllLogins length");
|
||||
Assert.equal(Services.logins.findLogins("", "", "").length, 0);
|
||||
Assert.equal(Services.logins.searchLogins(newPropertyBag()).length, 0);
|
||||
Assert.throws(
|
||||
|
@ -56,11 +53,11 @@ add_task(async function test_logins_decrypt_failure() {
|
|||
|
||||
// Equivalent logins can be added.
|
||||
await Services.logins.addLogins(logins);
|
||||
LoginTestUtils.checkLogins(logins);
|
||||
await LoginTestUtils.checkLogins(logins);
|
||||
Assert.equal(
|
||||
(await Services.logins.getAllLoginsAsync()).length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
logins.length,
|
||||
"getAllLoginsAsync length"
|
||||
"getAllLogins length"
|
||||
);
|
||||
Assert.equal(Services.logins.countLogins("", "", ""), logins.length * 2);
|
||||
|
||||
|
@ -76,12 +73,12 @@ add_task(async function test_logins_decrypt_failure() {
|
|||
for (let loginInfo of TestData.loginList()) {
|
||||
Services.logins.removeLogin(loginInfo);
|
||||
}
|
||||
Assert.equal(Services.logins.getAllLogins().length, 0);
|
||||
Assert.equal((await Services.logins.getAllLogins()).length, 0);
|
||||
Assert.equal(Services.logins.countLogins("", "", ""), logins.length);
|
||||
|
||||
// Removing all logins removes the non-decryptable entries also.
|
||||
Services.logins.removeAllUserFacingLogins();
|
||||
Assert.equal(Services.logins.getAllLogins().length, 0);
|
||||
Assert.equal((await Services.logins.getAllLogins()).length, 0);
|
||||
Assert.equal(Services.logins.countLogins("", "", ""), 0);
|
||||
});
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ add_task(async function test_addLogin_metainfo() {
|
|||
// Add an authentication login to the database before continuing.
|
||||
await Services.logins.addLoginAsync(gLoginInfo3);
|
||||
gLoginMetaInfo3 = retrieveLoginMatching(gLoginInfo3);
|
||||
LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
await LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -133,7 +133,7 @@ add_task(async function test_addLogin_metainfo_duplicate() {
|
|||
);
|
||||
|
||||
// Verify that no data was stored by the previous call.
|
||||
LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
await LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -231,7 +231,7 @@ add_task(function test_modifyLogin_nsIProperyBag_metainfo() {
|
|||
/**
|
||||
* Tests that modifying a login to a duplicate GUID throws an exception.
|
||||
*/
|
||||
add_task(function test_modifyLogin_nsIProperyBag_metainfo_duplicate() {
|
||||
add_task(async function test_modifyLogin_nsIProperyBag_metainfo_duplicate() {
|
||||
Assert.throws(
|
||||
() =>
|
||||
Services.logins.modifyLogin(
|
||||
|
@ -242,7 +242,7 @@ add_task(function test_modifyLogin_nsIProperyBag_metainfo_duplicate() {
|
|||
),
|
||||
/specified GUID already exists/
|
||||
);
|
||||
LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
await LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ add_task(function test_searchLogins_metainfo() {
|
|||
*/
|
||||
add_task(async function test_storage_metainfo() {
|
||||
await LoginTestUtils.reloadData();
|
||||
LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
await LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
|
||||
|
||||
assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo1), gLoginMetaInfo1);
|
||||
assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo2), gLoginMetaInfo2);
|
||||
|
|
|
@ -45,7 +45,7 @@ add_task(async function test_invalid_logins() {
|
|||
2
|
||||
)}`
|
||||
);
|
||||
let savedLogins = Services.logins.getAllLogins();
|
||||
let savedLogins = await Services.logins.getAllLogins();
|
||||
Assert.equal(
|
||||
savedLogins.length,
|
||||
0,
|
||||
|
@ -98,7 +98,7 @@ add_task(async function test_new_logins() {
|
|||
`There should also be 1 login for ${HOST2}`
|
||||
);
|
||||
Assert.equal(
|
||||
Services.logins.getAllLogins().length,
|
||||
(await Services.logins.getAllLogins()).length,
|
||||
2,
|
||||
"There should be 2 logins in total"
|
||||
);
|
||||
|
|
|
@ -97,7 +97,7 @@ add_task(async function test_import_tsv() {
|
|||
await LoginCSVImport.importFromCSV(tsvFilePath);
|
||||
assertHistogramTelemetry(histogram, 0, 1);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -137,7 +137,7 @@ add_task(async function test_import_tsv_with_missing_columns() {
|
|||
"Ensure missing username throws"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added without finding columns"
|
||||
);
|
||||
|
@ -159,7 +159,7 @@ add_task(async function test_import_lacking_username_column() {
|
|||
"Ensure missing username throws"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added without finding a username column"
|
||||
);
|
||||
|
@ -183,7 +183,7 @@ add_task(async function test_import_with_duplicate_fields() {
|
|||
"Check that the errorType is file format error"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added from a file with duplicated columns"
|
||||
);
|
||||
|
@ -204,7 +204,7 @@ add_task(async function test_import_with_duplicate_columns() {
|
|||
"Check that the errorType is file format error"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added from a file with duplicated columns"
|
||||
);
|
||||
|
@ -222,7 +222,7 @@ add_task(async function test_import_minimal_with_mixed_naming() {
|
|||
]);
|
||||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -258,7 +258,7 @@ add_task(async function test_import_from_firefox_various_latest() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(tmpFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
logins,
|
||||
"Check that all of LoginTestUtils.testData.loginList can be re-imported"
|
||||
);
|
||||
|
@ -275,7 +275,7 @@ add_task(async function test_import_from_firefox_auth() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -308,7 +308,7 @@ add_task(async function test_import_from_firefox_auth_with_quotes() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -340,7 +340,7 @@ add_task(async function test_import_from_firefox_auth_some_quoted_fields() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -372,7 +372,7 @@ add_task(async function test_import_from_firefox_form_empty_formActionOrigin() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -404,7 +404,7 @@ add_task(async function test_import_from_firefox_form_with_formActionOrigin() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "https://other.example.com",
|
||||
|
@ -438,7 +438,7 @@ add_task(async function test_import_from_bitwarden_csv() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -471,7 +471,7 @@ add_task(async function test_import_from_chrome_csv() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -503,7 +503,7 @@ add_task(async function test_import_login_without_username() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -536,7 +536,7 @@ add_task(async function test_import_from_keepassxc_csv() {
|
|||
|
||||
await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.formLogin({
|
||||
formActionOrigin: "",
|
||||
|
@ -596,7 +596,7 @@ add_task(async function test_import_summary_modified_login_without_guid() {
|
|||
"modified",
|
||||
`Check that the login was modified when there was no guid data`
|
||||
);
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -640,7 +640,7 @@ add_task(async function test_import_summary_modified_login_with_guid() {
|
|||
"modified",
|
||||
`Check that the login was modified when it had the same guid`
|
||||
);
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[
|
||||
TestData.authLogin({
|
||||
formActionOrigin: null,
|
||||
|
@ -732,7 +732,7 @@ add_task(async function test_import_summary_with_bad_format() {
|
|||
"Check that the errorType is file format error"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added with bad format"
|
||||
);
|
||||
|
@ -752,7 +752,7 @@ add_task(async function test_import_summary_with_non_csv_file() {
|
|||
"Check that the errorType is file format error"
|
||||
);
|
||||
|
||||
LoginTestUtils.checkLogins(
|
||||
await LoginTestUtils.checkLogins(
|
||||
[],
|
||||
"Check that no login was added with file of different format"
|
||||
);
|
||||
|
@ -768,10 +768,10 @@ add_task(async function test_import_summary_with_url_user_multiple_values() {
|
|||
"https://example.com,jane@example.com,password2,My realm",
|
||||
]);
|
||||
|
||||
let initialLoginCount = Services.logins.getAllLogins().length;
|
||||
let initialLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
let results = await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
let afterImportLoginCount = Services.logins.getAllLogins().length;
|
||||
let afterImportLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
equal(results.length, 2, `Check that we got a result for each imported row`);
|
||||
equal(results[0].result, "added", `Check that the first login was added`);
|
||||
|
@ -793,10 +793,10 @@ add_task(async function test_import_summary_with_duplicated_guid_values() {
|
|||
"https://example1.com,jane1@example.com,password1,My realm,,{5ec0d12f-e194-4279-ae1b-d7d281bb0004},1589617814635,1589710449871,1589617846802",
|
||||
"https://example2.com,jane2@example.com,password2,My realm,,{5ec0d12f-e194-4279-ae1b-d7d281bb0004},1589617814635,1589710449871,1589617846802",
|
||||
]);
|
||||
let initialLoginCount = Services.logins.getAllLogins().length;
|
||||
let initialLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
let results = await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
let afterImportLoginCount = Services.logins.getAllLogins().length;
|
||||
let afterImportLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
equal(results.length, 2, `Check that we got a result for each imported row`);
|
||||
equal(results[0].result, "added", `Check that the first login was added`);
|
||||
|
@ -814,10 +814,10 @@ add_task(async function test_import_summary_with_different_time_changed() {
|
|||
"https://example.com,eve@example.com,old password,1589617814635,1589710449800,1589617846800",
|
||||
"https://example.com,eve@example.com,new password,1589617814635,1589710449801,1589617846801",
|
||||
]);
|
||||
let initialLoginCount = Services.logins.getAllLogins().length;
|
||||
let initialLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
let results = await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
let afterImportLoginCount = Services.logins.getAllLogins().length;
|
||||
let afterImportLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
equal(results.length, 2, `Check that we got a result for each imported row`);
|
||||
equal(
|
||||
|
@ -848,10 +848,10 @@ add_task(async function test_import_duplicate_logins_as_one() {
|
|||
"somesite,https://example.com/,user@example.com,asdasd123123",
|
||||
"somesite,https://example.com/,user@example.com,asdasd123123",
|
||||
]);
|
||||
let initialLoginCount = Services.logins.getAllLogins().length;
|
||||
let initialLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
let results = await LoginCSVImport.importFromCSV(csvFilePath);
|
||||
let afterImportLoginCount = Services.logins.getAllLogins().length;
|
||||
let afterImportLoginCount = (await Services.logins.getAllLogins()).length;
|
||||
|
||||
equal(results.length, 2, `Check that we got a result for each imported row`);
|
||||
equal(
|
||||
|
|
|
@ -60,7 +60,7 @@ function exportAuthLogin(modifications) {
|
|||
|
||||
add_setup(async () => {
|
||||
let oldLogins = Services.logins;
|
||||
Services.logins = { getAllLoginsAsync: sinon.stub() };
|
||||
Services.logins = { getAllLogins: sinon.stub() };
|
||||
registerCleanupFunction(() => {
|
||||
Services.logins = oldLogins;
|
||||
});
|
||||
|
@ -120,7 +120,7 @@ add_task(async function test_no_new_properties_to_export() {
|
|||
|
||||
add_task(async function test_export_one_form_login() {
|
||||
let login = exportFormLogin();
|
||||
Services.logins.getAllLoginsAsync.returns([login]);
|
||||
Services.logins.getAllLogins.returns([login]);
|
||||
|
||||
let rows = await exportAsCSVInTmpFile();
|
||||
|
||||
|
@ -138,7 +138,7 @@ add_task(async function test_export_one_form_login() {
|
|||
|
||||
add_task(async function test_export_one_auth_login() {
|
||||
let login = exportAuthLogin();
|
||||
Services.logins.getAllLoginsAsync.returns([login]);
|
||||
Services.logins.getAllLogins.returns([login]);
|
||||
|
||||
let rows = await exportAsCSVInTmpFile();
|
||||
|
||||
|
@ -158,7 +158,7 @@ add_task(async function test_export_escapes_values() {
|
|||
let login = exportFormLogin({
|
||||
password: "!@#$%^&*()_+,'",
|
||||
});
|
||||
Services.logins.getAllLoginsAsync.returns([login]);
|
||||
Services.logins.getAllLogins.returns([login]);
|
||||
|
||||
let rows = await exportAsCSVInTmpFile();
|
||||
|
||||
|
@ -173,7 +173,7 @@ add_task(async function test_export_multiple_rows() {
|
|||
let logins = await LoginTestUtils.testData.loginList();
|
||||
// Note, because we're stubbing this method and avoiding the actual login manager logic,
|
||||
// login de-duplication does not occur
|
||||
Services.logins.getAllLoginsAsync.returns(logins);
|
||||
Services.logins.getAllLogins.returns(logins);
|
||||
|
||||
let actualRows = await exportAsCSVInTmpFile();
|
||||
let expectedRows = [
|
||||
|
|
|
@ -89,7 +89,7 @@ add_task(async function test_notifications() {
|
|||
expectedNotification = "addLogin";
|
||||
expectedData = testuser1;
|
||||
await Services.logins.addLoginAsync(testuser1);
|
||||
LoginTestUtils.checkLogins([testuser1]);
|
||||
await LoginTestUtils.checkLogins([testuser1]);
|
||||
Assert.equal(expectedNotification, null); // check that observer got a notification
|
||||
|
||||
/* ========== 3 ========== */
|
||||
|
@ -100,7 +100,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = [testuser1, testuser2];
|
||||
Services.logins.modifyLogin(testuser1, testuser2);
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([testuser2]);
|
||||
await LoginTestUtils.checkLogins([testuser2]);
|
||||
|
||||
/* ========== 4 ========== */
|
||||
testnum++;
|
||||
|
@ -110,7 +110,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = testuser2;
|
||||
Services.logins.removeLogin(testuser2);
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
/* ========== 5 ========== */
|
||||
testnum++;
|
||||
|
@ -120,7 +120,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = null;
|
||||
Services.logins.removeAllLogins();
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
/* ========== 6 ========== */
|
||||
testnum++;
|
||||
|
@ -134,7 +134,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = null;
|
||||
Services.logins.removeAllLogins();
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
/* ========== 7 ========== */
|
||||
testnum++;
|
||||
|
@ -170,7 +170,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = "http://site.com";
|
||||
Services.logins.setLoginSavingEnabled("http://site.com", true);
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
/* ========== 10 ========== */
|
||||
testnum++;
|
||||
|
@ -180,7 +180,7 @@ add_task(async function test_notifications() {
|
|||
expectedData = "http://site.com";
|
||||
Services.logins.setLoginSavingEnabled("http://site.com", true);
|
||||
Assert.equal(expectedNotification, null);
|
||||
LoginTestUtils.checkLogins([]);
|
||||
await LoginTestUtils.checkLogins([]);
|
||||
|
||||
Services.obs.removeObserver(TestObserver, "passwordmgr-storage-changed");
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
async function reloadAndCheckLoginsGen(aExpectedLogins) {
|
||||
await LoginTestUtils.reloadData();
|
||||
LoginTestUtils.checkLogins(aExpectedLogins);
|
||||
await LoginTestUtils.checkLogins(aExpectedLogins);
|
||||
LoginTestUtils.clearData();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче