addon-sdk/source/lib/sdk/windows.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.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     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 +module.metadata = {
    1.10 +  'stability': 'stable',
    1.11 +  'engines': {
    1.12 +    'Firefox': '*',
    1.13 +    'Fennec': '*'
    1.14 +  }
    1.15 +};
    1.16 +
    1.17 +const { isBrowser } = require('./window/utils');
    1.18 +const { modelFor } = require('./model/core');
    1.19 +const { viewFor } = require('./view/core');
    1.20 +
    1.21 +
    1.22 +if (require('./system/xul-app').is('Fennec')) {
    1.23 +  module.exports = require('./windows/fennec');
    1.24 +}
    1.25 +else {
    1.26 +  module.exports = require('./windows/firefox');
    1.27 +}
    1.28 +
    1.29 +
    1.30 +const browsers = module.exports.browserWindows;
    1.31 +
    1.32 +//
    1.33 +modelFor.when(isBrowser, view => {
    1.34 +  for (let model of browsers) {
    1.35 +    if (viewFor(model) === view)
    1.36 +      return model;
    1.37 +  }
    1.38 +  return null;
    1.39 +});

mercurial