mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 22:49:47 +00:00
This commit adds the toResizableBuffer() and toFixedLengthBuffer() methods to WebAssembly.Memory. This includes the necessary hook to HostResizeArrayBuffer. Some modifications to function signatures in LibWeb/WebAssembly/Memory.h were also made (changing the return type from WebIDL::ExceptionOr to JS::ThrowCompletionOr) to allow the use of some code in the aforementioned hook. Note: the hook for HostGrowSharedArrayBuffer isn't implemented, since LibJS doesn't seem to have complete support for growable SharedArrayBuffers; the relevant methods/getters don't even exist on the prototype, let alone HostGrowSharedArrayBuffer! This should help pass the WebAssembly.Memory WPT tests included in Interop 2025, except those pertaining to growable SharedArrayBuffers.
18 lines
588 B
Text
18 lines
588 B
Text
dictionary MemoryDescriptor {
|
|
required [EnforceRange] unsigned long initial;
|
|
[EnforceRange] unsigned long maximum;
|
|
// https://webassembly.github.io/threads/js-api/index.html#dictdef-memorydescriptor
|
|
boolean shared = false;
|
|
};
|
|
|
|
// https://webassembly.github.io/spec/js-api/#memories
|
|
[LegacyNamespace=WebAssembly, Exposed=*]
|
|
interface Memory {
|
|
constructor(MemoryDescriptor descriptor);
|
|
|
|
unsigned long grow([EnforceRange] unsigned long delta);
|
|
|
|
ArrayBuffer toFixedLengthBuffer();
|
|
ArrayBuffer toResizableBuffer();
|
|
readonly attribute ArrayBuffer buffer;
|
|
};
|