Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 2 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.js - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.shadowrealm-in-dedicatedworker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.shadowrealm-in-shadowrealm.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.shadowrealm-in-sharedworker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.shadowrealm-in-window.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.any.worker.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.https.any.shadowrealm-in-audioworklet.html - WPT Dashboard Interop Dashboard
- /wasm/jsapi/esm-integration/global-exports-live-bindings.tentative.https.any.shadowrealm-in-serviceworker.html - WPT Dashboard Interop Dashboard
// META: global=window,dedicatedworker,jsshell,shadowrealm
promise_test(async () => {
const wasmExports = await import("./resources/globals.wasm");
wasmExports.setLocalMutI32(555);
assert_equals(wasmExports.getLocalMutI32(), 555);
assert_equals(wasmExports.localMutI32, 555);
wasmExports.setLocalMutI64(444n);
assert_equals(wasmExports.getLocalMutI64(), 444n);
assert_equals(wasmExports.localMutI64, 444n);
wasmExports.setLocalMutF32(3.33);
assert_equals(Math.round(wasmExports.getLocalMutF32() * 100) / 100, 3.33);
assert_equals(Math.round(wasmExports.localMutF32 * 100) / 100, 3.33);
wasmExports.setLocalMutF64(2.22);
assert_equals(wasmExports.getLocalMutF64(), 2.22);
assert_equals(wasmExports.localMutF64, 2.22);
const anotherTestObj = { another: "test object" };
wasmExports.setLocalMutExternref(anotherTestObj);
assert_equals(wasmExports.getLocalMutExternref(), anotherTestObj);
assert_equals(wasmExports.localMutExternref, anotherTestObj);
}, "Local mutable global exports should be live bindings");
promise_test(async () => {
const wasmExports = await import("./resources/globals.wasm");
wasmExports.setDepMutI32(3001);
assert_equals(wasmExports.getDepMutI32(), 3001);
assert_equals(wasmExports.depMutI32, 3001);
wasmExports.setDepMutI64(30000000001n);
assert_equals(wasmExports.getDepMutI64(), 30000000001n);
assert_equals(wasmExports.depMutI64, 30000000001n);
wasmExports.setDepMutF32(30.01);
assert_equals(Math.round(wasmExports.getDepMutF32() * 100) / 100, 30.01);
assert_equals(Math.round(wasmExports.depMutF32 * 100) / 100, 30.01);
wasmExports.setDepMutF64(300.0001);
assert_equals(wasmExports.getDepMutF64(), 300.0001);
assert_equals(wasmExports.depMutF64, 300.0001);
}, "Dep module mutable global exports should be live bindings");