Bug 1016301 - Convert testactors.js to use native promises;r=past
This commit is contained in:
@@ -44,7 +44,7 @@ function TestTabList(aConnection) {
|
|||||||
TestTabList.prototype = {
|
TestTabList.prototype = {
|
||||||
constructor: TestTabList,
|
constructor: TestTabList,
|
||||||
getList: function () {
|
getList: function () {
|
||||||
return promise.resolve([tabActor for (tabActor of this._tabActors)]);
|
return Promise.resolve([tabActor for (tabActor of this._tabActors)]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -269,7 +269,6 @@ const chrome = { CC: undefined, Cc: undefined, ChromeWorker: undefined,
|
|||||||
// The default instance of the worker debugger loader is defined differently
|
// The default instance of the worker debugger loader is defined differently
|
||||||
// depending on whether it is loaded from the main thread or a worker thread.
|
// depending on whether it is loaded from the main thread or a worker thread.
|
||||||
if (typeof Components === "object") {
|
if (typeof Components === "object") {
|
||||||
(function () {
|
|
||||||
const { Constructor: CC, classes: Cc, manager: Cm, interfaces: Ci,
|
const { Constructor: CC, classes: Cc, manager: Cm, interfaces: Ci,
|
||||||
results: Cr, utils: Cu } = Components;
|
results: Cr, utils: Cu } = Components;
|
||||||
|
|
||||||
@@ -296,18 +295,14 @@ if (typeof Components === "object") {
|
|||||||
|
|
||||||
// Define the Debugger object in a sandbox to ensure that the this passed to
|
// Define the Debugger object in a sandbox to ensure that the this passed to
|
||||||
// addDebuggerToGlobal is a global.
|
// addDebuggerToGlobal is a global.
|
||||||
const Debugger = (function () {
|
|
||||||
let sandbox = Cu.Sandbox(principal, {});
|
let sandbox = Cu.Sandbox(principal, {});
|
||||||
Cu.evalInSandbox(
|
Cu.evalInSandbox(
|
||||||
"Components.utils.import('resource://gre/modules/jsdebugger.jsm');" +
|
"Components.utils.import('resource://gre/modules/jsdebugger.jsm');" +
|
||||||
"addDebuggerToGlobal(this);",
|
"addDebuggerToGlobal(this);",
|
||||||
sandbox
|
sandbox
|
||||||
);
|
);
|
||||||
return sandbox.Debugger;
|
const Debugger = sandbox.Debugger;
|
||||||
})();
|
|
||||||
|
|
||||||
// TODO: Replace this with native promises: bug 1016301
|
|
||||||
const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});;
|
|
||||||
const Timer = Cu.import("resource://gre/modules/Timer.jsm", {});
|
const Timer = Cu.import("resource://gre/modules/Timer.jsm", {});
|
||||||
const xpcInspector = Cc["@mozilla.org/jsinspector;1"].
|
const xpcInspector = Cc["@mozilla.org/jsinspector;1"].
|
||||||
getService(Ci.nsIJSInspector);
|
getService(Ci.nsIJSInspector);
|
||||||
@@ -317,13 +312,12 @@ if (typeof Components === "object") {
|
|||||||
globals: {
|
globals: {
|
||||||
"isWorker": true,
|
"isWorker": true,
|
||||||
"Debugger": Debugger,
|
"Debugger": Debugger,
|
||||||
"promise": Promise,
|
|
||||||
"reportError": Cu.reportError,
|
|
||||||
"setInterval": Timer.setInterval,
|
"setInterval": Timer.setInterval,
|
||||||
"setTimeout": Timer.setTimeout,
|
"setTimeout": Timer.setTimeout,
|
||||||
"clearInterval": Timer.clearInterval,
|
"clearInterval": Timer.clearInterval,
|
||||||
"clearTimeout": Timer.clearTimeout,
|
"clearTimeout": Timer.clearTimeout,
|
||||||
"xpcInspector": xpcInspector,
|
"xpcInspector": xpcInspector,
|
||||||
|
"reportError": Cu.reportError,
|
||||||
},
|
},
|
||||||
loadInSandbox: loadInSandbox,
|
loadInSandbox: loadInSandbox,
|
||||||
modules: {
|
modules: {
|
||||||
@@ -339,5 +333,4 @@ if (typeof Components === "object") {
|
|||||||
"xpcshell-test": "resource://test",
|
"xpcshell-test": "resource://test",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).call(this);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user