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

Throwing when converting detached ArrayBuffers is not what browsers do #352

Closed
domenic opened this issue Apr 28, 2017 · 5 comments
Closed

Comments

@domenic
Copy link
Member

domenic commented Apr 28, 2017

Test: https://jsbin.com/qusumat/edit?html,console

I will remove this in my upcoming [AllowShared] PR. I was already finding it weird that we threw for detached buffers, but not for detached typed arrays surrounding detached buffers.

domenic added a commit that referenced this issue Apr 28, 2017
Previous to this commit, any API that accepted any of the buffer source types would also accept a SharedArrayBuffer. This was not the approach we want; instead, we want APIs to explicitly opt-in. Enabled by previous work creating annotated types, this adds the new [AllowShared] extended attribute to allow APIs to opt in to accepting SharedArrayBuffers.

While here, this removes an unimplemented check for detached array buffers when converting from ES values to IDL types, fixing #352.
@annevk
Copy link
Member

annevk commented Apr 29, 2017

Is JavaScript now aligned with implementations on ArrayBuffer around this? I believe some folks still tried to make them throw for more things.

@annevk
Copy link
Member

annevk commented Apr 29, 2017

Also note that for the APIs you tested browsers might not use IDL's copying infrastructure since that's not the option that yields the best performance.

@domenic
Copy link
Member Author

domenic commented Apr 29, 2017

Is JavaScript now aligned with implementations on ArrayBuffer around this? I believe some folks still tried to make them throw for more things.

No. I thought we'd best remove any aspirational stuff at least for now, especially given the inconsistency.

Also note that for the APIs you tested browsers might not use IDL's copying infrastructure since that's not the option that yields the best performance.

It's independent of the copy/reference; it should occur whenever converting a buffer source type to IDL, which happens before any algorithm steps.

@annevk
Copy link
Member

annevk commented Apr 30, 2017

So what happens instead, we'll just treat it as an empty buffer?

I guess what I'm wondering about is whether we should leave some kind of issue marker in for the aspirational stuff or whether everyone is down with just giving up.

domenic added a commit that referenced this issue May 3, 2017
Previous to this commit, any API that accepted any of the buffer source types would also accept a SharedArrayBuffer. This was not the approach we want; instead, we want APIs to explicitly opt-in. Enabled by previous work creating annotated types, this adds the new [AllowShared] extended attribute to allow APIs to opt in to accepting SharedArrayBuffers.

While here, this removes an unimplemented check for detached array buffers when converting from ES values to IDL types, fixing #352.
@domenic
Copy link
Member Author

domenic commented May 10, 2017

Fixed by c59bdcb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants