Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ArrayBuffer::was_detached() #1103

Merged
merged 3 commits into from
Oct 16, 2022

Conversation

marcosc90
Copy link
Contributor

@marcosc90 marcosc90 commented Oct 16, 2022

This PR adds ArrayBuffer::was_detached().

While there's no WasDetached method on ArrayBuffer, while going through the code I noticed there is one in JSArrayBufferView that we could use.

Currently, Deno has no reliable way to check if an ArrayBuffer was detached. With this commit, we'll be able to make Streams and structuredClone spec-compliant.

@CLAassistant
Copy link

CLAassistant commented Oct 16, 2022

CLA assistant check
All committers have signed the CLA.

@andreubotella
Copy link
Contributor

andreubotella commented Oct 16, 2022

I opened https://crbug.com/v8/13159 and https://crrev.com/c/3810345 upstream to add this as a method of ArrayBuffer. But this can land in Deno/rusty_v8 in the meantime, I guess.

src/binding.cc Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @marcosc90!

@bartlomieju bartlomieju merged commit c06986c into denoland:main Oct 16, 2022
@marcosc90 marcosc90 deleted the arraybuffer-is-detached branch October 16, 2022 20:12
andreubotella added a commit to andreubotella/rusty_v8 that referenced this pull request Nov 21, 2022
In denoland#1103, the `ArrayBuffer::was_detached` method was added to rusty_v8
to fill a gap in the C++ API, and it was implemented using the
internal `v8::Utils::OpenHandle`. Since then, a `WasDetached` method
was added to `ArrayBuffer` in V8 10.9. This PR updates the
implementation to use that.
bartlomieju pushed a commit that referenced this pull request Nov 21, 2022
In #1103, the `ArrayBuffer::was_detached` method was added to rusty_v8
to fill a gap in the C++ API, and it was implemented using the
internal `v8::Utils::OpenHandle`. Since then, a `WasDetached` method
was added to `ArrayBuffer` in V8 10.9. This PR updates the
implementation to use that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants