Files
ladybird/Tests/LibWeb/Text/input/Wasm/WebAssembly-memory-reexport.html
CountBleck 826eb68ecd LibWeb: Add test ensuring re-exported Wasm memories equal the import
If a memory is imported by a Wasm instance and re-exported, the export's
value should be the exact same WebAssembly.Memory object as the
WebAssembly.Memory object passed for the import.
2025-08-23 08:26:23 +02:00

21 lines
681 B
HTML

<!doctype html>
<script src="../include.js"></script>
<script>
asyncTest(async done => {
// (module
// (import "env" "memory" (memory $mem 1))
// (export "memory" (memory $mem))
// )
const WASM_URL =
"data:application/wasm;base64,AGFzbQEAAAACDwEDZW52Bm1lbW9yeQIAAQcKAQZtZW1vcnkCAA==";
const memory = new WebAssembly.Memory({ initial: 1 });
const {
instance: { exports },
} = await WebAssembly.instantiateStreaming(fetch(WASM_URL), { env: { memory } });
println(`Re-exported memory equals imported memory: ${memory === exports.memory}`);
done();
});
</script>