mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Add a basic test for [EnforceRange]
This is a basic test - but does cover the two bugs in the previous two commits.
This commit is contained in:
parent
7abedd2fed
commit
9dc2b0bba3
Notes:
sideshowbarker
2024-07-17 03:00:02 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/9dc2b0bba3 Pull-request: https://github.com/SerenityOS/serenity/pull/23764 Reviewed-by: https://github.com/kennethmyhra ✅
2 changed files with 22 additions and 0 deletions
3
Tests/LibWeb/Text/expected/Wasm/WebAssembly-grow.txt
Normal file
3
Tests/LibWeb/Text/expected/Wasm/WebAssembly-grow.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Made memory [object WebAssembly.Memory] with buffer [object ArrayBuffer] (byteLength 655360)
|
||||
After growing buffer (byteLength 983040)
|
||||
Got error: 'RangeError: Number '4294967296' is outside of allowed range of 0 to 4294967295'
|
19
Tests/LibWeb/Text/input/Wasm/WebAssembly-grow.html
Normal file
19
Tests/LibWeb/Text/input/Wasm/WebAssembly-grow.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const memory = new WebAssembly.Memory({
|
||||
initial: 10,
|
||||
maximum: 100,
|
||||
});
|
||||
|
||||
println(`Made memory ${memory} with buffer ${memory.buffer} (byteLength ${memory.buffer.byteLength})`);
|
||||
memory.grow(5);
|
||||
println(`After growing buffer (byteLength ${memory.buffer.byteLength})`);
|
||||
|
||||
try {
|
||||
memory.grow(4294967296); // 1 over max value.
|
||||
} catch (e) {
|
||||
println(`Got error: '${e}'`);
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in a new issue