Accept SharedArrayBuffers as input

This commit is contained in:
Alex Hultman 2021-04-20 22:53:49 +02:00
parent 324b5145d9
commit 9af80e10ce

View File

@ -111,6 +111,11 @@ public:
ArrayBuffer::Contents contents = arrayBuffer->GetContents(); ArrayBuffer::Contents contents = arrayBuffer->GetContents();
length = contents.ByteLength(); length = contents.ByteLength();
data = (char *) contents.Data(); data = (char *) contents.Data();
} else if (value->IsSharedArrayBuffer()) {
Local<SharedArrayBuffer> arrayBuffer = Local<SharedArrayBuffer>::Cast(value);
SharedArrayBuffer::Contents contents = arrayBuffer->GetContents();
length = contents.ByteLength();
data = (char *) contents.Data();
} else { } else {
invalid = true; invalid = true;
} }