Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions wasm/jsapi/esm-integration/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
rules:
- global-exports-live-bindings.tentative.any.js: [wasm-mutable-globals]
- global-exports-named-import-live-bindings.tentative.any.js: [wasm-mutable-globals]
- mutable-global-sharing.tentative.any.js: [wasm-mutable-globals]
- source-phase-string-builtins.tentative.any.js: [wasm-string-builtins]
- string-builtins.tentative.any.js: [wasm-string-builtins]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// META: global=window,dedicatedworker,jsshell

promise_test(async () => {
const m = await import("./resources/named-import-mutable-value.js");
m.setGlobal(111);
assert_equals(m.getGlobal(), 111);
assert_equals(m.readNamed(), 111);

m.setGlobal(222);
assert_equals(m.getGlobal(), 222);
assert_equals(m.readNamed(), 222);
}, "Named imports of wasm mutable globals should be live");

promise_test(async () => {
const ns = await import("./resources/js-reexport-mutable-value.js");
ns.setGlobal(333);
assert_equals(ns.getGlobal(), 333);
assert_equals(ns.mutableValue, 333);

ns.setGlobal(444);
assert_equals(ns.getGlobal(), 444);
assert_equals(ns.mutableValue, 444);
}, "JS re-export of a wasm mutable global should stay live");

promise_test(async () => {
const ns = await import("./resources/js-reexport-mutable-value.js");
assert_throws_js(TypeError, () => {
ns.mutableValue = 1;
});
}, "JS re-export of a wasm mutable global is not assignable");
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export {
mutableValue,
setGlobal,
getGlobal,
} from "./mutable-global-export.wasm";
11 changes: 11 additions & 0 deletions wasm/jsapi/esm-integration/resources/named-import-mutable-value.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {
mutableValue,
setGlobal,
getGlobal,
} from "./mutable-global-export.wasm";

export function readNamed() {
return mutableValue;
}

export { setGlobal, getGlobal };
Loading