Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: toolkit/components/passwordmgr/test/mochitest/mochitest.toml
<!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(
);
});
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 -->
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<input type='text' name='uname' autocomplete='username' value=''>
<button type='submit'>Submit</button>
<button type='reset'> Reset </button>
</form>
<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>