Backed out changeset 5936869f553d (bug 1753588) for causing failures on test_basic_form_honor_autocomplete_off.html. CLOSED TREE

This commit is contained in:
criss 2022-02-11 12:13:35 +02:00
parent 8ceed704c6
commit 369ae61fb6
9 changed files with 13 additions and 124 deletions

View File

@ -3647,7 +3647,6 @@ pref("signon.passwordEditCapture.enabled", false);
pref("signon.privateBrowsingCapture.enabled", true);
pref("signon.storeWhenAutocompleteOff", true);
pref("signon.userInputRequiredToCapture.enabled", true);
pref("signon.usernameOnlyForm.lookupThreshold", 5);
pref("signon.debug", false);
pref("signon.recipes.path", "resource://app/defaults/settings/main/password-recipes.json");
pref("signon.recipes.remoteRecipes.enabled", true);

View File

@ -477,9 +477,6 @@ this.LoginHelper = {
this.usernameOnlyFormEnabled = Services.prefs.getBoolPref(
"signon.usernameOnlyForm.enabled"
);
this.usernameOnlyFormLookupThreshold = Services.prefs.getIntPref(
"signon.usernameOnlyForm.lookupThreshold"
);
this.remoteRecipesEnabled = Services.prefs.getBoolPref(
"signon.recipes.remoteRecipes.enabled"
);

View File

@ -1020,15 +1020,6 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
.getHistogramById("PWMGR_NUM_FORM_HAS_POSSIBLE_USERNAME_EVENT_PER_DOC")
.add(++docState.numFormHasPossibleUsernameEvent);
// Infer whether a form is a username-only form is expensive, so we restrict the
// number of form looked up per document.
if (
docState.numFormHasPossibleUsernameEvent >
LoginHelper.usernameOnlyFormLookupThreshold
) {
return;
}
if (document.visibilityState == "visible" || isMasterPasswordSet) {
this._processDOMFormHasPossibleUsernameEvent(event);
} else {
@ -3140,6 +3131,11 @@ this.LoginManagerChild = class LoginManagerChild extends JSWindowActorChild {
let candidate = null;
for (let element of formElement.elements) {
// Only care input fields in the form.
if (ChromeUtils.getClassName(element) !== "HTMLInputElement") {
continue;
}
// We are looking for a username-only form, so if there is a password
// field in the form, this is NOT a username-only form.
if (element.hasBeenTypePassword) {

View File

@ -71,11 +71,9 @@ async function checkChildHistogram(id, index, expected) {
}
add_task(async function setup() {
SpecialPowers.pushPrefEnv({
set: [
["signon.usernameOnlyForm.enabled", true],
["signon.usernameOnlyForm.lookupThreshold", 100], // ignore the threshold in test
],
Services.prefs.setBoolPref("signon.usernameOnlyForm.enabled", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("signon.usernameOnlyForm.enabled");
});
// Wait 1sec to make sure all the telemetry data recorded prior to the beginning of the

View File

@ -134,7 +134,6 @@ scheme = https
skip-if = toolkit == 'android'
[test_autofill_password-only.html]
[test_autofill_username-only.html]
[test_autofill_username-only_threshold.html]
[test_autofocus_js.html]
scheme = https
skip-if = toolkit == 'android' # autocomplete

View File

@ -16,12 +16,7 @@ Login Manager test: multiple login autocomplete
var chromeScript = runChecksAfterCommonInit();
// Temporarily allow use of eval() in this test.
SpecialPowers.pushPrefEnv({
"set": [
["security.allow_eval_with_system_principal", true],
["signon.usernameOnlyForm.lookupThreshold", 100], // ignore the threshold in test
]
});
SpecialPowers.pushPrefEnv({"set": [["security.allow_eval_with_system_principal", true]]});
function addLoginsInParent(...aLogins) {
let script = runInParent(function addLoginsInParentInner() {

View File

@ -18,12 +18,6 @@ addLoginsInParent(
[DEFAULT_ORIGIN, "https://autofill", null, "user1", "pass1"]);
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({
"set": [
["signon.usernameOnlyForm.lookupThreshold", 100], // ignore threshold in test
]
});
ok(readyPromise, "check promise is available");
await readyPromise;
});

View File

@ -1,88 +0,0 @@
<!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>
let readyPromise = registerRunTests();
let DEFAULT_ORIGIN = window.location.origin;
addLoginsInParent(
[DEFAULT_ORIGIN, "https://autofill", null, "user1", "pass1"]);
add_task(async function setup() {
await SpecialPowers.pushPrefEnv({"set": [["signon.usernameOnlyForm.lookupThreshold", 5]]});
ok(readyPromise, "check promise is available");
await readyPromise;
});
add_task(async function test_autofill_username_only_form() {
let win = window.open("about:blank");
SimpleTest.registerCleanupFunction(() => win.close());
await loadFormIntoWindow(DEFAULT_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);
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>
</pre>
</body>
</html>

View File

@ -66,11 +66,10 @@ addLoginsInParent(
let {ContentTaskUtils} = SpecialPowers.Cu.import("resource://testing-common/ContentTaskUtils.jsm", {});
// Set the pref before the document loads.
SpecialPowers.pushPrefEnv({
"set": [
["signon.autofillForms.autocompleteOff", false],
["signon.usernameOnlyForm.lookupThreshold", 100], // ignore the threshold in test
]
SpecialPowers.setBoolPref("signon.autofillForms.autocompleteOff", false);
SimpleTest.registerCleanupFunction(() => {
SpecialPowers.clearUserPref("signon.autofillForms.autocompleteOff");
});
// Check for expected username/password in form.