// Get the object, from the server side, for a given actor ID function getActorInstance(connID, actorID) { return DevToolsServer._connections[connID].getActor(actorID);
}
/** * The purpose of these tests is to verify that it's possible to add actors * both before and after the DevToolsServer has been initialized, so addons * that add actors don't have to poll the object for its initialization state * in order to add actors after initialization but rather can add actors anytime * regardless of the object's state.
*/
add_task(async function () {
ActorRegistry.registerModule("resource://test/pre_init_global_actors.js", {
prefix: "preInitGlobal",
constructor: "PreInitGlobalActor",
type: { global: true },
});
ActorRegistry.registerModule( "resource://test/pre_init_target_scoped_actors.js",
{
prefix: "preInitTargetScoped",
constructor: "PreInitTargetScopedActor",
type: { target: true },
}
);
// These xpcshell tests use mocked actors (xpcshell-test/testactors) // which still don't support watcher actor. // Because of that we still can't enable server side targets and target swiching.
tabDescriptor.disableTargetSwitching();
// Consider that there is only one connection, and the first one is ours const connID = Object.keys(DevToolsServer._connections)[0]; const postInitGlobalActor = getActorInstance(
connID,
actors.postInitGlobalActor
); const preInitGlobalActor = getActorInstance(
connID,
actors.preInitGlobalActor
);
actors = await client.mainRoot.getRoot(); Assert.equal(
postInitGlobalActor,
getActorInstance(connID, actors.postInitGlobalActor)
); Assert.equal(
preInitGlobalActor,
getActorInstance(connID, actors.preInitGlobalActor)
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.