mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-20 08:18:55 +00:00
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.
This commit is contained in:
parent
f2a170bcfb
commit
826eb68ecd
Notes:
github-actions[bot]
2025-08-23 06:27:45 +00:00
Author: https://github.com/CountBleck
Commit: 826eb68ecd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5889
Reviewed-by: https://github.com/alimpfard ✅
2 changed files with 21 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
Re-exported memory equals imported memory: true
|
|
@ -0,0 +1,20 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue