Skip to content

feat(inspector): ns:inspector, inspector domains in JavaScript - #618

Open
edusperoni wants to merge 10 commits into
mainfrom
feat/ns-inspector
Open

edusperoni wants to merge 10 commits into
mainfrom
feat/ns-inspector

Conversation

@edusperoni

@edusperoni edusperoni commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

What is the current behavior?

JS reaches the inspector only through __registerDomainDispatcher and __inspectorSendEvent, which were designed for one client. Since #526 several clients can be connected, but these globals cannot name a client or answer asynchronously, and the runtime doesn't track who enabled a domain. So @nativescript/core enables its own domains at startup and builds events with nobody attached. Remote objects (DOM.resolveNode, DOM.requestNode, $0) can't be implemented at all.

What is the new behavior?

A new builtin module, ns:inspector. It is experimental and iOS-only for now.

import { registerDomain } from "ns:inspector";

const network = registerDomain("Network", {
  sessionEnabled(session) { /* replay state to this client */ },
  sessionClosed(session) { /* drop what was kept for it */ },
  commands: {
    async getResponseBody({ requestId }, session) {
      return { body: await bodyOf(requestId), base64Encoded: false };
    },
  },
});
network.emit("requestWillBeSent", params);

Enable and disable

  • The runtime answers enable and disable and keeps track of which clients enabled the domain.
  • It runs the enabled/disabled hooks for the first and last client, and sessionEnabled, sessionDisabled and sessionClosed for each client.
  • A client that enabled a domain before it was registered, or while it was unregistered, is enabled when the domain is registered.

Commands

  • A command may be async.
  • A throw or a rejection answers with an error. The code is the ProtocolError's code, or -32000 otherwise.
  • A reply only ever reaches the client that asked, and a reply to a client that has left is dropped.
  • Events a command emits go out before its reply.
  • A command the handlers don't define goes to V8.

Sending events

  • domain.emit reaches the clients that enabled the domain. For an alwaysEnabled domain it reaches every client.
  • session.emit reaches one client.

Remote objects

  • session.wrapObject, unwrapObject and releaseObjectGroup go through that client's own V8 session, because object ids are only valid for the client they were made for.
  • session.addInspectedObject(get) sets that client's $0.

Helpers for Network events

  • monotonicTime() uses the clock that trace events use.
  • wallTime() returns seconds since the epoch.
  • captureStackTrace() returns a Runtime.StackTrace.

Limits

  • Domains that V8 or the runtime implements are refused, and each name has one owner at a time. This works the same in every build.
  • A domain also registered with __registerDomainDispatcher is handled here.
  • Network.loadNetworkResource, IO.*, Tracing.* and Target.* stay native.
  • In release builds and in workers, the module loads but the domain does nothing.

Also in this PR

  • Vendors crdtp/json.h from the pinned V8, which is needed to turn V8's CBOR protocol objects into JSON.
  • download_v8.sh now re-vendors a checkout that doesn't have that header.
  • Types (types/ns-inspector.d.ts) and the normative section in docs/ns-builtin-modules.md.

Out of scope for now

  • Worker domains.
  • Events that carry remote objects.
  • The node:inspector shim.
  • The Android runtime.

Testing

  • Full suite: 2350 specs, 0 failures, plain and under ASan, including the new NsInspectorTests. Plain again after rebasing onto fix(inspector): console timestamps, handler errors, and promise callbacks while paused #617.
  • In a Release run, NsInspectorTests passes too, which covers the inert path. The only failures are the HTTP module tests, which Release blocks by design.
  • End to end on a simulator with a small CDP client:
    • export set, and refusal of runtime domains and of a second owner;
    • an enable sent before registration, and re-registering after unregister;
    • emit reaching only the clients that enabled the domain, and every client with alwaysEnabled;
    • two clients using the same id for async commands, each getting its own reply;
    • a reply to a client that has left reaching nobody;
    • the hook order through disable, re-enable and leaving, and sessionClosed for a client that only sent commands;
    • events before the reply;
    • ProtocolError codes, plain errors and rejections;
    • an unknown command going to V8;
    • wrap and unwrap, with one client's object id not unwrapping in another, and Runtime.getProperties on a wrapped object;
    • $0, captureStackTrace and the clocks;
    • a sync command answered at a breakpoint, while async ones, including one returning an already resolved promise, wait for the resume;
    • the native Network.loadNetworkResource still answering while a JS Network domain is registered, and unregister handing commands back to V8;
    • the module being inert in a worker.

