emscripten-core / emscripten-core/emscripten

Safari / Chrome discrepancies lead to problems in instantiateWasm implementation example; Uncatchable exceptions in receiveInstance

Open
#14,777 29 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

These are two errors of two different modules (compiled under Emscripten 2.0.26):
```
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'Module["asm"]["oa"]')
receiveInstance (busybox_unstripped.js:9:10785)
promiseReactionJob

[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'Module['asm']['memory']')
receiveInstance (busytex.js:1734)
promiseReactionJob
```

I'm initialising module as:
```js
instantiateWasm(imports, successCallback)
{
WebAssembly.instantiate(wasm_module, imports).then(successCallback);
},
```
where `wasm_module` is `ArrayBuffer` (under Safari).

1. How do I make it work under Safari? :)

2. Also for some reason these Unhandled Promise Rejections do not lead to exceptions. I'm using modularised Emscripten module, so I'm doing try-catch, and await inside try. Would you know why it's not failing with an exception and how to at least handle this gracefully?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.