michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: 'use strict'; michael@0: michael@0: const { Trait } = require('../deprecated/traits'); michael@0: const { isWindowPrivate, getWindowTitle } = require('../window/utils'); michael@0: const { deprecateUsage } = require('../util/deprecate'); michael@0: michael@0: module.metadata = { michael@0: "stability": "unstable" michael@0: }; michael@0: michael@0: const WindowDom = Trait.compose({ michael@0: _window: Trait.required, michael@0: get title() { michael@0: return getWindowTitle(this._window); michael@0: }, michael@0: close: function close() { michael@0: let window = this._window; michael@0: if (window) window.close(); michael@0: return this._public; michael@0: }, michael@0: activate: function activate() { michael@0: let window = this._window; michael@0: if (window) window.focus(); michael@0: return this._public; michael@0: }, michael@0: get isPrivateBrowsing() { michael@0: deprecateUsage('`browserWindow.isPrivateBrowsing` is deprecated, please ' + michael@0: 'consider using ' + michael@0: '`require("sdk/private-browsing").isPrivate(browserWindow)` ' + michael@0: 'instead.'); michael@0: return isWindowPrivate(this._window); michael@0: } michael@0: }); michael@0: exports.WindowDom = WindowDom;