mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
21 lines
681 B
HTML
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>
|