Skip to content

feat(engine): add JsArrayBuffer::to_vec for copying bytes#4976

Merged
jedel1043 merged 1 commit intoboa-dev:mainfrom
alienx5499:feat/4974-jsarraybuffer-to-vec
Mar 9, 2026
Merged

feat(engine): add JsArrayBuffer::to_vec for copying bytes#4976
jedel1043 merged 1 commit intoboa-dev:mainfrom
alienx5499:feat/4974-jsarraybuffer-to-vec

Conversation

@alienx5499
Copy link
Copy Markdown
Contributor

This Pull Request fixes/closes #4974.

It changes the following:

  • Add JsArrayBuffer::to_vec(&self) -> Option<Vec<u8>> helper to copy buffer contents into a fresh Vec<u8> while returning None when the buffer has been detached
  • Add a doc comment and example for JsArrayBuffer::to_vec, including both normal and detached cases
  • Add small unit tests (array_buffer_to_vec_roundtrip_and_detach and array_buffer_to_vec_empty) to cover round-trip, detach, and empty-buffer behavior

Testing:

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

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

github-actions bot commented Mar 9, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,713 49,713 0
Ignored 2,262 2,262 0
Failed 988 988 0
Panics 0 0 0
Conformance 93.86% 93.86% 0.00%

Tested main commit: 683d483bd03eba9f644a71d023704e35be32974f
Tested PR commit: ee8be0b422146623b8dbf3d0cff7f74e82d2d722
Compare commits: 683d483...ee8be0b

@alienx5499 alienx5499 force-pushed the feat/4974-jsarraybuffer-to-vec branch from 6c1d222 to ee8be0b Compare March 9, 2026 18:50
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.35%. Comparing base (6ddc2b4) to head (ee8be0b).
⚠️ Report is 796 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #4976       +/-   ##
===========================================
+ Coverage   47.24%   58.35%   +11.11%     
===========================================
  Files         476      556       +80     
  Lines       46892    61153    +14261     
===========================================
+ Hits        22154    35688    +13534     
- Misses      24738    25465      +727     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@alienx5499
Copy link
Copy Markdown
Contributor Author

Hi @jedel1043
This PR is ready for review. Would appreciate your feedback when you have time.
Thanks!

Copy link
Copy Markdown
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jedel1043 jedel1043 added this pull request to the merge queue Mar 9, 2026
Merged via the queue into boa-dev:main with commit ef8dbea Mar 9, 2026
19 checks passed
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: add JsArrayBuffer::to_vec() for copying bytes

2 participants