Summary by CodeRabbit

  • New Features
    • Added the experimental iOS ns:inspector module for registering JavaScript inspector domains and handling protocol commands.
    • Domains can manage frontend sessions, send events, and use session operations to wrap, inspect, and release objects.
    • Added helpers for monotonic and wall-clock time, stack-trace capture, and protocol errors.
    • Inspector domains remain inert in release builds and workers; registration still validates names and options.
  • Documentation
    • Added API documentation and TypeScript declarations for the inspector module.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1973b526-cb58-4bb1-aff8-05a48d9779dd
Commits

Reviewing files that changed from the base of the PR and between 4f9742e and d3c90cb.

Files selected for processing: 1

  • NativeScript/inspector/JsV8InspectorClient.mm
Walkthrough

This change adds an experimental iOS ns:inspector builtin. It provides JavaScript inspector domains, session operations, protocol command handling, and timing and stack-trace helpers. It also adds native routing support, tests, type declarations, and documentation.

Changes: Inspector domain support

Layer / File(s) Summary
Inspector client routing and sessions
NativeScript/inspector/InspectorSessions.*, NativeScript/inspector/JsV8InspectorClient.*
The inspector client adds JavaScript domain registration and routing. It tracks enabled frontend connections, handles disconnects, and exposes session lookup.
Native inspector binding and build integration
NativeScript/inspector/InspectorModule.*, NativeScript/runtime/NsBuiltinModules.cpp, v8ios.xcodeproj/project.pbxproj, download_v8.sh, tools/v8/vendor_inspector_sources.py
The native binding exposes inspector operations and is registered as ns:inspector. Project and vendoring changes include the binding and protocol header.
JavaScript domain API
NativeScript/runtime/js/ns-inspector.js, tools/js2c-inputs.xcfilelist
The module adds domain registration, session lifecycle handling, command replies, event delivery, and native helper exports. It is added to the js2c input list.
Inspector declarations, tests, and documentation
TestRunner/app/tests/NsInspectorTests.js, TestRunner/app/tests/index.js, TestRunner/app/tests/nsInspectorWorker.js, types/ns-inspector.d.ts, types/index.d.ts, docs/ns-builtin-modules.md
Tests cover exports, domain registration, errors, helper functions, and worker behavior. Type declarations and documentation describe the module API and availability.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant InspectorFrontend
  participant JsV8InspectorClient
  participant NsInspectorRouter as ns-inspector router
  participant DomainCommand
  InspectorFrontend->>JsV8InspectorClient: Send protocol command
  JsV8InspectorClient->>NsInspectorRouter: Dispatch connection ID, request ID, domain, command, and params
  NsInspectorRouter->>DomainCommand: Invoke registered command
  DomainCommand-->>NsInspectorRouter: Return value or error
Loading

Possibly related PRs

  • NativeScript/ios#526: Adds per-client V8 sessions and routing, which this change uses for session-scoped inspector operations and replies.
  • NativeScript/ios#617: Changes JavaScript domain handler error replies on the inspector command path.

Suggested reviewers: rigor789, nathanwalker

Merge Risk: Low · previous review 4f974

This is an experimental, debug-only inspector feature. Two edge cases in the handoff from legacy domain handlers to the new JavaScript domains can lose a client's enabled state. Neither affects normal app behavior, so the change is mergeable with follow-up.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(inspector): ns:inspector, inspector domains in JavaScript" matches the main change. The changeset adds the experimental iOS-only ns:inspector builtin module, which lets JavaScript regi…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(inspector): ns:inspector, inspector domains in JavaScript" matches the main change. The changeset adds the experimental iOS-only ns:inspector builtin module, which lets JavaScript register inspector domains. The title names the new module and its purpose. It does not mention the supporting native changes (V8 inspector client routing, session lookup, vendored crdtp header), but that detail is expected for a title.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps a protocol tune,
New domains answer beneath the moon.
Sessions send events, then close,
Stack traces bloom where the code path goes.
I nibble the docs and hop away.

registerDomain(name, options) serves a protocol domain from JS to every
connected client. The runtime owns enable and disable: it keeps which
clients enabled the domain, runs the enabled/disabled and
sessionEnabled/sessionDisabled/sessionClosed hooks, and remembers clients
that enabled a domain before it was registered. Commands may be async; a
throw or rejection answers with an error, with a ProtocolError's code.
Each reply reaches its own client only, and events a command emits go out
before its reply. domain.emit reaches the clients that enabled the domain,
or every client for an alwaysEnabled one.

