diff --git a/testing/web-platform/tests/mediacapture-insertable-streams/VideoTrackGenerator-with-window-tracks.https.html b/testing/web-platform/tests/mediacapture-insertable-streams/VideoTrackGenerator-with-window-tracks.https.html index 36fc4135e2344..dfe000fbddb6c 100644 --- a/testing/web-platform/tests/mediacapture-insertable-streams/VideoTrackGenerator-with-window-tracks.https.html +++ b/testing/web-platform/tests/mediacapture-insertable-streams/VideoTrackGenerator-with-window-tracks.https.html @@ -64,11 +64,15 @@

Description

const blob = new Blob([script], { type: 'text/javascript' }); const url = URL.createObjectURL(blob); const worker = new Worker(url); - await new Promise(resolve => worker.onmessage = () => { - resolve(); - }); - URL.revokeObjectURL(url); - return worker; + try { + await new Promise((resolve, reject) => { + worker.onmessage = resolve; + worker.onerror = (err) => reject(err.message); + }); + return worker; + } finally { + URL.revokeObjectURL(url); + } } promise_test(async t => {