Repository navigation
fix(ext/web): mark special properties when inspecting buffers and DataView - #36929
Open
Kjubikstronk wants to merge 1 commit into
Open
Kjubikstronk wants to merge 1 commit into
Kjubikstronk wants to merge 1 commit into
Conversation
NetOpWibby
pushed a commit
to theende/ende
that referenced
this pull request
Nov 8, 2026
…aView The byteLength of an ArrayBuffer or SharedArrayBuffer and the byteLength, byteOffset and buffer of a DataView are prototype getters, not own properties, but the inspector printed them like own properties. Print them in brackets, like the typed array entries shown with showHidden and like Node.js, after the formatter output. This also fixes inspecting a DataView whose buffer was detached or shrunk, which printed "[Internal Formatting Error] TypeError: Cannot perform get DataView.prototype.byteLength on a detached or out-of-bounds ArrayBuffer": when a getter throws, the key is read from the buffer instead. (cherry picked from commit fffc0380d00942d0e87283e34f5be950e5d7028d) Upstream: denoland/deno#36929
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Node marks the
byteLength,byteOffsetandbufferentries of ArrayBuffers, SharedArrayBuffers and DataViews with brackets, since they are not own properties (nodejs/node#60131 and nodejs/node#60479). Deno still prints them like regular properties:Node:
Deno:
This ports that change to
ext/web/console/inspect.rs. The keys are printed as extra entries after the formatter output instead of being added to the property list, and the typed arrayshowHiddenentries, which already had brackets, go through the same path now.It also fixes inspecting a DataView whose buffer was detached. That currently prints
[Internal Formatting Error] TypeError: Cannot perform get DataView.prototype.byteLength on a detached or out-of-bounds ArrayBufferand a stack trace. Like Node, the key is now read from the buffer instead when the getter throws.Since this is the shared formatter,
console.logandDeno.inspectchange too. I updated the three affected expectations intests/unit/console_test.tsand added a test for DataViews, typed arrays withshowHiddenand the detached case.One intentional difference: for a detached DataView, Node's
formatExtraPropertiesraisesctx.indentationLvlbefore the getter throws and never lowers it, so that DataView and everything after it in the sameinspectcall ends up indented 4 spaces too far. Deno indents it normally.test-util-inspect.jsasserts Node's output there (line 217), so if you would rather match it exactly, I can change that.I compared Deno and Node 24.19 for 23 inputs (ArrayBuffers, SharedArrayBuffers, detached buffers, DataViews with and without own properties, typed arrays with
showHidden, colors,depth,maxArrayLength,breakLengthandcompact). 21 differed before this change. Now only the detached DataView differs, as described above.With this, #36927 and #36928 applied together,
test-util-format.jspasses (cargo test --test node_compat -- test-util-format), so it can go intoconfig.jsonconce all three have landed. This PR and #36927 both change one line (the short{ [byteLength]: n }form); I will resolve that on whichever lands second.AI disclosure: this change and this description were written with Claude Code (Anthropic). The Node comparison and the tests mentioned above were run locally.