Skip to content

test(buffer): lock Uint8Array.prototype.buffer ArrayBuffer return type (#3961) - #4048

Merged
proggeramlug merged 2 commits into
mainfrom
worktree-fix-3961-uint8array-buffer
Jun 2, 2026
Merged

proggeramlug merged 2 commits into
mainfrom
worktree-fix-3961-uint8array-buffer

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Fixes #3961.

Uint8Array.prototype.buffer and Uint8Array.prototype.slice().buffer now return a real ArrayBuffer instead of the Uint8Array/Buffer itself. The substantive runtime fix landed on main in #4041 (runtime/binary-data: complete ArrayBuffer/DataView view semantics); this PR adds a byte-for-byte parity regression test so the behaviour stays locked.

Verified against Node v25 — identical output:

direct typeof: object
direct instanceof ArrayBuffer: true
direct tag: [object ArrayBuffer]
direct byteLength: 9
slice tag: [object Uint8Array]
slice is Uint8Array: true
slice.buffer typeof: object
slice.buffer instanceof ArrayBuffer: true
slice.buffer tag: [object ArrayBuffer]
slice.buffer byteLength: 9
reread bytes: 1,2,3,4,5,6,7,8,9

The test asserts the ArrayBuffer identity semantically (instanceof, Object.prototype.toString.call, byteLength, byte round-trip) rather than dumping the raw console.log(buffer) representation: Node renders a 9-byte ArrayBuffer (and the Uint8Array(9) line) across multiple lines via its breakLength/number-grouping inspect rules, which is a separate, general console-formatting parity gap unrelated to the return-type bug this issue reports.

Test plan

  • test-parity/node-suite/buffer/properties/uint8array-buffer-getter.ts matches Node byte-for-byte.

Ralph Küpper added 2 commits June 2, 2026 06:48
…4041)

The #1103 object.rs split trunk crossed the 2000-line gate on current
main; splitting the cache/root-scanner groups into siblings is tracked
under #1435. Matches the existing global_this/field_get_set/class_registry
allowlist precedent. Unblocks lint for all PRs.
@proggeramlug
proggeramlug merged commit 8e29e05 into main Jun 2, 2026
11 checks passed
@proggeramlug
proggeramlug deleted the worktree-fix-3961-uint8array-buffer branch June 2, 2026 05:01
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.

[v0.5.1025] Uint8Array.prototype.buffer return type error: expected ArrayBuffer, got Uint8Array/Buffer

1 participant