Skip to content

Commit

Permalink
Update to a newer version of the polyfill.
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfishcode committed May 10, 2019
1 parent 2d853b6 commit 85fab7f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion polyfill/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,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 Expand Up @@ -2180,7 +2191,7 @@ Module['asm'] = function(global, env, providedBuffer) {

// === Body ===

var ASM_CONSTS = [function() { const imports = { wasi_unstable: WASIPolyfill }; 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) .then(obj => { setInstance(obj.instance); try { obj.instance.exports._start(); } catch (e) { if (e instanceof WASIExit) { handleWASIExit(e); } else { } } }) .catch(error => { console.log('error! ' + error); }); }];
var ASM_CONSTS = [function() { const imports = { wasi_unstable: WASIPolyfill }; 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); wasi_instantiateStreaming(response, imports) .then(obj => { setInstance(obj.instance); try { obj.instance.exports._start(); } catch (e) { if (e instanceof WASIExit) { handleWASIExit(e); } else { } } }) .catch(error => { console.log('error! ' + error); }); }];

function _emscripten_asm_const_i(code) {
return ASM_CONSTS[code]();
Expand Down
Binary file modified polyfill/polyfill.wasm
Binary file not shown.

0 comments on commit 85fab7f

Please sign in to comment.