You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix broken JS glue for AUDIO_WORKLETS with EXPORT_ES6 (#21192)
WASM Audio Worklets with EXPORT_ES6 may break at runtime:
test.js:989 Uncaught (in promise) TypeError: Cannot set property wasmTable of #<Object> which has only a getter
at receiveInstance (test.js:989:25)
at receiveInstantiationResult (test.js:1011:5)
The read-only getter at issue is created in ASSERTIONS-enabled
builds, and conflicts with the current way of exporting wasmTable
on the Module object.
Exporting wasmTable via EXPORTED_RUNTIME_METHODS prevents the getter
from being created in normal builds. In MINIMAL_RUNTIME builds, we
make sure to delete the getter before manually exporting as before.
We also prevent an ES6 Audio Worklet from loading the .wasm binary
via `new URL()`, as `URL` is unavailable in AudioWorkletGlobalScope.
#if EXPORT_ES6&&USE_ES6_IMPORT_META&&!SINGLE_FILE// in single-file mode, repeating WASM_BINARY_FILE would emit the contents again
618
+
#if EXPORT_ES6&&USE_ES6_IMPORT_META&&!SINGLE_FILE&&!AUDIO_WORKLET// In single-file mode, repeating WASM_BINARY_FILE would emit the contents again. For an Audio Worklet, we cannot use `new URL()`.
619
619
}else{
620
620
#if ENVIRONMENT_MAY_BE_SHELL
621
621
if(ENVIRONMENT_IS_SHELL)
@@ -1000,13 +1000,6 @@ function createWasm() {
1000
1000
#if ASSERTIONS&&!PURE_WASI
1001
1001
assert(wasmTable,'table not found in wasm exports');
1002
1002
#endif
1003
-
1004
-
#if AUDIO_WORKLET
1005
-
// If we are in the audio worklet environment, we can only access the Module object
1006
-
// and not the global scope of the main JS script. Therefore we need to export
1007
-
// all functions that the audio worklet scope needs onto the Module object.
0 commit comments