tor-browser

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

commit 0e15674dbe22d2113628174c0e85141809b77e7f
parent e57fd97354c402266337cc92218b9497b8a792c9
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Mon,  8 Dec 2025 16:23:35 +0000

Bug 2004213 - [devtools] Turn devtools/shared/network-observer/test/xpcshell/test_throttle.js into an ES class. r=devtools-reviewers,nchevobbe

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

Diffstat:
Mdevtools/shared/network-observer/test/xpcshell/test_throttle.js | 42+++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/devtools/shared/network-observer/test/xpcshell/test_throttle.js b/devtools/shared/network-observer/test/xpcshell/test_throttle.js @@ -10,17 +10,17 @@ const { NetworkThrottleManager } = ChromeUtils.importESModule( ); const nsIScriptableInputStream = Ci.nsIScriptableInputStream; -function TestStreamListener() { - this.state = "initial"; -} -TestStreamListener.prototype = { +class TestStreamListener { + constructor() { + this.state = "initial"; + } onStartRequest() { this.setState("start"); - }, + } onStopRequest() { this.setState("stop"); - }, + } onDataAvailable(request, inputStream, offset, count) { const sin = Cc["@mozilla.org/scriptableinputstream;1"].createInstance( @@ -29,7 +29,7 @@ TestStreamListener.prototype = { sin.init(inputStream); this.data = sin.read(count); this.setState("data"); - }, + } setState(state) { this.state = state; @@ -37,7 +37,7 @@ TestStreamListener.prototype = { this._deferred.resolve(state); this._deferred = null; } - }, + } onStateChanged() { if (!this._deferred) { @@ -49,34 +49,34 @@ TestStreamListener.prototype = { this._deferred = { resolve, reject, promise }; } return this._deferred.promise; - }, -}; - -function TestChannel() { - this.state = "initial"; - this.testListener = new TestStreamListener(); - this._throttleQueue = null; + } } -TestChannel.prototype = { + +class TestChannel { + constructor() { + this.state = "initial"; + this.testListener = new TestStreamListener(); + this._throttleQueue = null; + } QueryInterface() { return this; - }, + } get throttleQueue() { return this._throttleQueue; - }, + } set throttleQueue(q) { this._throttleQueue = q; this.state = "throttled"; - }, + } setNewListener(listener) { this.listener = listener; this.state = "listener"; return this.testListener; - }, -}; + } +} add_task(async function () { const throttler = new NetworkThrottleManager({