tor-browser

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

commit 03725a4aff91077c58e896e8c6ed81cdd7a2119f
parent dd9201c1e643ca20a85187686c7d8523e37c70a5
Author: Byron Campen <docfaraday@gmail.com>
Date:   Wed, 29 Oct 2025 12:35:15 +0000

Bug 1988096: Test that ids are reusable as soon as the close event fires. r=jib

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

Diffstat:
Mtesting/web-platform/tests/webrtc/RTCDataChannel-id.html | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/webrtc/RTCDataChannel-id.html b/testing/web-platform/tests/webrtc/RTCDataChannel-id.html @@ -4,6 +4,7 @@ <script src=/resources/testharness.js></script> <script src=/resources/testharnessreport.js></script> <script src="RTCPeerConnection-helper.js"></script> +<script src="RTCDataChannel-helper.js"></script> <script> 'use strict'; @@ -212,6 +213,36 @@ promise_test(async (t) => { } }, 'Odd/even role should not be violated when mixing with negotiated channels'); +promise_test(async t => { + const offerer = new RTCPeerConnection(); + const answerer = new RTCPeerConnection(); + t.add_cleanup(() => offerer.close()); + t.add_cleanup(() => answerer.close()); + + const pairPromise = openChannelPair(offerer, answerer, 'foo'); + await negotiate(offerer, answerer); + + const [dco, dca] = await pairPromise; + + const id = dco.id; + assert_equals(dca.id, id, 'ids should match'); + + async function waitForCloseThenReCreate(channel, pc) { + await new Promise(r => channel.onclose = r); + return pc.createDataChannel('bar', {negotiated: true, id}); + } + + dco.close(); + + const [dco2, dca2] = await Promise.all([ + waitForCloseThenReCreate(dco, offerer), + waitForCloseThenReCreate(dca, answerer) + ]); + + assert_equals(dco2.id, id, 'Id should be reused (closer)'); + assert_equals(dca2.id, id, 'Id should be reused (closee)'); +}, 'Test that ids are reusable after close event'); + /* Create 32768 (client), 32767 (server) channels to make sure all ids are exhausted AFTER establishing a peer connection.