blob: ac2b86b059b63ccb1a27076fafce8a872c1783d9 (
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
33
|
/* 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/. */
'use strict';
const { Trait } = require('../deprecated/traits');
const { getWindowTitle } = require('../window/utils');
const { getMode } = require('../private-browsing/utils');
module.metadata = {
"stability": "unstable"
};
const WindowDom = Trait.compose({
_window: Trait.required,
get title() {
return getWindowTitle(this._window);
},
close: function close() {
let window = this._window;
if (window) window.close();
return this._public;
},
activate: function activate() {
let window = this._window;
if (window) window.focus();
return this._public;
},
get isPrivateBrowsing() {
return getMode(this._window);
}
});
exports.WindowDom = WindowDom;
|