diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-06-11 00:59:24 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-11 13:38:25 +0100 |
commit | f5a978c1aa7a7086e613c7fb90772be5eee511a5 (patch) | |
tree | 2e04695b08085c7e7f1682da5ba280b1905fecd4 /Userland/Libraries/LibWeb | |
parent | a64089092fa894161442599675843dfa757b98f4 (diff) | |
download | serenity-f5a978c1aa7a7086e613c7fb90772be5eee511a5.zip |
LibWeb: Set a detach key for ArrayBuffers returned from WASM
As required by the specification:
`Set buffer.[[ArrayBufferDetachKey]] to "WebAssembly.Memory".`
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index b4bd033dc4..c071b9d705 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -441,7 +441,9 @@ JS_DEFINE_NATIVE_GETTER(WebAssemblyMemoryObject::buffer) if (!memory) return JS::js_undefined(); - return JS::ArrayBuffer::create(global_object, &memory->data()); + auto array_buffer = JS::ArrayBuffer::create(global_object, &memory->data()); + array_buffer->set_detach_key(JS::js_string(vm, "WebAssembly.Memory")); + return array_buffer; } } |