Skip to content

Commit 4b5ab0a

Browse files
authored
feat(inspector): attach Chrome DevTools to Web Worker isolates (#1973)
1 parent 50e656d commit 4b5ab0a

9 files changed

Lines changed: 953 additions & 74 deletions

File tree

test-app/app/src/main/java/com/tns/AndroidJsV8Inspector.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,20 @@ protected void onMessage(final NanoWSD.WebSocketFrame message) {
298298

299299
// Network.loadNetworkResource / IO.read / IO.close are served from
300300
// disk on this thread so source maps load even while the isolate is
301-
// paused at a breakpoint or busy running JS; Debugger.pause schedules
302-
// a V8 interrupt and still flows through the queue.
301+
// paused at a breakpoint or busy running JS; Target domain commands
302+
// and worker-session messages (top-level sessionId) are routed here
303+
// too. Debugger.pause schedules a V8 interrupt and still flows
304+
// through the queue. A null return means "not handled" (queue it);
305+
// an empty string means handled with nothing left to send.
303306
String fastPathResponse = handleMessageOnSocketThread(message.getTextPayload());
304307
if (fastPathResponse != null) {
305-
try {
306-
send(fastPathResponse);
307-
} catch (IOException e) {
308-
if (com.tns.Runtime.isDebuggable()) {
309-
e.printStackTrace();
308+
if (!fastPathResponse.isEmpty()) {
309+
try {
310+
send(fastPathResponse);
311+
} catch (IOException e) {
312+
if (com.tns.Runtime.isDebuggable()) {
313+
e.printStackTrace();
314+
}
310315
}
311316
}
312317
return;

test-app/runtime/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ if (NOT OPTIMIZED_BUILD OR OPTIMIZED_WITH_INSPECTOR_BUILD)
7474

7575
src/main/cpp/com_tns_AndroidJsV8Inspector.cpp
7676
src/main/cpp/JsV8InspectorClient.cpp
77+
src/main/cpp/WorkerInspectorClient.cpp
7778
src/main/cpp/v8_inspector/ns-v8-tracing-agent-impl.cpp
7879
src/main/cpp/v8_inspector/Utils.cpp
7980
)

0 commit comments

Comments
 (0)