Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wasmtime-wasi/js-polyfill/polyfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void handleFiles(void) {
let file = document.getElementById('input').files[0]; \
let file_with_mime_type = file.slice(0, file.size, 'application/wasm'); \
let response = new Response(file_with_mime_type); \
WebAssembly.instantiateStreaming(response, imports) \
wasi_instantiateStreaming(response, imports) \
.then(obj => { \
setInstance(obj.instance); \
try { \
Expand Down
11 changes: 11 additions & 0 deletions wasmtime-wasi/js-polyfill/wasi.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ function handleWASIExit(e) {
}
}

// Safari doesn't have instantiateStreaming
function wasi_instantiateStreaming(response, imports) {
if (WebAssembly && WebAssembly.instantiateStreaming) {
return WebAssembly.instantiateStreaming(response, imports);
}
return response.arrayBuffer()
.then(function(buffer) {
return WebAssembly.instantiate(buffer, imports);
});
}

// The current guest wasm instance.
var currentInstance;

Expand Down