blob: ad76e5479c2aa235a7e8c72819b2f4de2b474425 (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
const { FormHistoryTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/FormHistoryTestUtils.sys.mjs"
);
const usernameFieldName = "user";
async function cleanup() {
Services.prefs.clearUserPref("signon.rememberSignons");
Services.logins.removeAllLogins();
await FormHistoryTestUtils.clear(usernameFieldName);
}
add_setup(async function () {
await cleanup();
});
add_task(
async function test_username_not_saved_in_form_history_when_password_manager_enabled() {
Services.prefs.setBoolPref("signon.rememberSignons", true);
await testSubmittingLoginFormHTTP(
"subtst_notifications_1.html",
async () => {
const notif = await getCaptureDoorhangerThatMayOpen("password-save");
await clickDoorhangerButton(notif, REMEMBER_BUTTON);
}
);
const loginEntries = Services.logins.getAllLogins().length;
const historyEntries = await FormHistoryTestUtils.count(usernameFieldName);
Assert.equal(
loginEntries,
1,
"Username should be saved in password manager"
);
Assert.equal(
historyEntries,
0,
"Username should not be saved in form history"
);
await cleanup();
}
);
add_task(
async function test_username_saved_in_form_history_when_password_manager_disabled() {
Services.prefs.setBoolPref("signon.rememberSignons", false);
await testSubmittingLoginFormHTTP("subtst_notifications_1.html");
const loginEntries = Services.logins.getAllLogins().length;
const historyEntries = await FormHistoryTestUtils.count(usernameFieldName);
Assert.equal(
loginEntries,
0,
"Username should not be saved in password manager"
);
Assert.equal(historyEntries, 1, "Username should be saved in form history");
await cleanup();
}
);
|