mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1016301 - Convert testactors.js to use native promises;r=past
This commit is contained in:
parent
08fc0aebce
commit
fc08592611
@ -44,7 +44,7 @@ function TestTabList(aConnection) {
|
||||
TestTabList.prototype = {
|
||||
constructor: TestTabList,
|
||||
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
|
||||
// depending on whether it is loaded from the main thread or a worker thread.
|
||||
if (typeof Components === "object") {
|
||||
(function () {
|
||||
const { Constructor: CC, classes: Cc, manager: Cm, interfaces: Ci,
|
||||
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
|
||||
// addDebuggerToGlobal is a global.
|
||||
const Debugger = (function () {
|
||||
let sandbox = Cu.Sandbox(principal, {});
|
||||
Cu.evalInSandbox(
|
||||
"Components.utils.import('resource://gre/modules/jsdebugger.jsm');" +
|
||||
"addDebuggerToGlobal(this);",
|
||||
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 xpcInspector = Cc["@mozilla.org/jsinspector;1"].
|
||||
getService(Ci.nsIJSInspector);
|
||||
@ -317,13 +312,12 @@ if (typeof Components === "object") {
|
||||
globals: {
|
||||
"isWorker": true,
|
||||
"Debugger": Debugger,
|
||||
"promise": Promise,
|
||||
"reportError": Cu.reportError,
|
||||
"setInterval": Timer.setInterval,
|
||||
"setTimeout": Timer.setTimeout,
|
||||
"clearInterval": Timer.clearInterval,
|
||||
"clearTimeout": Timer.clearTimeout,
|
||||
"xpcInspector": xpcInspector,
|
||||
"reportError": Cu.reportError,
|
||||
},
|
||||
loadInSandbox: loadInSandbox,
|
||||
modules: {
|
||||
@ -339,5 +333,4 @@ if (typeof Components === "object") {
|
||||
"xpcshell-test": "resource://test",
|
||||
}
|
||||
});
|
||||
}).call(this);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user