forked from mirrors/gecko-dev
Now, callers of EventUtils.synthesizeKey() don't need to specify KeyboardEvent.code value anymore if they assume that active keyboard layout is US keyboard layout. Note that this patch changes the meaning of only test_bug551434.html. Some callers in it don't match the key value and code value but that looks like that they don't checking such odd keyboard events. So, they must be bug of the test. MozReview-Commit-ID: Itxo7yZ9rkK --HG-- extra : rebase_source : 856ef3715c924ca16e993ea57d92d1243b5cc6be
17 lines
661 B
JavaScript
17 lines
661 B
JavaScript
function hideSelectPopup(selectPopup, mode = "enter", win = window) {
|
|
let browser = win.gBrowser.selectedBrowser;
|
|
let selectClosedPromise = ContentTask.spawn(browser, null, async function() {
|
|
ChromeUtils.import("resource://gre/modules/SelectContentHelper.jsm");
|
|
return ContentTaskUtils.waitForCondition(() => !SelectContentHelper.open);
|
|
});
|
|
|
|
if (mode == "escape") {
|
|
EventUtils.synthesizeKey("KEY_Escape", {}, win);
|
|
} else if (mode == "enter") {
|
|
EventUtils.synthesizeKey("KEY_Enter", {}, win);
|
|
} else if (mode == "click") {
|
|
EventUtils.synthesizeMouseAtCenter(selectPopup.lastChild, { }, win);
|
|
}
|
|
|
|
return selectClosedPromise;
|
|
}
|