tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

memory-sharing-off.js (697B)


      1 // |jit-test| --shared-memory=off; skip-if: !wasmThreadsEnabled()
      2 
      3 // A module using shared memory should be convertable from text to binary even
      4 // if shared memory is disabled.
      5 
      6 var bin = wasmTextToBinary('(module (memory 1 1 shared))');
      7 
      8 // But we should not be able to validate it:
      9 
     10 assertEq(WebAssembly.validate(bin), false);
     11 
     12 // Nor to compile it:
     13 
     14 assertErrorMessage(() => new WebAssembly.Module(bin),
     15 	   WebAssembly.CompileError,
     16 	   /shared memory is disabled/);
     17 
     18 // We also should not be able to create a shared memory by itself:
     19 
     20 assertErrorMessage(() => new WebAssembly.Memory({initial: 1, maximum: 1, shared: true}),
     21 	   WebAssembly.LinkError,
     22 	   /shared memory is disabled/);