Bug 1436248 - Don't use selectionchange event in browser-chrome test since it's not standardized yet whether it should be fired on <input> and <textarea> r?enndeakin+6102
In current draft, selectionchange event should be fired when Selection is
changed in Document. However, selection of <input> and <textarea> is different
from Selection in web standards (although our implementation uses Selection).
So, we should check it with SimpleText.executeSoon() for now since it might
be possible that selectionchange event in <input> and <textarea> would be
removed completely.
MozReview-Commit-ID: APvMwbysDzs
--- a/dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
+++ b/dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
@@ -41,22 +41,27 @@ add_task(async function() {
gURLBar.inputField.selectionEnd === gURLBar.inputField.value.length;
}
if (isAllTextSelected()) {
ok(true, "All text of the URL bar is already selected");
isnot(gURLBar.inputField.value, "", "The URL bar should have non-empty text");
resolve();
return;
}
- info("Waiting selectionchange event...");
- gURLBar.addEventListener("selectionchange", () => {
- ok(isAllTextSelected(), "All text of the URL bar should be selected");
+ info("Waiting selection changes...");
+ function tryToCheckItLater() {
+ if (!isAllTextSelected()) {
+ SimpleTest.executeSoon(tryToCheckItLater);
+ return;
+ }
+ ok(true, "All text of the URL bar should be selected");
isnot(gURLBar.inputField.value, "", "The URL bar should have non-empty text");
resolve();
- }, {once: true});
+ }
+ SimpleTest.executeSoon(tryToCheckItLater);
});
}
// Alt + D is a shortcut key to move focus to the URL bar and selects its text.
info("Pressing Alt + D in the search bar...");
EventUtils.synthesizeKey("d", {code: "KeyD", altKey: true});
await promiseURLBarHasFocus();