Skip to content

Commit 7afc299

Browse files
committed
src: set ArrayBufferViewContents::WasDetached for array buffer views
Previously, this would only be set if a raw ArrayBuffer was passed, not a view on a detached ArrayBuffer.
1 parent bdf75a6 commit 7afc299

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/util-inl.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,9 +591,11 @@ void ArrayBufferViewContents<T, S>::Read(v8::Local<v8::ArrayBufferView> abv) {
591591
static_assert(sizeof(T) == 1, "Only supports one-byte data at the moment");
592592
length_ = abv->ByteLength();
593593
if (length_ > sizeof(stack_storage_) || abv->HasBuffer()) {
594-
auto buf_data = abv->Buffer()->Data();
595-
data_ = buf_data != nullptr ? static_cast<T*>(buf_data) + abv->ByteOffset()
596-
: stack_storage_;
594+
v8::Local<v8::ArrayBuffer> ab = abv->Buffer();
595+
void* ab_data = ab->Data();
596+
data_ = ab_data != nullptr ? static_cast<T*>(ab_data) + abv->ByteOffset()
597+
: stack_storage_;
598+
was_detached_ = ab->WasDetached();
597599
} else {
598600
abv->CopyContents(stack_storage_, sizeof(stack_storage_));
599601
data_ = stack_storage_;

0 commit comments

Comments
 (0)