Bug 793928: Switch users of the promise library to the new location and move tests files. r=gavin

--HG--
rename : toolkit/addon-sdk/test/Makefile.in => addon-sdk/test/Makefile.in
rename : toolkit/addon-sdk/test/unit/head.js => addon-sdk/test/unit/head.js
rename : toolkit/addon-sdk/test/unit/test_promise.js => addon-sdk/test/unit/test_promise.js
rename : toolkit/addon-sdk/test/unit/xpcshell.ini => addon-sdk/test/unit/xpcshell.ini
This commit is contained in:
Dave Townsend 2013-02-01 11:43:15 -08:00
parent ca287bb2e6
commit 6c649be569
65 changed files with 59 additions and 713 deletions

View File

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
let run_promise_tests = function run_promise_tests(tests, cb) {
let timer = Components.classes["@mozilla.org/timer;1"]

View File

@ -143,5 +143,5 @@ function addVisits(aPlaceInfo, aWindow, aCallback, aStack) {
}
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");

View File

@ -80,7 +80,7 @@ Cu.import("resource:///modules/TelemetryTimestamps.jsm", this);
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this);
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", this);
Cu.import("resource://gre/modules/commonjs/promise/core.js", this);
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", this);
XPCOMUtils.defineLazyServiceGetter(this, "gSessionStartup",
"@mozilla.org/browser/sessionstartup;1", "nsISessionStartup");

View File

@ -32,7 +32,7 @@ const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource://gre/modules/TelemetryStopwatch.jsm");

View File

@ -39,7 +39,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "_SessionFile",
"resource:///modules/sessionstore/_SessionFile.jsm");

View File

