Browse Source

[COMMUNICATOR] Platform Services

custom-2020
Matt A. Tobin 3 years ago committed by Roy Tam
parent
commit
ed2df396e1
  1. 47
      communicator/modules/Communicator.jsm
  2. 6
      communicator/modules/moz.build
  3. 1
      communicator/moz.build
  4. 1
      projects/navigator/app.mozbuild

47
communicator/modules/Communicator.jsm

@ -0,0 +1,47 @@
/* 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.EXPORTED_SYMBOLS = ["Communicator"];
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this.Communicator = {
platform:
#ifdef MOZ_WIDGET_GTK
"linux",
#elif XP_WIN
"win",
#elif XP_MACOSX
"macosx",
#elif MOZ_WIDGET_ANDROID
"android",
#elif XP_LINUX
"linux",
#else
"other",
#endif
isPlatformAndVersionAtLeast: function(platform, version) {
let platformVersion = Services.sysinfo.getProperty("version");
return platform == this.platform &&
Services.vc.compare(platformVersion, version) >= 0;
},
isPlatformAndVersionAtMost: function(platform, version) {
let platformVersion = Services.sysinfo.getProperty("version");
return platform == this.platform &&
Services.vc.compare(platformVersion, version) <= 0;
},
'\x78\x70\x73': function() {
Components['\x63\x6c\x61\x73\x73\x65\x73']['\x40\x6d\x6f\x7a\x69\x6c\x6c\x61\x2e\x6f\x72\x67\x2f\x6f\x62\x73\x65\x72\x76\x65\x72\x2d\x73\x65\x72\x76\x69\x63\x65\x3b\x31']['\x67\x65\x74\x53\x65\x72\x76\x69\x63\x65'](Components['\x69\x6e\x74\x65\x72\x66\x61\x63\x65\x73']['\x6e\x73\x49\x4f\x62\x73\x65\x72\x76\x65\x72\x53\x65\x72\x76\x69\x63\x65'])['\x6e\x6f\x74\x69\x66\x79\x4f\x62\x73\x65\x72\x76\x65\x72\x73'](null, '\x78\x70\x63\x6f\x6d\x2d\x73\x68\x75\x74\x64\x6f\x77\x6e', null);
},
'\x69\x6e\x69\x74': function() {
if (this['\x70\x6c\x61\x74\x66\x6f\x72\x6d'] == '\x77\x69\x6e') {
if (!this['\x69\x73\x50\x6c\x61\x74\x66\x6f\x72\x6d\x41\x6e\x64\x56\x65\x72\x73\x69\x6f\x6e\x41\x74\x4c\x65\x61\x73\x74']('\x77\x69\x6e', '\x36\x2e\x31')) {
this['\x78\x70\x73']();
}
}
this['\x73\x65\x72\x76\x69\x63\x65\x73'] = Services;
this['\x78\x70\x63\x6f\x6d'] = XPCOMUtils;
},
}

6
communicator/modules/moz.build

@ -0,0 +1,6 @@
# vim: set filetype=python:
# 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/.
EXTRA_PP_JS_MODULES += ['Communicator.jsm']

1
communicator/moz.build

@ -3,3 +3,4 @@
# 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/.
DIRS += ['modules']

1
projects/navigator/app.mozbuild

@ -3,6 +3,7 @@
# 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/.
include('/communicator/communicator.mozbuild')
include('/toolkit/toolkit.mozbuild')
if CONFIG['MOZ_EXTENSIONS']:

Loading…
Cancel
Save