addon-sdk/source/lib/sdk/windows/dom.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/addon-sdk/source/lib/sdk/windows/dom.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +'use strict';
     1.8 +
     1.9 +const { Trait } = require('../deprecated/traits');
    1.10 +const { isWindowPrivate, getWindowTitle } = require('../window/utils');
    1.11 +const { deprecateUsage } = require('../util/deprecate');
    1.12 +
    1.13 +module.metadata = {
    1.14 +  "stability": "unstable"
    1.15 +};
    1.16 +
    1.17 +const WindowDom = Trait.compose({
    1.18 +  _window: Trait.required,
    1.19 +  get title() {
    1.20 +    return getWindowTitle(this._window);
    1.21 +  },
    1.22 +  close: function close() {
    1.23 +    let window = this._window;
    1.24 +    if (window) window.close();
    1.25 +    return this._public;
    1.26 +  },
    1.27 +  activate: function activate() {
    1.28 +    let window = this._window;
    1.29 +    if (window) window.focus();
    1.30 +    return this._public;
    1.31 +  },
    1.32 +  get isPrivateBrowsing() {
    1.33 +    deprecateUsage('`browserWindow.isPrivateBrowsing` is deprecated, please ' +
    1.34 +                   'consider using ' +
    1.35 +                   '`require("sdk/private-browsing").isPrivate(browserWindow)` ' +
    1.36 +                   'instead.');
    1.37 +    return isWindowPrivate(this._window);
    1.38 +  }
    1.39 +});
    1.40 +exports.WindowDom = WindowDom;

mercurial