tor-browser

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

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

Bug 2004214 - [devtools] Turn devtools/shared/discovery/tests/xpcshell/test_discovery.js into an ES class. r=devtools-reviewers,nchevobbe

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

Diffstat:
Mdevtools/shared/discovery/tests/xpcshell/test_discovery.js | 24+++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/devtools/shared/discovery/tests/xpcshell/test_discovery.js b/devtools/shared/discovery/tests/xpcshell/test_discovery.js @@ -30,13 +30,12 @@ var gTestTransports = {}; * Implements the same API as Transport in discovery.js. Here, no UDP sockets * are used. Instead, messages are delivered immediately. */ -function TestTransport(port) { - EventEmitter.decorate(this); - this.port = port; - gTestTransports[this.port] = this; -} - -TestTransport.prototype = { +class TestTransport { + constructor(port) { + EventEmitter.decorate(this); + this.port = port; + gTestTransports[this.port] = this; + } send(object, port) { log("Send to " + port + ":\n" + JSON.stringify(object, null, 2)); if (!gTestTransports[port]) { @@ -45,23 +44,22 @@ TestTransport.prototype = { } const message = JSON.stringify(object); gTestTransports[port].onPacketReceived(null, message); - }, + } destroy() { delete gTestTransports[this.port]; - }, + } // nsIUDPSocketListener - onPacketReceived(socket, message) { const object = JSON.parse(message); object.from = "localhost"; log("Recv on " + this.port + ":\n" + JSON.stringify(object, null, 2)); this.emit("message", object); - }, + } - onStopListening() {}, -}; + onStopListening() {} +} // Use TestTransport instead of the usual Transport discovery._factories.Transport = TestTransport;