-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use Primordials for accessing ".buffer" properties in objects #11355
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Ah, I forgot about this! I'll get around it soon. (Currently blocked on SharedArrayBuffer prototype being in the snapshot) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
Originally posted by @crimsoncodes0 in #11224 (comment)
I could easily implement a small utility/helper function for accessing the buffer of an object that has been verified to be a WebIDL BufferSource via primordials.
Somewhat related, because I'd have naturally used something like this in the function's implementation, some of the internal code might be best written with assertions that abort the entire process. E.g. HTML spec assertions are use in a way that they are intended to be completely unreachable, and can be entirely eluded by implementers.
For example, the Request class's implementation has an assertion that simply throws a catch-able JavaScript error. Might I suggest that
Deno.exit
or something of the sort is called to indicate that the internal code should have never been reached (analogous to a Rustunreachable!(...)
)?Otherwise usage of the primordials for these situations would be as simple as checking that object is of the correct type (which is already done), and then calling the helper on the object to receive it's internal
ArrayBuffer
. (I'd be happy to rewrite any code to use primordials for buffer access too :))The text was updated successfully, but these errors were encountered: