Skip to content

feat(engine): add JsUint8Array::to_vec for copying viewed bytes#4932

Open
alienx5499 wants to merge 2 commits intoboa-dev:mainfrom
alienx5499:fix/4722-jstypedarray-to-vec-u8
Open

feat(engine): add JsUint8Array::to_vec for copying viewed bytes#4932
alienx5499 wants to merge 2 commits intoboa-dev:mainfrom
alienx5499:fix/4722-jstypedarray-to-vec-u8

Conversation

@alienx5499
Copy link

This Pull Request fixes/closes #4722.

It changes the following:

  • Add SliceRef::to_vec() helper to copy buffer data (including AtomicSlice) into Vec<u8>
  • Add JsUint8Array::to_vec(&mut Context) to copy the viewed byte range of a JsUint8Array into a Vec<u8>
  • Add a small round-trip test (uint8_array_to_vec_roundtrip) and a doc example for JsUint8Array::to_vec

Testing:

  • cargo test -p boa_engine (including the new unit test and doctest)

@alienx5499 alienx5499 requested a review from a team as a code owner March 7, 2026 19:18
@github-actions
Copy link

github-actions bot commented Mar 7, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,687 49,687 0
Ignored 2,262 2,262 0
Failed 1,014 1,014 0
Panics 0 0 0
Conformance 93.81% 93.81% 0.00%

Tested main commit: 34ca7f1f404c2712d6897c3e39e5f5e981ce9ed6
Tested PR commit: eeab895384fb3f692b208674c8a00b0b8b74c2e7
Compare commits: 34ca7f1...eeab895

@alienx5499
Copy link
Author

Hi @jedel1043,
I’d appreciate a review when you get time.

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.

Rust API improvement: extracting bytes from JsTypedArray

1 participant