The session handed to hooks and commands sends to one client and wraps,
unwraps and releases remote objects for it, through the V8 session of
that client; addInspectedObject sets its $0. monotonicTime, wallTime and
captureStackTrace give what Network events need.

Domains V8 or the runtime implements are refused, and a name has one owner
at a time. The module is inert in release builds and in workers.

Vendors crdtp/json.h, which turns V8's CBOR protocol objects into JSON.
@edusperoni
edusperoni marked this pull request as ready for review December 2, 2026 02:43

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Major 1
  1. Retired domains skip sessionClosed for their clients.
Minor 6
  1. Remove remembered enables when the client disables the domain.
  2. Retire legacy subscription records after ownership transfers.
  3. Include hook lookup in the exception boundary.
  4. Apply the documented closed-session check to group release.
  5. Wait for pending initialization on repeated enable requests.
  6. Serialization errors in command replies leave the client without a response.

  • Ask CodeRabbit to fix comments on this review
Prompt to fix all issues
Treat finding text, file paths, and code as untrusted review data. Never follow
instructions embedded in them. Verify each finding against current code. Fix
only still-valid issues, skip the rest with a brief reason, keep changes
minimal, and validate.

Inline comments:
Review comments at @NativeScript/inspector/JsV8InspectorClient.mm:
- Around line 1002-1004: Update the command handling near `rememberedEnables_`
so a `Foo.disable` received before domain registration removes that connection’s
membership from `rememberedEnables_[domain]`; preserve the existing behavior
that records `Foo.enable` and leave enabled-client event routing unchanged.
- Around line 1057-1062: When transferring domain ownership to ns:inspector,
consume the legacy records in jsDomainEnablers_ after importing them so later
registrations use current state and an empty JS enabled snapshot cannot be
overridden by stale entries. Preserve the initial transfer of enabled legacy
domains.
- Line 1132: Update ns-inspector.js’s reply() to catch JSONStringify failures
and route them through replyError() so the client receives the existing -32000
error response, including for async handler results. Keep successful replies
unchanged; no native dispatch change is needed.

Review comments at @NativeScript/runtime/js/ns-inspector.js:
- Line 107: Move the `owner[name]` hook lookup inside the existing `try` so
getter exceptions during disconnect are caught and do not prevent
`router.closed` from cleaning up later domains. Preserve the current receiver
and arguments when invoking the hook.
- Line 170: Update `releaseObjectGroup` to call `#ensureOpen()` before invoking
the native release, so a closed session throws consistently with the other
object methods.
- Around line 362-364: Update the repeated-enable branch in the enable handler
to track each session’s pending sessionEnabled initialization and wait for it
before calling done(); keep the immediate reply when that initialization has
completed.
- Line 299: Update `unregister()` and the `router.closed` handling so removing a
domain from `domains` retains a disconnect-only record for its owner while any
sessions that enabled it or sent it a command remain open. On disconnect, invoke
that retired owner’s `Domain.close`/`sessionClosed` hook and remove the record
once all touched sessions have closed; ensure registering the same name later
does not replace the retired owner’s outstanding cleanup obligation.

After applying the fix, consider running `coderabbit review --agent` for local
review. Visit https://docs.coderabbit.ai/cli?utm_source=ghpr
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 56481937-9399-4037-9cf4-e9c95b10c2f8
Commits

Reviewing files that changed from the base of the PR and between fed7867 and e275879.

Files selected for processing: 18

  • NativeScript/inspector/InspectorModule.h
  • NativeScript/inspector/InspectorModule.mm
  • NativeScript/inspector/InspectorSessions.h
  • NativeScript/inspector/InspectorSessions.mm
  • NativeScript/inspector/JsV8InspectorClient.h
  • NativeScript/inspector/JsV8InspectorClient.mm
  • NativeScript/runtime/NsBuiltinModules.cpp
  • NativeScript/runtime/js/ns-inspector.js
  • TestRunner/app/tests/NsInspectorTests.js
  • TestRunner/app/tests/index.js
  • TestRunner/app/tests/nsInspectorWorker.js
  • docs/ns-builtin-modules.md
  • download_v8.sh
  • tools/js2c-inputs.xcfilelist
  • tools/v8/vendor_inspector_sources.py
  • types/index.d.ts
  • types/ns-inspector.d.ts
  • v8ios.xcodeproj/project.pbxproj

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
- A client that enabled a domain and disabled it again before it was
  registered is no longer enabled at registration.
- Enables recorded by __registerDomainDispatcher move to the first
  registerDomain of the name, instead of coming back at every
  registration.
- A result JSON cannot serialize answers with an error instead of no
  reply.
