dbg-actors.js (1480B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 /* globals require, exports, Services */ 6 7 "use strict"; 8 9 const { DevToolsServer } = require("devtools/server/devtools-server"); 10 const { RootActor } = require("devtools/server/actors/root"); 11 const { BrowserTabList } = require("devtools/server/actors/webbrowser"); 12 const { ProcessActorList } = require("devtools/server/actors/process"); 13 const { 14 ActorRegistry, 15 } = require("devtools/server/actors/utils/actor-registry"); 16 17 /** 18 * xpcshell-test (XPCST) specific actors. 19 * 20 */ 21 22 /** 23 * Construct a root actor appropriate for use in a server running xpcshell 24 * tests. <snip boilerplate> :) 25 */ 26 function createRootActor(connection) { 27 let parameters = { 28 tabList: new XPCSTTabList(connection), 29 processList: new ProcessActorList(), 30 globalActorFactories: ActorRegistry.globalActorFactories, 31 onShutdown() { 32 // If the user never switches to the "debugger" tab we might get a 33 // shutdown before we've attached. 34 Services.obs.notifyObservers(null, "xpcshell-test-devtools-shutdown"); 35 }, 36 }; 37 return new RootActor(connection, parameters); 38 } 39 exports.createRootActor = createRootActor; 40 41 /** 42 * A "stub" TabList implementation that provides no tabs. 43 */ 44 class XPCSTTabList extends BrowserTabList { 45 getList() { 46 return Promise.resolve([]); 47 } 48 }