summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/memory-sharing-off.js
blob: f3588c98b1c7b20772f2f5330559d3cb3a89f793 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// |jit-test| --shared-memory=off; skip-if: !wasmThreadsEnabled()

// A module using shared memory should be convertable from text to binary even
// if shared memory is disabled.

var bin = wasmTextToBinary('(module (memory 1 1 shared))');

// But we should not be able to validate it:

assertEq(WebAssembly.validate(bin), false);

// Nor to compile it:

assertErrorMessage(() => new WebAssembly.Module(bin),
		   WebAssembly.CompileError,
		   /shared memory is disabled/);

// We also should not be able to create a shared memory by itself:

assertErrorMessage(() => new WebAssembly.Memory({initial: 1, maximum: 1, shared: true}),
		   WebAssembly.LinkError,
		   /shared memory is disabled/);