Skip to content

feat: expose inspector inspected objects - #2039

Open
satouriko wants to merge 1 commit into
denoland:mainfrom
satouriko:feat/inspector-inspected-objects
Open

feat: expose inspector inspected objects#2039
satouriko wants to merge 1 commit into
denoland:mainfrom
satouriko:feat/inspector-inspected-objects

Conversation

@satouriko

Copy link
Copy Markdown

Closes #2034.

Summary

Expose V8 Inspector's V8InspectorSession::Inspectable and
addInspectedObject APIs to Rust embedders, allowing embedder-selected values
to appear in the Inspector Console as $0 through $4.

  • add InspectableImpl and an owning Inspectable wrapper
  • allocate the C++ subclass separately from the boxed Rust implementation
  • establish the required V8 handle/context scope and Rust callback scope around get()
  • consume the Rust wrapper when transferring the C++ object into V8's unique_ptr
  • drop the Rust implementation when V8 destroys or evicts the inspected object
  • add focused tests for $0 round-trip behavior and Rust-side cleanup on eviction

Testing

  • cargo fmt --check
  • clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
  • V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo clippy --all-targets --locked -- -D clippy::all
  • V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo nextest run --all-targets --locked (288 passed)

V8's inspector keeps embedder-selected values in a session-owned history that powers the $0-$4 command-line API, but rusty_v8 did not expose Inspectable or addInspectedObject.

Rust and C++ bindings:
- add InspectableImpl and an owning Inspectable wrapper
- bridge get() through callback, handle, and context scopes
- transfer the C++ wrapper into V8 while keeping the Rust implementation in a separate allocation
- drop the Rust implementation when V8 destroys or evicts the wrapper

Tests:
- verify $0 resolves an embedder-provided value
- verify eviction drops the Rust implementation

Verification:
- cargo fmt --check
- clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
- V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo clippy --all-targets --locked -- -D clippy::all
- V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo nextest run --all-targets --locked (288 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.

Expose V8InspectorSession::Inspectable and addInspectedObject

1 participant