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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test autofill on username-form when the number of form exceeds the lookup threshold</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="pwmgr_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
Test not autofill on username-form when the number of form exceeds the lookup threshold
<script>
add_setup(async () => {
await SpecialPowers.pushPrefEnv({"set": [["signon.usernameOnlyForm.lookupThreshold", 5]]});
await setStoredLoginsAsync(
[window.location.origin, "https://autofill", null, "user1", "pass1"]
);
});
add_task(async function test_autofill_username_only_form() {
const win = window.open("about:blank");
SimpleTest.registerCleanupFunction(() => win.close());
await loadFormIntoWindow(window.location.origin, `
<!-- no password field, 1 username field -->
<form id='form1' action='https://autofill'> 1
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<form id='form2' action='https://autofill'> 2
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<form id='form3' action='https://autofill'> 3
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<form id='form4' action='https://autofill'> 4
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<form id='form5' action='https://autofill'> 5
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<form id='form6' action='https://autofill'> 6
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>`, win, 5);
await checkLoginFormInFrameWithElementValues(win, 1, "user1");
await checkLoginFormInFrameWithElementValues(win, 2, "user1");
await checkLoginFormInFrameWithElementValues(win, 3, "user1");
await checkLoginFormInFrameWithElementValues(win, 4, "user1");
await checkLoginFormInFrameWithElementValues(win, 5, "user1");
await checkUnmodifiedFormInFrame(win, 6);
});
</script>
<p id="display"></p>
<div id="content"></div>
<pre id="test"></pre>
</body>
</html>
|