Bug 1643333: part 3) Change `IsInvisibleNodeAndShouldBeSkipped` to static method...
[gecko.git] / remote / WindowManager.jsm
blobc22feee36f15e1d41e97a62a69aec47abb2cdbb7
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 var EXPORTED_SYMBOLS = ["WindowManager"];
9 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
10 const { EventPromise } = ChromeUtils.import("chrome://remote/content/Sync.jsm");
12 var WindowManager = {
13   async focus(window) {
14     if (window != Services.focus.activeWindow) {
15       const promises = [
16         EventPromise(window, "activate"),
17         EventPromise(window, "focus", { capture: true }),
18       ];
20       window.focus();
22       await Promise.all(promises);
23     }
24   },