Files
firefox/toolkit/devtools/debugger/tests/unit/testactors.js
T

45 lines
1.1 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
var gTestGlobals = [];
function createRootActor()
{
let actor = {
sayHello: function() {
this._globalActors = [];
for each (let g in gTestGlobals) {
let actor = new ThreadActor();
actor.addDebuggee(g);
actor._global = g;
actor.json = function() {
return { actor: actor.actorID,
threadActor: actor.actorID,
global: actor._global.__name };
};
this.conn.addActor(actor);
this._globalActors.push(actor);
}
return { from: "root",
applicationType: "xpcshell-tests",
testConnectionPrefix: this.conn.prefix };
},
listGlobals: function(aRequest) {
return { from: "root", contexts: [ g.json() for each (g in this._globalActors) ]};
},
};
actor.requestTypes = {
"listContexts": actor.listGlobals,
"echo": function(aRequest) { return aRequest; },
};
return actor;
}
DebuggerServer.addTestGlobal = function addTestGlobal(aGlobal)
{
gTestGlobals.push(aGlobal);
}