From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../transfer-datachannel-service-worker.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js (limited to 'testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js') diff --git a/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js new file mode 100644 index 0000000000..c1919d0b9a --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js @@ -0,0 +1,15 @@ +let channel; +let port; +onmessage = (e) => { + if (e.data.port) { + port = e.data.port; + port.onmessage = (event) => channel.send(event.data.message); + } + if (e.data.channel) { + channel = e.data.channel; + channel.onopen = () => port.postMessage("opened"); + channel.onerror = () => port.postMessage("errored"); + channel.onclose = () => port.postMessage("closed"); + channel.onmessage = (event) => port.postMessage(event.data); + } +}; -- cgit v1.2.3