[Webkit-unassigned] [Bug 221879] New: Class not recognized in AudioWorklet when module is imported in two different ways
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun Feb 14 14:37:54 PST 2021
https://bugs.webkit.org/show_bug.cgi?id=221879
Bug ID: 221879
Summary: Class not recognized in AudioWorklet when module is
imported in two different ways
Product: WebKit
Version: Safari Technology Preview
Hardware: Mac (Intel)
OS: macOS 11
Status: NEW
Severity: Minor
Priority: P2
Component: Web Audio
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jeff.t.kaufman at gmail.com
CC: cdumez at apple.com
I have an AudioWorklet with:
class AudioChunk { ... }
function thaw_audio_chunk(o) {
return new AudioChunk(...)
}
This is fine in Firefox and Chrome, but in Safari it throws:
ReferenceError: Can't find variable: AudioChunk
thaw_audio_chunk at https://www.jefftk.com/test/safari-audio-worklet-error2/audio-worklet.js:126:24
handle_message at https://www.jefftk.com/test/safari-audio-worklet-error2/audio-worklet.js:669:33
@https://www.jefftk.com/test/safari-audio-worklet-error2/audio-worklet.js:521:30
try_do at https://www.jefftk.com/test/safari-audio-worklet-error2/audio-worklet.js:544:15
@https://www.jefftk.com/test/safari-audio-worklet-error2/audio-worklet.js:520:20
Here is a standalone version that reproduces the bug reliably on my machine: https://www.jefftk.com/test/safari-audio-worklet-error2/ After pressing "start", giving mic permission, and waiting a few seconds you should see "This app has crashed. We're really sorry :-(" and that stack trace.
Part of why it happens is that I am loading the worklet script two different ways:
audio-worklet.js:
if (typeof AudioWorkletProcessor === "undefined") {
// do nothing
} else {
class AudioChunk { ... }
...
}
app.js
import './audio-worklet.js';
...
await this.audioCtx.audioWorklet.addModule('audio-worklet.js');
...
This is a hack that I started doing because it got me better error messages in Chrome. Removing it is sufficient to stop triggering the bug in Safari: https://www.jefftk.com/test/safari-audio-worklet-error3/
Something else is also necessary to trigger it, however, because when I tried to make a very simple version that replicated this situation did not trigger it: https://www.jefftk.com/test/worklet-invoker This prints "success" in Firefox, Chrome, and Safari, and does not throw.
This was easy to work around once I figured it out, since I can stop doing the silly load-it-both-ways thing, but I wanted to report it in case having the repro is useful.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210214/92186409/attachment.htm>
More information about the webkit-unassigned
mailing list