tor-browser

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

commit 161de99f47d1f59387d9d65e4a94bece773d412e
parent 470c670e6275d856b8feda8804223590c3d8cd4e
Author: Saqlain <2mesaqlain@gmail.com>
Date:   Tue, 21 Oct 2025 10:29:32 +0000

Bug 1994323 [wpt PR 55435] - [webaudio-testharness] Migrate no-cors.https.html, a=testonly

Automatic update from web-platform-tests
[webaudio-testharness] Migrate no-cors.https.html

Convert no-cors.https.html from the legacy audit.js runner to pure
testharness.js

Bug: 396477778
Change-Id: Ie129efc158dc6052bc0f09356becbb6a7815de49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7021577
Reviewed-by: Michael Wilson <mjwilson@chromium.org>
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Saqlain <2mesaqlain@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1530485}

--

wpt-commits: b5d810441d3afc948b0e15b30c0f607e7ee2f8fc
wpt-pr: 55435

Diffstat:
Mtesting/web-platform/tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/no-cors.https.html | 80++++++++++++++++++++++++++++++++++---------------------------------------------
1 file changed, 34 insertions(+), 46 deletions(-)

diff --git a/testing/web-platform/tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/no-cors.https.html b/testing/web-platform/tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/no-cors.https.html @@ -7,69 +7,57 @@ </title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> - <script src="/webaudio/resources/audit.js"></script> <script src="/common/get-host-info.sub.js"></script> </head> <body> - <script id="layout-test-code"> - const audit = Audit.createTaskRunner(); + <script> + const filePath = '/webaudio/js/worklet-recorder.js'; - setup(() => { + promise_test(async () => { const context = new AudioContext(); - context.suspend(); + await context.suspend(); const host_info = get_host_info(); const audioElement = document.createElement('audio'); audioElement.loop = true; const wav = - host_info.HTTPS_ORIGIN + '/webaudio/resources/4ch-440.wav?' + - 'pipe=header(access-control-allow-origin,*)'; + `${host_info.HTTPS_ORIGIN}/webaudio/resources/4ch-440.wav?` + + `pipe=header(access-control-allow-origin,*)`; audioElement.src = - host_info.HTTPS_REMOTE_ORIGIN + - '/fetch/api/resources/redirect.py?location=' + + `${host_info.HTTPS_REMOTE_ORIGIN}` + + `/fetch/api/resources/redirect.py?location=` + encodeURIComponent(wav); - let source; - let workletRecorder; - audit.define( - {label: 'setting-up-graph'}, - (task, should) => { - source = new MediaElementAudioSourceNode(context, { - mediaElement: audioElement - }); - workletRecorder = new AudioWorkletNode( - context, 'recorder-processor', {channelCount: 4}); - source.connect(workletRecorder).connect(context.destination); - task.done(); - }); + await context.audioWorklet.addModule(filePath); - // The recorded data from MESN must be non-zero. The source file contains - // 4 channels of sine wave. - audit.define( - {label: 'start-playback-and-capture'}, - (task, should) => { - workletRecorder.port.onmessage = (event) => { - if (event.data.type === 'recordfinished') { - for (let i = 0; i < event.data.recordBuffer.length; ++i) { - const channelData = event.data.recordBuffer[i]; - should(channelData, `Recorded channel #${i}`) - .beConstantValueOf(0); - } - } + const source = new MediaElementAudioSourceNode(context, { + mediaElement: audioElement, + }); + const workletRecorder = new AudioWorkletNode( + context, 'recorder-processor', {channelCount: 4}); + source.connect(workletRecorder).connect(context.destination); + + const recordingPromise = new Promise((resolve, reject) => { + workletRecorder.port.onmessage = (event) => { + if (event.data && event.data.type === 'recordfinished') { + resolve(event.data.recordBuffer); + } + }; + }); - task.done(); - }; + await context.resume(); + await audioElement.play(); - context.resume(); - audioElement.play(); - }); + const recordBuffer = await recordingPromise; - Promise.all([ - context.audioWorklet.addModule('/webaudio/js/worklet-recorder.js') - ]).then(() => { - audit.run(); - }); - }); + // The recorded data from MESN must be zero. + for (let i = 0; i < recordBuffer.length; ++i) { + const channelData = recordBuffer[i]; + const expected = new Float32Array(channelData.length); + assert_array_equals( + channelData, expected, `Recorded channel #${i}`); + } + }, 'cross-origin redirect with no-cors'); </script> </body> </html>