blob: b0798b90312069ba307826d80e84568fae072881 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This is a JavaScript module (JSM) to be imported via
ChromeUtils.import() and acts as a singleton.
Only the following listed symbols will exposed on import, and only when
and where imported. */
export var BrowserWindows = {
/**
* Add
*
* Opens a new window. Throws on error.
*
* @param aPrivate The private option.
* @return nothing
*/
Add(aPrivate, fn) {
return new Promise(resolve => {
let mainWindow = Services.wm.getMostRecentWindow("navigator:browser");
let win = mainWindow.OpenBrowserWindow({ private: aPrivate });
win.addEventListener(
"load",
function () {
resolve(win);
},
{ once: true }
);
});
},
};
|