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

"Convert a value to a key" should return invalid for detached array buffers #440

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6366,9 +6366,11 @@ steps may throw an exception.
<!-- Binary -->
: If |input| is a [=buffer source type=]
::
1. If [$IsDetachedBuffer$](|input|) is true then return invalid.
Copy link
Member

Choose a reason for hiding this comment

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

IsDetachedBuffer() takes an ArrayBuffer or a SharedArrayBuffer, but buffer source type includes the views. I think you'll need to dig the buffer out of the view in those cases?

Copy link
Contributor Author

@SteveBeckerMSFT SteveBeckerMSFT Feb 26, 2025

Choose a reason for hiding this comment

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

Thanks for the review! I got the new steps from the WebIDL spec here:

https://webidl.spec.whatwg.org/#buffersource-detached

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the latest revision to use the shorthand for these steps.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome. This all seemed very familiar... whatwg/webidl#1420 ... apparently we needed something similar over in WebNN. :)


1. Let |bytes| be the result of
[=/get a copy of the buffer source|getting a copy of the bytes held by the buffer source=]
|input|. Rethrow any exceptions.
|input|.

1. Return a new [=/key=] with [=key/type=]
*binary* and [=key/value=] |bytes|.
Expand Down