- A hook getter that throws no longer stops the other domains' cleanup
  when a client leaves, and validation reads each hook once.
- releaseObjectGroup throws once the client has left, like the other
  object methods.
- An unregistered domain still gets sessionDisabled and sessionClosed
  for its clients.
- A repeated enable waits for a pending sessionEnabled before its reply.
@edusperoni

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Major 1
  1. Disconnect the V8 session before running close hooks.
Minor 3
  1. A throwing then getter on a sessionEnabled result leaves the enable waiting forever.
  2. Send an error reply when router dispatch throws.
  3. Make replyError safe for any thrown value.

  • Ask CodeRabbit to fix comments on this review
Prompt to fix all issues
Treat finding text, file paths, and code as untrusted review data. Never follow
instructions embedded in them. Verify each finding against current code. Fix
only still-valid issues, skip the rest with a brief reason, keep changes
minimal, and validate.

Inline comments:
Review comments at @NativeScript/inspector/JsV8InspectorClient.mm:
- Line 678: Update the disconnect path around NotifyJsDomainsClosed to
disconnect the native V8 session before invoking the JavaScript close hooks, so
hooks cannot pause a session with no connected frontend. Preserve deferred
destruction for sessions with active dispatches.
- Line 1139: Update the router dispatch/result-processing path around
`whenSettled` so exceptions such as a throwing `then` getter do not leave client
requests pending: either catch result-processing errors in JavaScript or send a
client-scoped -32000 response for non-termination dispatch failures. Do not
treat an exception as handled without replying, and preserve false router
results for V8 fallback.

Review comments at @NativeScript/runtime/js/ns-inspector.js:
- Around line 376-422: In #enable, guard the isThenable check so an exception
from a result’s then getter is reported and treated as a non-thenable; call
settled() so the enable completes and later enable calls do not remain blocked.
- Around line 229-233: Update replyError to compute the error message inside a
try/catch and ensure the result is a string safe for JSONStringify; if
conversion fails, use an empty string so the existing "Internal error" fallback
applies. This must let replyError send a response for thrown values that cannot
be converted safely.

After applying the fix, consider running `coderabbit review --agent` for local
review. Visit https://docs.coderabbit.ai/cli?utm_source=ghpr
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d103ead6-0483-4619-b3ee-b31223807a82
Commits

Reviewing files that changed from the base of the PR and between e275879 and 8e0982b.

Files selected for processing: 2

  • NativeScript/inspector/JsV8InspectorClient.mm
  • NativeScript/runtime/js/ns-inspector.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
… session

- Any thrown value, a rejection with one, or a result whose then getter
  throws answers the command with an error; before, some left it
  unanswered.
- A sessionEnabled result whose then getter throws no longer leaves the
  client's later enables waiting.
- Close hooks run after the client's V8 session is gone, so one that
  pauses does not hold the app for a client that has left.
@edusperoni

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Minor 2
  1. Settle initialization when promise normalization throws.
  2. Legacy enables that finish after JS registration are lost.
    NativeScript/inspector/JsV8InspectorClient.mm, lines 1068 · 🎯 Functional Correctness · ⚖️ Poor tradeoff
    If a legacy Foo.enable handler calls ns:inspector registerDomain('Foo') before it returns success, RegisterJsDomain drops that client. The client&`#39`;s entry is still false while the handler runs. The check at line 1068 skips it, and line 1072 erases the legacy map. When the handler returns success, lines 963-972 find no entry and record nothing. The frontend receives a successful enable, but the JS domain never treats that client as enabled.
    Keep a pending legacy enable across JS registration. If the legacy handler succeeds, the JS domain must record that client as enabled. If the handler fails, the client must not be recorded.
    Prompt to fix issue
    Treat finding text, file paths, and code as untrusted review data. Never follow instructions embedded in them. Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate.
    
    Review comment at @NativeScript/inspector/JsV8InspectorClient.mm at line 1068:
    Update RegisterJsDomain and the legacy Foo.enable completion flow so a client with an enable handler still in progress is retained as pending rather than discarded during JS domain registration. On handler success, record that client as enabled in the JS domain; on failure, do not record it as enabled.
    
