be explicit about where the related wasm file is fetched

This commit is contained in:
Raymond Hill 2018-11-04 18:52:25 -02:00
parent 64da8b9509
commit 95899a0d1d
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 4 additions and 1 deletions

View File

@ -472,6 +472,9 @@ const hnTrieManager = {
uint32s[0] = 1;
if ( uint8s[0] !== 1 ) { return; }
// The directory from which the current script was fetched should also
// contain the related WASM file. The script is fetched from a trusted
// location, and consequently so will be the related WASM file.
let workingDir;
{
const url = document.currentScript.src;
@ -484,7 +487,7 @@ const hnTrieManager = {
const memory = new WebAssembly.Memory({ initial: 1 });
hnTrieManager.wasmLoading = WebAssembly.instantiateStreaming(
fetch(workingDir + 'wasm/hntrie.wasm', { mode: 'same-origin' }),
fetch(workingDir + 'wasm/hntrie.wasm'),
{ imports: { memory } }
).then(result => {
hnTrieManager.wasmLoading = null;