index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. 'use strict';
  5. let { Test } = require('./Test.jsm');
  6. let { Test: Test2 } = require('./Test.jsm');
  7. exports.localJSM = Test.square(16) === 256;
  8. exports.localJSMCached = Test === Test2;
  9. (function () {
  10. let { Promise } = require('resource://gre/modules/Promise.jsm');
  11. let { defer } = require('resource://gre/modules/Promise.jsm').Promise;
  12. exports.isCachedAbsolute = Promise.defer === defer;
  13. exports.isLoadedAbsolute = function (val) {
  14. let { promise, resolve } = Promise.defer();
  15. resolve(val);
  16. return promise;
  17. };
  18. })();
  19. (function () {
  20. let { Promise } = require('modules/Promise.jsm');
  21. let { defer } = require('modules/Promise.jsm').Promise;
  22. exports.isCachedPath = Promise.defer === defer;
  23. exports.isLoadedPath = function (val) {
  24. let { promise, resolve } = Promise.defer();
  25. resolve(val);
  26. return promise;
  27. };
  28. })();
  29. (function () {
  30. let { defer } = require('resource://gre/modules/commonjs/sdk/core/promise.js');
  31. let { defer: defer2 } = require('resource://gre/modules/commonjs/sdk/core/promise.js');
  32. exports.isCachedJSAbsolute = defer === defer2;
  33. exports.isLoadedJSAbsolute = function (val) {
  34. let { promise, resolve } = defer();
  35. resolve(val);
  36. return promise;
  37. };
  38. })();