[webkit-changes] [WebKit/WebKit] 2596e1: [JSC] add support for `Uint8Array.prototype.toBase...

Devin Rousso noreply at github.com
Wed Jul 3 20:20:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2596e190eeb8bcb7062e415c7896c7f875e0d080
      https://github.com/WebKit/WebKit/commit/2596e190eeb8bcb7062e415c7896c7f875e0d080
  Author: Devin Rousso <hi at devinrousso.com>
  Date:   2024-07-03 (Wed, 03 Jul 2024)

  Changed paths:
    A JSTests/stress/uint8array-toBase64.js
    A JSTests/stress/uint8array-toHex.js
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/runtime/CommonIdentifiers.h
    A Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp
    M Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.h
    M Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeInlines.h
    M Source/JavaScriptCore/runtime/OptionsList.h

  Log Message:
  -----------
  [JSC] add support for `Uint8Array.prototype.toBase64` and `Uint8Array.prototype.toHex`
https://bugs.webkit.org/show_bug.cgi?id=274635

Reviewed by Yusuke Suzuki.

These methods will make it easier for developers to encode 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/JSGenericTypedArrayViewPrototype.h:
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeInlines.h:
(JSC::JSGenericTypedArrayViewPrototype<ViewClass>::finishCreation):
* Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp: Added.
(JSC::uint8ArrayPrototypeToBase64):
(JSC::uint8ArrayPrototypeToHex):

* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
Create builtin identifiers for `alphabet` and `omitPadding`.

* Source/JavaScriptCore/runtime/OptionsList.h:
Add a `useUint8ArrayBase64Methods` feature flag for these new methods (and the others that are part of the proposal that haven't been implemented yet).

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:

* JSTests/stress/uint8array-toBase64.js: Added.
* JSTests/stress/uint8array-toHex.js: Added.

Canonical link: https://commits.webkit.org/280654@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list