1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Set a detach key for ArrayBuffers returned from WASM

As required by the specification:
`Set buffer.[[ArrayBufferDetachKey]] to "WebAssembly.Memory".`
This commit is contained in:
Idan Horowitz 2021-06-11 00:59:24 +03:00 committed by Linus Groh
parent a64089092f
commit f5a978c1aa
3 changed files with 13 additions and 1 deletions

View file

@ -28,10 +28,14 @@ public:
const ByteBuffer& buffer() const { return buffer_impl(); }
Value detach_key() const { return m_detach_key; }
void set_detach_key(Value detach_key) { m_detach_key = detach_key; }
void detach_buffer() { m_buffer = Empty {}; }
bool is_detached() const { return m_buffer.has<Empty>(); }
private:
virtual void visit_edges(Visitor&) override;
ByteBuffer& buffer_impl()
{
ByteBuffer* ptr { nullptr };