From eeb4ca4165e0b478f05fb11655f8b8906af3e417 Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Tue, 13 May 2014 22:06:37 +0200 Subject: [PATCH] Bug 859372 - Refactor testactors.js;r=past --- toolkit/devtools/server/tests/unit/head_dbg.js | 4 ++-- .../devtools/server/tests/unit/test_dbgglobal.js | 2 +- toolkit/devtools/server/tests/unit/testactors.js | 15 +++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/toolkit/devtools/server/tests/unit/head_dbg.js b/toolkit/devtools/server/tests/unit/head_dbg.js index cd6609e42cd8..2a133a24f63f 100644 --- a/toolkit/devtools/server/tests/unit/head_dbg.js +++ b/toolkit/devtools/server/tests/unit/head_dbg.js @@ -185,7 +185,7 @@ function attachTestTabAndResume(aClient, aTitle, aCallback) { function initTestDebuggerServer() { DebuggerServer.registerModule("devtools/server/actors/script"); - DebuggerServer.addActors("resource://test/testactors.js"); + DebuggerServer.registerModule("xpcshell-test/testactors"); // Allow incoming connections. DebuggerServer.init(function () { return true; }); } @@ -193,7 +193,7 @@ function initTestDebuggerServer() function initTestTracerServer() { DebuggerServer.registerModule("devtools/server/actors/script"); - DebuggerServer.addActors("resource://test/testactors.js"); + DebuggerServer.registerModule("xpcshell-test/testactors"); DebuggerServer.registerModule("devtools/server/actors/tracer"); // Allow incoming connections. DebuggerServer.init(function () { return true; }); diff --git a/toolkit/devtools/server/tests/unit/test_dbgglobal.js b/toolkit/devtools/server/tests/unit/test_dbgglobal.js index 6eb3fbb2676a..4a41506f7a1b 100644 --- a/toolkit/devtools/server/tests/unit/test_dbgglobal.js +++ b/toolkit/devtools/server/tests/unit/test_dbgglobal.js @@ -25,7 +25,7 @@ function run_test() check_except(DebuggerServer.closeListener); check_except(DebuggerServer.connectPipe); - DebuggerServer.addActors("resource://test/testactors.js"); + DebuggerServer.registerModule("xpcshell-test/testactors"); // Now they should work. DebuggerServer.openListener(-1); diff --git a/toolkit/devtools/server/tests/unit/testactors.js b/toolkit/devtools/server/tests/unit/testactors.js index 88c593a3ec3c..b6cfb0fd3f8a 100644 --- a/toolkit/devtools/server/tests/unit/testactors.js +++ b/toolkit/devtools/server/tests/unit/testactors.js @@ -1,11 +1,10 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -const Cu = Components.utils; -const devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools; const { ActorPool, appendExtraActors, createExtraActors } = require("devtools/server/actors/common"); -const { RootActor } = devtools.require("devtools/server/actors/root"); -const { ThreadActor } = devtools.require("devtools/server/actors/script"); +const { RootActor } = require("devtools/server/actors/root"); +const { ThreadActor } = require("devtools/server/actors/script"); +const { DebuggerServer } = require("devtools/server/main"); var gTestGlobals = []; DebuggerServer.addTestGlobal = function(aGlobal) { @@ -121,3 +120,11 @@ TestTabActor.prototype.requestTypes = { "attach": TestTabActor.prototype.onAttach, "detach": TestTabActor.prototype.onDetach }; + +exports.register = function(handle) { + handle.setRootActor(createRootActor); +}; + +exports.unregister = function(handle) { + handle.setRootActor(null); +};