Backed out 3 changesets (bug 1767250) for causing mochitest plain failures in toolkit/components/satchel/test/test_datalist_attribute_change.html CLOSED TREE

Backed out changeset a0b66549fddc (bug 1767250)
Backed out changeset 0b5f5360e3d5 (bug 1767250)
Backed out changeset 801266de7621 (bug 1767250)
This commit is contained in:
Sandor Molnar 2022-08-24 21:36:58 +03:00
Родитель e1b70bb8ce
Коммит 817282d774
3 изменённых файлов: 2 добавлений и 80 удалений

Просмотреть файл

@ -144,17 +144,6 @@ void nsFormFillController::AttributeChanged(mozilla::dom::Element* aElement,
aAttribute == nsGkAtoms::autocomplete) &&
aNameSpaceID == kNameSpaceID_None) {
RefPtr<HTMLInputElement> focusedInput(mFocusedInput);
// When the type prop changes the older element is already in a focused
// state. To be able to refresh the styles we reset focus. This way we are
// able to change focus UI styles of the element if necessary.
RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager();
if (fm && aAttribute == nsGkAtoms::type) {
nsCOMPtr<nsPIDOMWindowOuter> outerWindow =
aElement->OwnerDoc()->GetWindow();
fm->ClearFocus(outerWindow);
fm->SetFocus(focusedInput, 0);
}
// Reset the current state of the controller, unconditionally.
StopControllingInput();
// Then restart based on the new values. We have to delay this
@ -1013,18 +1002,14 @@ void nsFormFillController::MaybeStartControllingInput(
return;
}
bool hasList = !!aInput->GetList();
if (!IsTextControl(aInput)) {
// Even if this is not a text control yet, it can become one in the future
if (hasList) {
StartControllingInput(aInput);
}
return;
}
bool autocomplete = nsContentUtils::IsAutocompleteEnabled(aInput);
bool hasList = !!aInput->GetList();
bool isPwmgrInput = false;
if (mPwmgrInputs.Get(aInput) || aInput->HasBeenTypePassword()) {
isPwmgrInput = true;

Просмотреть файл

@ -14,7 +14,6 @@ support-files =
[test_datalist_with_caching.html]
[test_datalist_readonly_change.html]
[test_datalist_shadow_dom.html]
[test_datalist_attribute_change.html]
[test_form_autocomplete.html]
skip-if = (verify && debug && (os == 'win')) || (os == 'mac') # Bug 1514249
[test_form_autocomplete_validation_at_input_event.html]

Просмотреть файл

@ -1,62 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Form History / Attribute change with datalist entries: Bug 1767250</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="satchel_common.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<div id="content">
<form>
<input list="suggest" type="button" name="input" id="input" />
<datalist id="suggest">
<option value="Mozilla">
<option value="Firefox">
<option value="Thunderbird">
</datalist>
</form>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
const { TestUtils } = SpecialPowers.ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
);
const input = document.getElementById("input");
add_task(async function test_dropdown_shown_when_type_attribute_changed() {
input.addEventListener("click", () => input.setAttribute("type", "text"));
is(input.type, "button", "Input type is initially button.");
synthesizeMouse(input, 0, 0, {button: input, type: "mousedown"});
synthesizeMouse(input, 0, 0, {button: input, type: "mouseup"});
is(input.type, "text", "Input type changed from button to text.");
is(document.activeElement, input, "Text input is focused.");
// In the course of fixing Bug 1767250, we discovered that the focus ring was not shown although the element was focused.
// This is a regression test to ensure that the focus ring is shown when the type attribute is changed.
ok(input.matches(":focus-visible"), "Outer focus ring is shown.");
// We should wait until the next tick/frame, otherwise the popup is not shown.
await TestUtils.waitForTick();
const promisePopupShown = promiseACShown();
synthesizeKey("KEY_ArrowDown");
await promisePopupShown;
isDeeply(getMenuEntries(), ["Mozilla", "Firefox", "Thunderbird"], "Datalist shown after changing input type from button to text.");
input.removeEventListener("click", () => input.setAttribute("type", "text"));
});
</script>
</pre>
</body>
</html>