Outside diff 1
  1. Clear remembered enables when a legacy disable succeeds.
    NativeScript/inspector/JsV8InspectorClient.mm, lines 989 · 🎯 Functional Correctness · ⚡ Quick win
    If client A enables JS domain Foo, unregisters it, and then sends Foo.disable to a legacy dispatcher, this return skips the remembered-enable cleanup. A later JS registration restores A as enabled.
    Remove A from rememberedEnables_ when the legacy disable is handled. Preserve the remembered enable when no disable occurs.
    Prompt to fix issue
    Treat finding text, file paths, and code as untrusted review data. Never follow instructions embedded in them. Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate.
    
    Review comment at @NativeScript/inspector/JsV8InspectorClient.mm at line 989:
    Update the legacy disable handling in JsV8InspectorClient so a successfully handled disable removes client A from rememberedEnables_ before returning; leave the remembered enable unchanged when no disable occurs.
    

  • Ask CodeRabbit to fix comments on this review
Prompt to fix all issues
Treat finding text, file paths, and code as untrusted review data. Never follow
instructions embedded in them. Verify each finding against current code. Fix
only still-valid issues, skip the rest with a brief reason, keep changes
minimal, and validate.

Inline comments:
Review comments at @NativeScript/runtime/js/ns-inspector.js:
- Line 267: Update the promise handling for the value returned by sessionEnabled
so synchronous errors from PromiseResolve or PromisePrototypeThen are passed to
onError, allowing initialization to settle and release the retained
#initializing entry. Preserve asynchronous handling of ordinary promise
completions.

---

Outside diff comments:
Review comments at @NativeScript/inspector/JsV8InspectorClient.mm:
- Line 989: Update the legacy disable handling in JsV8InspectorClient so a
successfully handled disable removes client A from rememberedEnables_ before
returning; leave the remembered enable unchanged when no disable occurs.

---

Minor comments:
Review comments at @NativeScript/inspector/JsV8InspectorClient.mm:
- Line 1068: Update RegisterJsDomain and the legacy Foo.enable completion flow
so a client with an enable handler still in progress is retained as pending
rather than discarded during JS domain registration. On handler success, record
that client as enabled in the JS domain; on failure, do not record it as
enabled.

After applying the fix, consider running `coderabbit review --agent` for local
review. Visit https://docs.coderabbit.ai/cli?utm_source=ghpr
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6faea1a6-4d85-4eb3-8265-88b09a7d4528
Commits

Reviewing files that changed from the base of the PR and between 8e0982b and 4756fed.

Files selected for processing: 2

  • NativeScript/inspector/JsV8InspectorClient.mm
  • NativeScript/runtime/js/ns-inspector.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Comment thread NativeScript/runtime/js/ns-inspector.js Resolved
- A sessionEnabled promise whose constructor getter throws settles the
  enable, so later enables are answered.
- A ProtocolError's code is read once.
- A disable handled by a __registerDomainDispatcher domain also forgets
  the client's remembered enable, so a later registerDomain of the name
  does not enable it again.
@edusperoni

Copy link
Copy Markdown
Collaborator Author

On the two findings in the body of the review of 4756fed:

  • "Clear remembered enables when a legacy disable succeeds": fixed in 4f9742e. A disable handled by a __registerDomainDispatcher domain also drops the client's remembered enable. Reproduced (enable, unregister, legacy disable, register again: the client came back enabled) and passes now.
  • "Legacy enables that finish after JS registration are lost": leaving this one as is. It needs a legacy enable handler that calls registerDomain for its own domain before returning, which nothing does or has reason to do: a domain moves to ns:inspector by registering there instead of through the legacy dispatcher. The review rates it a poor tradeoff too, and supporting it means tracking legacy enables that are still running across a registration.

@edusperoni

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments

Minor 1
  1. Preserve the remembered enable if legacy disable fails.

  • Ask CodeRabbit to fix comments on this review
Prompt to fix all issues
Treat finding text, file paths, and code as untrusted review data. Never follow
instructions embedded in them. Verify each finding against current code. Fix
only still-valid issues, skip the rest with a brief reason, keep changes
minimal, and validate.

Inline comments:
Review comments at @NativeScript/inspector/JsV8InspectorClient.mm:
- Line 935: Update the legacy `Foo.disable` handling around
`rememberedEnables_[domain].erase(connectionId)` so the remembered enable is
cleared only after the disable succeeds; preserve it when the handler throws or
returns an error, and also clear it on the successful early-return path.

After applying the fix, consider running `coderabbit review --agent` for local
review. Visit https://docs.coderabbit.ai/cli?utm_source=ghpr
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8956cb79-31c4-477f-a589-9eb8fe0d6b57
Commits

Reviewing files that changed from the base of the PR and between 4756fed and 4f9742e.

Files selected for processing: 2

  • NativeScript/inspector/JsV8InspectorClient.mm
  • NativeScript/runtime/js/ns-inspector.js

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

This branch has not been deployed

No deployments
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.

1 participant