@ -6977,7 +6977,7 @@ exports.createExecutionContext = function(requisition) {
define('gcli/promise', ['require', 'exports', 'module' ], function(require, exports, module) {
var imported = {};
Components.utils.import("resource://gre/modules/commonjs/promise/core.js",
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js",
imported);
exports.defer = imported.Promise.defer;

View File

@ -19,7 +19,7 @@ let TargetFactory = (function() {
let Promise = (function() {
let tempScope = {};
Components.utils.import("resource://gre/modules/commonjs/promise/core.js", tempScope);
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", tempScope);
return tempScope.Promise;
})();

View File

@ -10,7 +10,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
this.EXPORTED_SYMBOLS = ["DebuggerPanel"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",

View File

@ -8,7 +8,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
this.EXPORTED_SYMBOLS = ["ToolSidebar"];
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";

View File

@ -9,7 +9,7 @@ this.EXPORTED_SYMBOLS = [ "TargetFactory" ];
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");

View File

@ -8,7 +8,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
Cu.import("resource:///modules/devtools/gDevTools.jsm");

View File

@ -7,7 +7,7 @@
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
this.EXPORTED_SYMBOLS = [ "Hosts" ];

View File

@ -10,7 +10,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
Cu.import("resource:///modules/devtools/ToolDefinitions.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Toolbox",

View File

@ -7,7 +7,7 @@ Components.utils.import("resource:///modules/devtools/Target.jsm", tempScope);
let TargetFactory = tempScope.TargetFactory;
Components.utils.import("resource://gre/modules/devtools/Console.jsm", tempScope);
let console = tempScope.console;
Components.utils.import("resource://gre/modules/commonjs/promise/core.js", tempScope);
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", tempScope);
let Promise = tempScope.Promise;
/**

View File

@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = ["InspectorPanel"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "MarkupView",

View File

@ -8,7 +8,7 @@ const Cu = Components.utils;
Cu.import("resource:///modules/devtools/ProfilerController.jsm");
Cu.import("resource:///modules/devtools/ProfilerHelpers.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -11,7 +11,7 @@
var imports = {};
Cu.import("resource:///modules/devtools/Templater.jsm", imports);
Cu.import("resource://gre/modules/commonjs/promise/core.js", imports);
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", imports);
function test() {
addTab("http://example.com/browser/browser/devtools/shared/test/browser_templater_basic.html", function() {

View File

@ -9,7 +9,7 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
this.EXPORTED_SYMBOLS = ["StyleEditorPanel"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource:///modules/devtools/EventEmitter.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "StyleEditorChrome",

View File

@ -27,7 +27,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
"resource://gre/modules/devtools/WebConsoleUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
let l10n = new WebConsoleUtils.l10n(STRINGS_URI);

View File

@ -44,7 +44,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebConsoleUtils",
"resource://gre/modules/devtools/WebConsoleUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
const STRINGS_URI = "chrome://browser/locale/devtools/webconsole.properties";
let l10n = new WebConsoleUtils.l10n(STRINGS_URI);

View File

@ -8,7 +8,7 @@ const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource:///modules/NewTabUtils.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Services.jsm");
/**

View File

@ -8,7 +8,7 @@ let Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
function pref(name, value) {
return {

View File

@ -22,7 +22,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");

View File

@ -23,7 +23,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-common/rest.js");
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-common/utils.js");

View File

@ -26,7 +26,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-common/utils.js");

View File

@ -5,7 +5,7 @@
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/services/datareporting/sessions.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://services-common/utils.js");

View File

@ -20,7 +20,7 @@ Cu.import("resource://services-common/async.js");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-common/preferences.js");
Cu.import("resource://services-common/utils.js");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");

View File

@ -15,7 +15,7 @@ this.EXPORTED_SYMBOLS = [
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -22,7 +22,7 @@ Cu.import("resource://gre/modules/Metrics.jsm");
const DEFAULT_PROFILE_MEASUREMENT_NAME = "age";
const REQUIRED_UINT32_TYPE = {type: "TYPE_UINT32"};
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/osfile.jsm")
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://services-common/log4moz.js");

View File

@ -31,7 +31,7 @@ Cu.import("resource://gre/modules/Metrics.jsm");
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");

View File

@ -7,7 +7,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://services-common/observers.js");
Cu.import("resource://services-common/preferences.js");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/services/healthreport/healthreporter.jsm");
Cu.import("resource://gre/modules/services/datareporting/policy.jsm");
Cu.import("resource://gre/modules/Services.jsm");

View File

@ -12,7 +12,7 @@ const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
let profile_creation_lower = Date.now() - MILLISECONDS_PER_DAY;
do_get_profile();
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/services/healthreport/profile.jsm");
Cu.import("resource://gre/modules/Task.jsm");

View File

@ -6,7 +6,7 @@
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/services-common/utils.js");

View File

@ -12,7 +12,7 @@ const {utils: Cu} = Components;
Cu.import("resource://gre/modules/services/metrics/dataprovider.jsm");
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-common/utils.js");

View File

@ -17,7 +17,7 @@ const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-common/preferences.js");

View File

@ -11,7 +11,7 @@ this.EXPORTED_SYMBOLS = [
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://gre/modules/Task.jsm");

View File

@ -19,7 +19,7 @@ const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
#endif
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Sqlite.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://services-common/log4moz.js");

View File

@ -5,7 +5,7 @@
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/Metrics.jsm");
Cu.import("resource://services-common/utils.js");

View File

@ -11,7 +11,7 @@ Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
add_task(function test_locally_changed_keys() {
let passphrase = "abcdeabcdeabcdeabcdeabcdea";

View File

@ -38,7 +38,7 @@ add_test(function test_failing() {
'''
ADD_TASK_SINGLE = '''
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
function run_test() { run_next_test(); }
@ -49,7 +49,7 @@ add_task(function test_task() {
'''
ADD_TASK_MULTIPLE = '''
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
function run_test() { run_next_test(); }
@ -63,7 +63,7 @@ add_task(function test_2() {
'''
ADD_TASK_REJECTED = '''
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
function run_test() { run_next_test(); }
@ -73,7 +73,7 @@ add_task(function test_failing() {
'''
ADD_TASK_FAILURE_INSIDE = '''
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
function run_test() { run_next_test(); }

View File

@ -137,7 +137,6 @@ skip-if = os == "win" || os == "mac" || os == "os2"
[include:netwerk/test/unit_ipc/xpcshell.ini]
[include:netwerk/cookie/test/unit_ipc/xpcshell.ini]
[include:toolkit/components/contentprefs/tests/unit_ipc/xpcshell.ini]
[include:toolkit/addon-sdk/test/unit/xpcshell.ini]
[include:addon-sdk/test/unit/xpcshell.ini]
[include:uriloader/exthandler/tests/unit_ipc/xpcshell.ini]

View File

@ -10,7 +10,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = \
addon-sdk \
components \
content \
devtools \

View File

@ -1,25 +0,0 @@
# 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/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
DIRS += \
promise \
$(NULL)
JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs
EXTRA_JS_MODULES := \
loader.js \
$(NULL)
TEST_DIRS += test
include $(topsrcdir)/config/rules.mk

View File

@ -1,390 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 expandtab */
/* 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/.
*/
;(function(id, factory) { // Module boilerplate :(
if (typeof(define) === 'function') { // RequireJS
define(factory);
} else if (typeof(require) === 'function') { // CommonJS
factory.call(this, require, exports, module);
} else if (~String(this).indexOf('BackstagePass')) { // JSM
this[factory.name] = {};
factory(function require(uri) {
var imports = {};
this['Components'].utils.import(uri, imports);
return imports;
}, this[factory.name], { uri: __URI__, id: id });
this.EXPORTED_SYMBOLS = [factory.name];
} else { // Browser or alike
var globals = this
factory(function require(id) {
return globals[id];
}, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
}
}).call(this, 'loader', function Loader(require, exports, module) {
'use strict';
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
results: Cr, manager: Cm } = Components;
const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
const { loadSubScript } = Cc['@mozilla.org/moz/jssubscript-loader;1'].
getService(Ci.mozIJSSubScriptLoader);
const { notifyObservers } = Cc['@mozilla.org/observer-service;1'].
getService(Ci.nsIObserverService);
// Define some shortcuts.
const bind = Function.call.bind(Function.bind);
const getOwnPropertyNames = Object.getOwnPropertyNames;
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
const define = Object.defineProperties;
const prototypeOf = Object.getPrototypeOf;
const create = Object.create;
const keys = Object.keys;
// Workaround for bug 674195. Freezing objects from other compartments fail,
// so we use `Object.freeze` from the same component instead.
function freeze(object) {
if (prototypeOf(object) === null) {
Object.freeze(object);
}
else {
prototypeOf(prototypeOf(object.isPrototypeOf)).
constructor. // `Object` from the owner compartment.
freeze(object);
}
return object;
}
// Returns map of given `object`-s own property descriptors.
const descriptor = iced(function descriptor(object) {
let value = {};
getOwnPropertyNames(object).forEach(function(name) {
value[name] = getOwnPropertyDescriptor(object, name)
});
return value;
});
exports.descriptor = descriptor;
// Freeze important built-ins so they can't be used by untrusted code as a
// message passing channel.
freeze(Object);
freeze(Object.prototype);
freeze(Function);
freeze(Function.prototype);
freeze(Array);
freeze(Array.prototype);
freeze(String);
freeze(String.prototype);
// This function takes `f` function sets it's `prototype` to undefined and
// freezes it. We need to do this kind of deep freeze with all the exposed
// functions so that untrusted code won't be able to use them a message
// passing channel.
function iced(f) {
f.prototype = undefined;
return freeze(f);
}
// Defines own properties of given `properties` object on the given
// target object overriding any existing property with a conflicting name.
// Returns `target` object. Note we only export this function because it's
// useful during loader bootstrap when other util modules can't be used &
// thats only case where this export should be used.
const override = iced(function override(target, source) {
let properties = descriptor(target)
let extension = descriptor(source || {})
getOwnPropertyNames(extension).forEach(function(name) {
properties[name] = extension[name];
});
return define({}, properties);
});
exports.override = override;
// Function takes set of options and returns a JS sandbox. Function may be
// passed set of options:
// - `name`: A string value which identifies the sandbox in about:memory. Will
// throw exception if omitted.
// - `principal`: String URI or `nsIPrincipal` for the sandbox. Defaults to
// system principal.
// - `prototype`: Ancestor for the sandbox that will be created. Defaults to
// `{}`.
// - `wantXrays`: A Boolean value indicating whether code outside the sandbox
// wants X-ray vision with respect to objects inside the sandbox. Defaults
// to `true`.
// - `sandbox`: A sandbox to share JS compartment with. If omitted new
// compartment will be created.
// For more details see:
// https://developer.mozilla.org/en/Components.utils.Sandbox
const Sandbox = iced(function Sandbox(options) {
// Normalize options and rename to match `Cu.Sandbox` expectations.
options = {
// Do not expose `Components` if you really need them (bad idea!) you
// still can expose via prototype.
wantComponents: false,
sandboxName: options.name,
principal: 'principal' in options ? options.principal : systemPrincipal,
wantXrays: 'wantXrays' in options ? options.wantXrays : true,
sandboxPrototype: 'prototype' in options ? options.prototype : {},
sameGroupAs: 'sandbox' in options ? options.sandbox : null
};
// Make `options.sameGroupAs` only if `sandbox` property is passed,
// otherwise `Cu.Sandbox` will throw.
if (!options.sameGroupAs)
delete options.sameGroupAs;
let sandbox = Cu.Sandbox(options.principal, options);
// Each sandbox at creation gets set of own properties that will be shadowing
// ones from it's prototype. We override delete such `sandbox` properties
// to avoid shadowing.
delete sandbox.Iterator;
delete sandbox.Components;
delete sandbox.importFunction;
delete sandbox.debug;
return sandbox;
});
exports.Sandbox = Sandbox;
// Evaluates code from the given `uri` into given `sandbox`. If
// `options.source` is passed, then that code is evaluated instead.
// Optionally following options may be given:
// - `options.encoding`: Source encoding, defaults to 'UTF-8'.
// - `options.line`: Line number to start count from for stack traces.
// Defaults to 1.
// - `options.version`: Version of JS used, defaults to '1.8'.
const evaluate = iced(function evaluate(sandbox, uri, options) {
let { source, line, version, encoding } = override({
encoding: 'UTF-8',
line: 1,
version: '1.8',
source: null
}, options);
return source ? Cu.evalInSandbox(source, sandbox, version, uri, line)
: loadSubScript(uri, sandbox, encoding);
});
exports.evaluate = evaluate;
// Populates `exports` of the given CommonJS `module` object, in the context
// of the given `loader` by evaluating code associated with it.
const load = iced(function load(loader, module) {
let { sandboxes, globals } = loader;
let require = Require(loader, module);
let sandbox = sandboxes[module.uri] = Sandbox({
name: module.uri,
// Get an existing module sandbox, if any, so we can reuse its compartment
// when creating the new one to reduce memory consumption.
sandbox: sandboxes[keys(sandboxes).shift()],
// We expose set of properties defined by `CommonJS` specification via
// prototype of the sandbox. Also globals are deeper in the prototype
// chain so that each module has access to them as well.
prototype: create(globals, descriptor({
require: require,
module: module,
exports: module.exports
})),
wantXrays: false
});
evaluate(sandbox, module.uri);
if (module.exports && typeof(module.exports) === 'object')
freeze(module.exports);
return module;
});
exports.load = load;
// Utility function to check if id is relative.
function isRelative(id) { return id[0] === '.'; }
// Utility function to normalize module `uri`s so they have `.js` extension.
function normalize(uri) { return uri.substr(-3) === '.js' ? uri : uri + '.js'; }
// Utility function to join paths. In common case `base` is a
// `requirer.uri` but in some cases it may be `baseURI`. In order to
// avoid complexity we require `baseURI` with a trailing `/`.
const resolve = iced(function resolve(id, base) {
let paths = id.split('/');
let result = base.split('/');
result.pop();
while (paths.length) {
let path = paths.shift();
if (path === '..')
result.pop();
else if (path !== '.')
result.push(path);
}
return result.join('/');
});
exports.resolve = resolve;
const resolveURI = iced(function resolveURI(id, mapping) {
let count = mapping.length, index = 0;
while (index < count) {
let [ path, uri ] = mapping[index ++];
if (id.indexOf(path) === 0)
return normalize(id.replace(path, uri));
}
});
exports.resolveURI = resolveURI;
// Creates version of `require` that will be exposed to the given `module`
// in the context of the given `loader`. Each module gets own limited copy
// of `require` that is allowed to load only a modules that are associated
// with it during link time.
const Require = iced(function Require(loader, requirer) {
let { modules, mapping, resolve } = loader;
function require(id) {
if (!id) // Throw if `id` is not passed.
throw Error('you must provide a module name when calling require() from '
+ requirer.id, requirer.uri);
// Resolve `id` to its requirer if it's relative.
let requirement = requirer ? resolve(id, requirer.id) : id;
// Resolves `uri` of module using loaders resolve function.
let uri = resolveURI(requirement, mapping);
if (!uri) // Throw if `uri` can not be resolved.
throw Error('Module: Can not resolve "' + id + '" module required by ' +
requirer.id + ' located at ' + requirer.uri, requirer.uri);
let module = null;
// If module is already cached by loader then just use it.
if (uri in modules) {
module = modules[uri];
}
// Otherwise load and cache it. We also freeze module to prevent it from
// further changes at runtime.
else {
module = modules[uri] = Module(requirement, uri);
freeze(load(loader, module));
}
return module.exports;
}
// Make `require.main === module` evaluate to true in main module scope.
require.main = loader.main === requirer ? requirer : undefined;
return iced(require);
});
exports.Require = Require;
const main = iced(function main(loader, id) {
let module = Module(id, resolveURI(id, loader.mapping));
loader.main = module;
return load(loader, module).exports;
});
exports.main = main;
// Makes module object that is made available to CommonJS modules when they
// are evaluated, along with `exports` and `require`.
const Module = iced(function Module(id, uri) {
return create(null, {
id: { enumerable: true, value: id },
exports: { enumerable: true, writable: true, value: create(null) },
uri: { value: uri }
});
});
exports.Module = Module;
// Takes `loader`, and unload `reason` string and notifies all observers that
// they should cleanup after them-self.
const unload = iced(function unload(loader, reason) {
// subject is a unique object created per loader instance.
// This allows any code to cleanup on loader unload regardless of how
// it was loaded. To handle unload for specific loader subject may be
// asserted against loader.destructor or require('@loader/unload')
// Note: We don not destroy loader's module cache or sandboxes map as
// some modules may do cleanup in subsequent turns of event loop. Destroying
// cache may cause module identity problems in such cases.
let subject = { wrappedJSObject: loader.destructor };
notifyObservers(subject, 'sdk:loader:destroy', reason);
});
exports.unload = unload;
// Function makes new loader that can be used to load CommonJS modules
// described by a given `options.manifest`. Loader takes following options:
// - `globals`: Optional map of globals, that all module scopes will inherit
// from. Map is also exposed under `globals` property of the returned loader
// so it can be extended further later. Defaults to `{}`.
// - `modules` Optional map of built-in module exports mapped by module id.
// These modules will incorporated into module cache. Each module will be
// frozen.
// - `resolve` Optional module `id` resolution function. If given it will be
// used to resolve module URIs, by calling it with require term, requirer
// module object (that has `uri` property) and `baseURI` of the loader.
// If `resolve` does not returns `uri` string exception will be thrown by
// an associated `require` call.
const Loader = iced(function Loader(options) {
let { modules, globals, resolve, paths } = override({
paths: {},
modules: {},
globals: {},
resolve: exports.resolve
}, options);
// We create an identity object that will be dispatched on an unload
// event as subject. This way unload listeners will be able to assert
// which loader is unloaded. Please note that we intentionally don't
// use `loader` as subject to prevent a loader access leakage through
// observer notifications.
let destructor = freeze(create(null));
// Make mapping array that is sorted from longest path to shortest path
// to allow overlays.
let mapping = keys(paths).
sort(function(a, b) { return b.length - a.length }).
map(function(path) { return [ path, paths[path] ] });
// Define pseudo modules.
modules = override({
'@loader/unload': destructor,
'@loader/options': options,
'chrome': { Cc: Cc, Ci: Ci, Cu: Cu, Cr: Cr, Cm: Cm,
CC: bind(CC, Components), components: Components }
}, modules);
modules = keys(modules).reduce(function(result, id) {
// We resolve `uri` from `id` since modules are cached by `uri`.
let uri = resolveURI(id, mapping);
let module = Module(id, uri);
module.exports = freeze(modules[id]);
result[uri] = freeze(module);
return result;
}, {});
// Loader object is just a representation of a environment
// state. We freeze it and mark make it's properties non-enumerable
// as they are pure implementation detail that no one should rely upon.
return freeze(create(null, {
destructor: { enumerable: false, value: destructor },
globals: { enumerable: false, value: globals },
mapping: { enumerable: false, value: mapping },
// Map of module objects indexed by module URIs.
modules: { enumerable: false, value: modules },
// Map of module sandboxes indexed by module URIs.
sandboxes: { enumerable: false, value: {} },
resolve: { enumerable: false, value: resolve },
// Main (entry point) module, it can be set only once, since loader
// instance can have only one main module.
main: new function() {
let main;
return {
enumerable: false,
get: function() { return main; },
// Only set main if it has not being set yet!
set: function(module) { main = main || module; }
}
}
}));
});
exports.Loader = Loader;
});

View File

@ -1,19 +0,0 @@
# 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/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs/promise
EXTRA_JS_MODULES := \
core.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -1,218 +0,0 @@
/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint undef: true es5: true node: true browser: true devel: true
forin: true latedef: false */
/*global define: true, Cu: true, __URI__: true */
;(function(id, factory) { // Module boilerplate :(
if (typeof(define) === 'function') { // RequireJS
define(factory);
} else if (typeof(require) === 'function') { // CommonJS
factory.call(this, require, exports, module);
} else if (String(this).indexOf('BackstagePass') >= 0) { // JSM
this[factory.name] = {};
factory(function require(uri) {
var imports = {};
this['Components'].utils.import(uri, imports);
return imports;
}, this[factory.name], { uri: __URI__, id: id });
this.EXPORTED_SYMBOLS = [factory.name];
} else { // Browser or alike
var globals = this;
factory(function require(id) {
return globals[id];
}, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
}
}).call(this, 'promise/core', function Promise(require, exports, module) {
'use strict';
/**
* Internal utility: Wraps given `value` into simplified promise, successfully
* fulfilled to a given `value`. Note the result is not a complete promise
* implementation, as its method `then` does not returns anything.
*/
function fulfilled(value) {
return { then: function then(fulfill) { fulfill(value); } };
}
/**
* Internal utility: Wraps given input into simplified promise, pre-rejected
* with a given `reason`. Note the result is not a complete promise
* implementation, as its method `then` does not returns anything.
*/
function rejected(reason) {
return { then: function then(fulfill, reject) { reject(reason); } };
}
/**
* Internal utility: Decorates given `f` function, so that on exception promise
* rejected with thrown error is returned.
*/
function attempt(f) {
return function effort(input) {
try {
return f(input);
}
catch(error) {
return rejected(error);
}
};
}
/**
* Internal utility: Returns `true` if given `value` is a promise. Value is
* assumed to be a promise if it implements method `then`.
*/
function isPromise(value) {
return value && typeof(value.then) === 'function';
}
/**
* Creates deferred object containing fresh promise & methods to either resolve
* or reject it. The result is an object with the following properties:
* - `promise` Eventual value representation implementing CommonJS [Promises/A]
* (http://wiki.commonjs.org/wiki/Promises/A) API.
* - `resolve` Single shot function that resolves enclosed `promise` with a
* given `value`.
* - `reject` Single shot function that rejects enclosed `promise` with a given
* `reason`.
*
* ## Example
*
* function fetchURI(uri, type) {
* var deferred = defer();
* var request = new XMLHttpRequest();
* request.open("GET", uri, true);
* request.responseType = type;
* request.onload = function onload() {
* deferred.resolve(request.response);
* }
* request.onerror = function(event) {
* deferred.reject(event);
* }
* request.send();
*
* return deferred.promise;
* }
*/
function defer() {
// Define FIFO queue of observer pairs. Once promise is resolved & all queued
// observers are forwarded to `result` and variable is set to `null`.
var observers = [];
// Promise `result`, which will be assigned a resolution value once promise
// is resolved. Note that result will always be assigned promise (or alike)
// object to take care of propagation through promise chains. If result is
// `null` promise is not resolved yet.
var result = null;
var deferred = {
promise: {
then: function then(onFulfill, onError) {
var deferred = defer();
// Decorate `onFulfill` / `onError` handlers with `attempt`, that
// way if wrapped handler throws exception decorator will catch and
// return promise rejected with it, which will cause rejection of
// `deferred.promise`. If handler is missing, substitute it with an
// utility function that takes one argument and returns promise
// fulfilled / rejected with it. This takes care of propagation
// through the rest of the promise chain.
onFulfill = onFulfill ? attempt(onFulfill) : fulfilled;
onError = onError ? attempt(onError) : rejected;
// Create a pair of observers that invoke given handlers & propagate
// results to `deferred.promise`.
function resolveDeferred(value) { deferred.resolve(onFulfill(value)); }
function rejectDeferred(reason) { deferred.resolve(onError(reason)); }
// If enclosed promise (`this.promise`) observers queue is still alive
// enqueue a new observer pair into it. Note that this does not
// necessary means that promise is pending, it may already be resolved,
// but we still have to queue observers to guarantee an order of
// propagation.
if (observers) {
observers.push({ resolve: resolveDeferred, reject: rejectDeferred });
}
// Otherwise just forward observer pair right to a `result` promise.
else {
result.then(resolveDeferred, rejectDeferred);
}
return deferred.promise;
}
},
/**
* Resolves associated `promise` to a given `value`, unless it's already
* resolved or rejected. Note that resolved promise is not necessary a
* successfully fulfilled. Promise may be resolved with a promise `value`
* in which case `value` promise's fulfillment / rejection will propagate
* up to a promise resolved with `value`.
*/
resolve: function resolve(value) {
if (!result) {
// Store resolution `value` in a `result` as a promise, so that all
// the subsequent handlers can be simply forwarded to it. Since
// `result` will be a promise all the value / error propagation will
// be uniformly taken care of.
result = isPromise(value) ? value : fulfilled(value);
// Forward already registered observers to a `result` promise in the
// order they were registered. Note that we intentionally dequeue
// observer at a time until queue is exhausted. This makes sure that
// handlers registered as side effect of observer forwarding are
// queued instead of being invoked immediately, guaranteeing FIFO
// order.
while (observers.length) {
var observer = observers.shift();
result.then(observer.resolve, observer.reject);
}
// Once `observers` queue is exhausted we `null`-ify it, so that
// new handlers are forwarded straight to the `result`.
observers = null;
}
},
/**
* Rejects associated `promise` with a given `reason`, unless it's already
* resolved / rejected. This is just a (better performing) convenience
* shortcut for `deferred.resolve(reject(reason))`.
*/
reject: function reject(reason) {
// Note that if promise is resolved that does not necessary means that it
// is successfully fulfilled. Resolution value may be a promise in which
// case its result propagates. In other words if promise `a` is resolved
// with promise `b`, `a` is either fulfilled or rejected depending
// on weather `b` is fulfilled or rejected. Here `deferred.promise` is
// resolved with a promise pre-rejected with a given `reason`, there for
// `deferred.promise` is rejected with a given `reason`. This may feel
// little awkward first, but doing it this way greatly simplifies
// propagation through promise chains.
deferred.resolve(rejected(reason));
}
};
return deferred;
}
exports.defer = defer;
/**
* Returns a promise resolved to a given `value`.
*/
function resolve(value) {
var deferred = defer();
deferred.resolve(value);
return deferred.promise;
}
exports.resolve = resolve;
/**
* Returns a promise rejected with a given `reason`.
*/
function reject(reason) {
var deferred = defer();
deferred.reject(reason);
return deferred.promise;
}
exports.reject = reject;
});

View File

@ -16,7 +16,7 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
var downloadUtils = { };
XPCOMUtils.defineLazyServiceGetter(downloadUtils,

View File

@ -49,7 +49,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");

View File

@ -28,7 +28,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "HttpServer",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",

View File

@ -10,7 +10,7 @@
this.EXPORTED_SYMBOLS = ["PromiseWorker"];
// The library of promises.
Components.utils.import("resource://gre/modules/commonjs/promise/core.js", this);
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", this);
/**
* An implementation of queues (FIFO).

View File

@ -47,7 +47,7 @@ if (OS.Constants.Win) {
let Type = OS.Shared.Type;
// The library of promises.
Components.utils.import("resource://gre/modules/commonjs/promise/core.js", this);
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js", this);
// The implementation of communications
Components.utils.import("resource://gre/modules/osfile/_PromiseWorker.jsm", this);

View File

@ -1,7 +1,7 @@
"use strict";
Components.utils.import("resource://gre/modules/osfile.jsm");
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Components.utils.import("resource://gre/modules/Task.jsm");
// The following are used to compare against a well-tested reference

View File

@ -67,7 +67,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
const Container_Normal = 0;
const Container_Toolbar = 1;

View File

@ -6,7 +6,7 @@ const TRANSITION_TYPED = Ci.nsINavHistoryService.TRANSITION_TYPED;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
/**
* Allows waiting for an observer notification once.

View File

@ -28,7 +28,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",

View File

@ -8,7 +8,7 @@ const Cr = Components.results;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/commonjs/promise/core.js");
Components.utils.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Components.utils.import("resource://gre/modules/Deprecated.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask",

View File

@ -95,7 +95,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
////////////////////////////////////////////////////////////////////////////////
//// Task

View File

@ -16,7 +16,7 @@ const Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",

View File

@ -24,7 +24,7 @@ let wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
Cu.import("resource://gre/modules/jsdebugger.jsm");
addDebuggerToGlobal(this);
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
const { defer, resolve, reject } = Promise;
function dumpn(str) {

View File

@ -18,7 +18,7 @@ Cu.import("resource://gre/modules/PlacesUtils.jsm");
Cu.import("resource://gre/modules/ForgetAboutSite.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/promise/core.js");
"resource://gre/modules/commonjs/sdk/core/promise.js");
const COOKIE_EXPIRY = Math.round(Date.now() / 1000) + 60;
const COOKIE_NAME = "testcookie";

View File

@ -10,7 +10,7 @@ this.EXPORTED_SYMBOLS = [
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -7,7 +7,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
do_get_profile();
Cu.import("resource://gre/modules/commonjs/promise/core.js");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Sqlite.jsm");
Cu.import("resource://gre/modules/Task.jsm");