-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[JSC] add support for Uint8Array.fromBase64
and Uint8Array.prototype.setFromBase64
#30821
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
Conversation
EWS run on previous version of this PR (hash cb3ed88) |
EWS run on previous version of this PR (hash 754f1bb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
size_t read = 0; | ||
size_t length = static_cast<size_t>(string.length()); | ||
|
||
Vector<uint8_t> bytes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is worth having a inlineCapacity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what size would you recommend?
base64DecodeInternal
seems to use a Vector
with a minCapacity
of 16
, but that seems to be entirely different from inlineCapacity
EWS run on current version of this PR (hash aba268e) |
…pe.setFromBase64` https://bugs.webkit.org/show_bug.cgi?id=276215 Reviewed by Yusuke Suzuki. These methods will make it easier for developers to decode typed character/byte data. Note that there are other methods in the related proposal, but for ease of reviewing they will be implemented separately. Spec: <https://tc39.es/proposal-arraybuffer-base64/spec/> Proposal: <https://github.com/tc39/proposal-arraybuffer-base64> * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructor.h: * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::finishCreation): * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructor.cpp: (JSC::uint8ArrayConstructorFromBase64): Added. * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.h: * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeInlines.h: (JSC::JSGenericTypedArrayViewPrototype<ViewClass>::finishCreation): * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp: (JSC::uint8ArrayPrototypeSetFromBase64): Added. * Source/JavaScriptCore/runtime/JSGenericTypedArrayView.h: * Source/JavaScriptCore/runtime/JSGenericTypedArrayView.cpp: Added. (JSC::fromBase64): Create shared utility file for special base64 parsing logic. * Source/JavaScriptCore/runtime/CommonIdentifiers.h: Create builtin identifier for `lastChunkHandling`. * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: * Source/JavaScriptCore/Sources.txt: * JSTests/stress/uint8array-fromBase64.js: Added. * JSTests/stress/uint8array-setFromBase64.js: Added. * JSTests/stress/uint8array-fromHex.js: * JSTests/stress/uint8array-setFromHex.js: * JSTests/stress/uint8array-toBase64.js: * JSTests/stress/uint8array-toHex.js: Drive-by: fix a few invalid tests and check that things that should throw actually do. Canonical link: https://commits.webkit.org/281014@main
aba268e
to
ca33dbd
Compare
Committed 281014@main (ca33dbd): https://commits.webkit.org/281014@main Reviewed commits have been landed. Closing PR #30821 and removing active labels. |
ca33dbd
aba268e