Title: feat(inspector): attach Chrome DevTools to Web Worker isolates by edusperoni · Pull Request #1973 · NativeScript/android · GitHub
Open Graph Title: feat(inspector): attach Chrome DevTools to Web Worker isolates by edusperoni · Pull Request #1973 · NativeScript/android
X Title: feat(inspector): attach Chrome DevTools to Web Worker isolates by edusperoni · Pull Request #1973 · NativeScript/android
Description: Workers were invisible to the debugger: the inspector only served the main isolate and even dropped worker console output on the floor. DevTools discovers extra isolates through the Target domain with flat-session multiplexing, so implement that surface in the runtime: Add WorkerInspectorClient: a per-worker V8Inspector + session that lives entirely on the worker's thread. Incoming CDP messages queue through an eventfd on the worker's ALooper (the same mechanism as the worker message inbox); while paused at a breakpoint a nested loop on the worker thread pumps the same queue without re-entering the looper, so postMessage deliveries stay queued during a pause, matching Chrome's semantics. Turn JsV8InspectorClient into the root session + router: handle Target.setAutoAttach natively on the socket thread (announce workers via Target.attachedToTarget, detach on death), route messages carrying a top-level sessionId to the worker's thread directly from the socket thread, and make the frontend sender thread-safe. Routing off the socket thread means a worker stays debuggable while the main isolate is paused, and vice versa. Debugger.pause for a busy worker uses RequestInterrupt keyed by workerId, so a late-firing interrupt after worker death is a no-op; it is skipped while that worker is already paused, avoiding a spurious re-pause after resume (same guard as the main isolate). Serve Network.loadNetworkResource and IO.read/IO.close on the socket thread for any session (sessionId echoed), so worker source maps load too, and apply the nsruntime:// sourceMapURL rewrite to worker Debugger.scriptParsed events. Route worker console.* to the worker's own inspector and deliver through V8ConsoleMessageStorage::addMessage instead of the live-only runtime agent path: messages logged before the frontend attaches are stored and replayed as console history. Applies to the main isolate as well. Name execution contexts ("main" / worker script url) so the DevTools console context selector rows are labeled and selectable. Worker lifecycle: the inspector is created on the worker thread before the script runs (debug builds only), terminate() kicks a paused worker out of its nested pause loop, teardown unregisters the target before the isolate is disposed, and frontend reconnects reset worker sessions (ordered before the main-isolate Locker so workers recover even if the main isolate is paused). Make isConnected_ atomic: worker threads now read it while the main thread writes the adjacent bitfield flags. waitForDebuggerOnStart (pause new workers before their first line) is left as future work; workers announce waitingForDebugger: false. Ports NativeScript/ios#386 to Android. Summary by CodeRabbit New Features Added worker-side V8 inspector support with DevTools-ready session/target routing. Worker console output is now forwarded into the inspector for visibility. Bug Fixes Improved socket-thread message handling to send only when a non-empty response is produced by the fast path. Strengthened thread-safety for inspector connections and singleton initialization. Refined pause/reset behavior and worker session acknowledgment handling. Chores Enabled additional inspector sources for debug builds.
Open Graph Description: Workers were invisible to the debugger: the inspector only served the main isolate and even dropped worker console output on the floor. DevTools discovers extra isolates through the Target domain w...
X Description: Workers were invisible to the debugger: the inspector only served the main isolate and even dropped worker console output on the floor. DevTools discovers extra isolates through the Target domain w...
Opengraph URL: https://github.com/NativeScript/android/pull/1973
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:af720303-65d1-aff6-397e-5402f84e9a8a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9EE4:2463BD:1AF05C9:227361F:6B0140ED |
| html-safe-nonce | dc58e62c13bc863cc51e3756638462f4c46a3d6ccb22ba88937f905de523e9f6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RUU0OjI0NjNCRDoxQUYwNUM5OjIyNzM2MUY6NkIwMTQwRUQiLCJ2aXNpdG9yX2lkIjoiMjk2OTcxMTMyMTM1ODA5MDQ3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 75274bccdcc7b63668a5b544f2bf554fd1304f30f41bb3dc2680e08a4514c80f |
| hovercard-subject-tag | pull_request:3857647807 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/1973/files |
| twitter:image | https://avatars.githubusercontent.com/u/4061767?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/4061767?s=400&v=4 |
| og:image:alt | Workers were invisible to the debugger: the inspector only served the main isolate and even dropped worker console output on the floor. DevTools discovers extra isolates through the Target domain w... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/NativeScript/android git https://github.com/NativeScript/android.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 29137950 |
| octolytics-dimension-repository_nwo | NativeScript/android |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29137950 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/android |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width