blob: b3250b9676e245623e11b466e5994921da66e2c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_setup(async () => {
await Services.logins.initializationPromise;
});
add_task(async function test_vulnerable_password_methods() {
const storageJSON = Services.logins.wrappedJSObject._storage.wrappedJSObject;
const logins = TestData.loginList();
Assert.greater(logins.length, 0, "Initial logins length should be > 0.");
for (const loginInfo of logins) {
await Services.logins.addLoginAsync(loginInfo);
Assert.ok(
!storageJSON.isPotentiallyVulnerablePassword(loginInfo),
"No logins should be vulnerable until addVulnerablePasswords is called."
);
}
const vulnerableLogin = logins.shift();
storageJSON.addPotentiallyVulnerablePassword(vulnerableLogin);
Assert.ok(
storageJSON.isPotentiallyVulnerablePassword(vulnerableLogin),
"Login should be vulnerable after calling addVulnerablePassword."
);
for (const loginInfo of logins) {
Assert.ok(
!storageJSON.isPotentiallyVulnerablePassword(loginInfo),
"No other logins should be vulnerable when addVulnerablePassword is called" +
" with a single argument"
);
}
storageJSON.clearAllPotentiallyVulnerablePasswords();
for (const loginInfo of logins) {
Assert.ok(
!storageJSON.isPotentiallyVulnerablePassword(loginInfo),
"No logins should be vulnerable when clearAllPotentiallyVulnerablePasswords is called."
);
}
});
|