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
66
67
68
69
|
"use strict";
/**
* Ensures that <input>s that are/were type=password are not saved.
*/
addCoopTask("file_formdata_password.html", test_hasBeenTypePassword, HTTPSROOT);
addNonCoopTask(
"file_formdata_password.html",
test_hasBeenTypePassword,
HTTPROOT
);
addNonCoopTask(
"file_formdata_password.html",
test_hasBeenTypePassword,
HTTPSROOT
);
async function test_hasBeenTypePassword(aURL) {
let tab = BrowserTestUtils.addTab(gBrowser, aURL);
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
await SpecialPowers.spawn(browser, [], async function fillFields() {
let doc = content.document;
doc.getElementById("TextValue").setUserInput("abc");
doc.getElementById("TextValuePassword").setUserInput("def");
doc.getElementById("TextValuePassword").type = "password";
doc.getElementById("TextPasswordValue").type = "password";
doc.getElementById("TextPasswordValue").setUserInput("ghi");
doc.getElementById("PasswordValueText").setUserInput("jkl");
doc.getElementById("PasswordValueText").type = "text";
doc.getElementById("PasswordTextValue").type = "text";
doc.getElementById("PasswordTextValue").setUserInput("mno");
doc.getElementById("PasswordValue").setUserInput("pqr");
});
// Remove the tab.
await promiseRemoveTabAndSessionState(tab);
let [
{
state: { formdata },
},
] = ss.getClosedTabDataForWindow(window);
let expected = [
["TextValue", "abc"],
["TextValuePassword", undefined],
["TextPasswordValue", undefined],
["PasswordValueText", undefined],
["PasswordTextValue", undefined],
["PasswordValue", undefined],
];
for (let [id, expectedValue] of expected) {
is(
formdata.id[id],
expectedValue,
`Value should be ${expectedValue} for ${id}`
);
}
}
|