tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit e57fd97354c402266337cc92218b9497b8a792c9
parent 345043c328be2e65652cb11cf91b213116ba9bb7
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Mon,  8 Dec 2025 16:21:00 +0000

Bug 2004216 - [devtools] Turn devtools/server/tests/xpcshell/testactors.js into an ES class. r=devtools-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D275478

Diffstat:
Mdevtools/server/tests/xpcshell/testactors.js | 44+++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/devtools/server/tests/xpcshell/testactors.js b/devtools/server/tests/xpcshell/testactors.js @@ -75,36 +75,34 @@ DevToolsServer.disallowNewThreadGlobals = function () { // As implemented now, we consult gTestGlobals when we're constructed, not // when we're iterated over, so tests have to add their globals before the // root actor is created. -function TestTabList(connection) { - this.conn = connection; +class TestTabList { + constructor(connection) { + this.conn = connection; - // An array of actors for each global added with - // DevToolsServer.addTestGlobal. - this._descriptorActors = []; + // An array of actors for each global added with + // DevToolsServer.addTestGlobal. + this._descriptorActors = []; - // A pool mapping those actors' names to the actors. - this._descriptorActorPool = new LazyPool(connection); + // A pool mapping those actors' names to the actors. + this._descriptorActorPool = new LazyPool(connection); - for (const global of gTestGlobals) { - const actor = new TestTargetActor(connection, global); - this._descriptorActorPool.manage(actor); + for (const global of gTestGlobals) { + const actor = new TestTargetActor(connection, global); + this._descriptorActorPool.manage(actor); - // Register the target actor, so that the Watcher actor can have access to it. - TargetActorRegistry.registerXpcShellTargetActor(actor); + // Register the target actor, so that the Watcher actor can have access to it. + TargetActorRegistry.registerXpcShellTargetActor(actor); - const descriptorActor = new TestDescriptorActor(connection, actor); - this._descriptorActorPool.manage(descriptorActor); + const descriptorActor = new TestDescriptorActor(connection, actor); + this._descriptorActorPool.manage(descriptorActor); - this._descriptorActors.push(descriptorActor); + this._descriptorActors.push(descriptorActor); + } } -} - -TestTabList.prototype = { - constructor: TestTabList, - destroy() {}, + destroy() {} getList() { return Promise.resolve([...this._descriptorActors]); - }, + } // Helper method only available for the xpcshell implementation of tablist. getTargetActorForTab(title) { const descriptorActor = this._descriptorActors.find(d => d.title === title); @@ -112,8 +110,8 @@ TestTabList.prototype = { return null; } return descriptorActor._targetActor; - }, -}; + } +} exports.createRootActor = function createRootActor(connection) { ActorRegistry.registerModule("devtools/server/actors/webconsole", {