Skip to content

inspector: defer JS execution from V8 interrupts - #65397

Open
deepak1556 wants to merge 3 commits into
nodejs:mainfrom
deepak1556:robo/enable_js_in_api_interrupt_check
Open

inspector: defer JS execution from V8 interrupts#65397
deepak1556 wants to merge 3 commits into
nodejs:mainfrom
deepak1556:robo/enable_js_in_api_interrupt_check

Conversation

@deepak1556

Copy link
Copy Markdown
Contributor

Followup to #65028 covering additional callsites, upstreaming from electron/electron#52960.

Backported the V8 feature to enable the scope check moving forward, node::RequestInterrupt already subjected this restriction with its scope check. The change should only affect addons that were to use v8::Isolate::RequestInterrupt, but its already a documented caution in the public header. Any reason the feature shouldn't be enabled ?

cc @joyeecheung

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/inspector
  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Aug 19, 2026
deepak1556 and others added 3 commits August 19, 2026 17:04
Inspector messages for a main thread connection are dispatched
from a V8 interrupt handler. Defer frontend messages in this
case using a microtask. This preserves the existing timing
contract for main thread inspector connections, where
notifications are observable after a microtask checkpoint.

Starting the inspector I/O thread and toggling network tracking
can also call into JS from an interrupt.

Signed-off-by: deepak1556 <hop2deep@gmail.com>
Signed-off-by: deepak1556 <hop2deep@gmail.com>
Original commit message:

    [api] Prepare DisallowJavascriptExecution scope around api callbacks

    In `v8::Isolate::RequestInterrupt` the API contract says:

         API interrupt callbacks are forbidden from executing JavaScript
         on the interrupted Isolate.

    This CL prepares the infrastructure to enforce this contract.

    Bug: 540137721, 40067940

    TAG=agy
    CONV=78573798-a951-4bd3-9c6f-3e3b6775da4b

    Change-Id: I43cc83c3cc3ebd34052a927dde55bbf4d49d2d29
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8173727
    Auto-Submit: Olivier Flückiger <olivf@chromium.org>
    Reviewed-by: Simon Zünd <szuend@chromium.org>
    Commit-Queue: Olivier Flückiger <olivf@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#109086}

Refs: v8/v8@b36cf9f
Signed-off-by: deepak1556 <hop2deep@gmail.com>
@deepak1556
deepak1556 force-pushed the robo/enable_js_in_api_interrupt_check branch from e9d757c to 788c38a Compare August 19, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants