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+6102 a=lizzard
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 07 Feb 2018 14:44:09 +0900
changeset 454826 b76b1af27cc15b15a9b53a371eb33f27fc3859b0
parent 454825 30d165841f3da737624edb48dbfe87442c916f96
child 454827 bec50ba1fb12aebde4e4065b2799bc730bc30010
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, lizzard
bugs1436248
milestone59.0
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+6102 a=lizzard 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
dom/events/test/browser_shortcutkey_modifier_conflicts_with_content_accesskey_modifier.js
--- 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();