forked from mirrors/gecko-dev
This is a follow up to Bug 1482667. The list of callers was gathered by instrumenting the webidl calls to these methods and dumping JS stack when they are called in browser.xul. Differential Revision: https://phabricator.services.mozilla.com/D5185 --HG-- extra : moz-landing-system : lando
18 lines
697 B
JavaScript
18 lines
697 B
JavaScript
function hideSelectPopup(selectPopup, mode = "enter", win = window) {
|
|
let browser = win.gBrowser.selectedBrowser;
|
|
let selectClosedPromise = ContentTask.spawn(browser, null, async function() {
|
|
let {SelectContentHelper} =
|
|
ChromeUtils.import("resource://gre/actors/SelectChild.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.lastElementChild, { }, win);
|
|
}
|
|
|
|
return selectClosedPromise;
|
|
}
|