diff --git a/dom/html/test/forms/test_set_range_text.html b/dom/html/test/forms/test_set_range_text.html
index 901f54bb83ad..f85014ae77a7 100644
--- a/dom/html/test/forms/test_set_range_text.html
+++ b/dom/html/test/forms/test_set_range_text.html
@@ -72,7 +72,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
elem.focus();
try {
elem.setRangeText("abc");
- expectedNumOfSelectCalls += 1;
} catch (ex) {
opThrows = true;
}
@@ -100,7 +99,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.selectionEnd, 4, msg + test);
elem.setRangeText("mnk");
is(elem.value, "0mnk6789ABCDEF", msg + test);
- expectedNumOfSelectCalls += 3;
+ expectedNumOfSelectCalls += 2;
test = " setRange(replacement), expand";
elem.value = "0123456789ABCDEF";
@@ -111,7 +110,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.selectionEnd, 4, msg + test);
elem.setRangeText("mnk");
is(elem.value, "0mnk23456789ABCDEF", msg + test);
- expectedNumOfSelectCalls += 3;
+ expectedNumOfSelectCalls += 2;
test = " setRange(replacement) pure insertion at start";
elem.value = "0123456789ABCDEF";
@@ -122,7 +121,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.selectionEnd, 0, msg + test);
elem.setRangeText("mnk");
is(elem.value, "mnkxyz0123456789ABCDEF", msg + test);
- expectedNumOfSelectCalls += 3;
+ expectedNumOfSelectCalls += 1;
test = " setRange(replacement) pure insertion in the middle";
elem.value = "0123456789ABCDEF";
@@ -133,7 +132,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.selectionEnd, 4, msg + test);
elem.setRangeText("mnk");
is(elem.value, "0123mnkxyz456789ABCDEF", msg + test);
- expectedNumOfSelectCalls += 3;
+ expectedNumOfSelectCalls += 1;
test = " setRange(replacement) pure insertion at the end";
elem.value = "0123456789ABCDEF";
@@ -144,7 +143,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.selectionEnd, 16, msg + test);
elem.setRangeText("mnk");
is(elem.value, "0123456789ABCDEFmnkxyz", msg + test);
- expectedNumOfSelectCalls += 3;
//test SetRange(replacement, start, end, mode) with start > end
try {
@@ -205,7 +203,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=850364
is(elem.value, "0Z23456789", msg + ".value == \"0Z23456789\"");
is(elem.selectionStart, 6, msg + ".selectionStart == 6, with \"preserve\"");
is(elem.selectionEnd, 9, msg + ".selectionEnd == 9, with \"preserve\"");
- expectedNumOfSelectCalls += 2;
+ expectedNumOfSelectCalls += 1;
//subcase: selection{Start|End} < end
elem.value = "0123456789";
diff --git a/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini b/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini
deleted file mode 100644
index f9740bce32a6..000000000000
--- a/testing/web-platform/meta/html/semantics/forms/textfieldselection/select-event.html.ini
+++ /dev/null
@@ -1,163 +0,0 @@
-[select-event.html]
- [textarea: select() a second time (must not fire select)]
- expected: FAIL
-
- [textarea: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [textarea: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [textarea: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [textarea: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [textarea: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [input type text: select() a second time (must not fire select)]
- expected: FAIL
-
- [input type text: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [input type text: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [input type text: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [input type text: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [input type text: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [input type search: select() a second time (must not fire select)]
- expected: FAIL
-
- [input type search: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [input type search: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [input type search: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [input type search: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [input type search: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: select() a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [input type url: select() a second time (must not fire select)]
- expected: FAIL
-
- [input type url: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [input type url: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [input type url: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [input type url: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [input type url: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [input type password: select() a second time (must not fire select)]
- expected: FAIL
-
- [input type password: selectionStart a second time (must not fire select)]
- expected: FAIL
-
- [input type password: selectionEnd a second time (must not fire select)]
- expected: FAIL
-
- [input type password: selectionDirection a second time (must not fire select)]
- expected: FAIL
-
- [input type password: setSelectionRange() a second time (must not fire select)]
- expected: FAIL
-
- [input type password: setRangeText() a second time (must not fire select)]
- expected: FAIL
-
- [textarea: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [textarea: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [textarea: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type text: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type text: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type text: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type search: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type search: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type search: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type tel: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type url: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type url: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type url: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type password: selectionStart out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type password: selectionEnd out of range a second time (must not fire select)]
- expected: FAIL
-
- [input type password: setSelectionRange out of range a second time (must not fire select)]
- expected: FAIL
-
diff --git a/testing/web-platform/tests/html/semantics/forms/textfieldselection/select-event.html b/testing/web-platform/tests/html/semantics/forms/textfieldselection/select-event.html
index 09626a5a5cef..cb54b64592e1 100644
--- a/testing/web-platform/tests/html/semantics/forms/textfieldselection/select-event.html
+++ b/testing/web-platform/tests/html/semantics/forms/textfieldselection/select-event.html
@@ -59,10 +59,12 @@ const actions = [
}
];
-function initialize(el) {
- el.value = "foobar";
- el.setSelectionRange(0, 0);
- return new Promise(requestAnimationFrame);
+ function initialize(el, t) {
+ el.setRangeText("foobar", 0, el.value.length, "start");
+ // Make sure to flush async dispatches
+ return new Promise(resolve => {
+ t.step_timeout(resolve, 200);
+ });
}
els.forEach((el) => {
@@ -72,7 +74,7 @@ els.forEach((el) => {
// promise_test instead of async_test is important because these need to happen in sequence (to test that events
// fire if and only if the selection changes).
promise_test(async t => {
- await initialize(el);
+ await initialize(el, t);
const watcher = new EventWatcher(t, el, "select");