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

write data up until error in setFromX methods #58

Merged
merged 1 commit into from
Jun 11, 2024
Merged

Conversation

bakkot
Copy link
Collaborator

@bakkot bakkot commented Apr 15, 2024

See #57.

One difficulty is that in the case of an error there's no good way to know how many bytes were read/written. I don't think that's a problem we need to solve; in practice you are unlikely to have any way to recover in the case of an error, so you're just going to throw the buffer away.

(It would be nice for SyntaxErrors to have a standardized .offset property which told you where the error was, not just for this but also JSON.parse etc. But that's unlikely to be in this proposal.)

@bakkot
Copy link
Collaborator Author

bakkot commented Jun 11, 2024

This got consensus; landing, but I do still need to update test262 tests.

@bakkot bakkot merged commit 66fa8c8 into main Jun 11, 2024
1 check passed
@bakkot bakkot deleted the avoid-second-pass branch June 11, 2024 08:44
@ljharb
Copy link
Member

ljharb commented Jun 11, 2024

Heads up that this PR says the AO returns a record whose [[Error]] is a throw completion, but in this case it's actually an Error instance.

ljharb added a commit to es-shims/es-arraybuffer-base64 that referenced this pull request Jul 8, 2024
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jul 13, 2024
…pe.setFrom{Base64,Hex} methods. r=spidermonkey-reviewers,dminor

Change `FromHex` and `FromBase64` to accept a templated `Sink` parameter, which
either appends to a `ByteVector` or directly into the target `TypedArrayObject`.
`Uint8Array.prototype.setFrom{Base64,Hex}` now no longer have to allocate
temporary space when processing the input string.

Changes from:
tc39/proposal-arraybuffer-base64#58

Depends on D216279

Differential Revision: https://phabricator.services.mozilla.com/D216280
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jul 13, 2024
…pe.setFrom{Base64,Hex} methods. r=spidermonkey-reviewers,dminor

Change `FromHex` and `FromBase64` to accept a templated `Sink` parameter, which
either appends to a `ByteVector` or directly into the target `TypedArrayObject`.
`Uint8Array.prototype.setFrom{Base64,Hex}` now no longer have to allocate
temporary space when processing the input string.

Changes from:
tc39/proposal-arraybuffer-base64#58

Depends on D216279

Differential Revision: https://phabricator.services.mozilla.com/D216280
ErichDonGubler pushed a commit to erichdongubler-mozilla/firefox that referenced this pull request Jul 15, 2024
…pe.setFrom{Base64,Hex} methods. r=spidermonkey-reviewers,dminor

Change `FromHex` and `FromBase64` to accept a templated `Sink` parameter, which
either appends to a `ByteVector` or directly into the target `TypedArrayObject`.
`Uint8Array.prototype.setFrom{Base64,Hex}` now no longer have to allocate
temporary space when processing the input string.

Changes from:
tc39/proposal-arraybuffer-base64#58

Depends on D216279

Differential Revision: https://phabricator.services.mozilla.com/D216280
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.

2 participants