From 3a320db27014925bb40f10dd4e706302bc06c1f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sat, 26 Nov 2022 23:09:48 +0100 Subject: fix(inspector): send "isDefault" in aux data (#16836) With trial and error I found that most debuggers expect "isDefault" to be sent in "auxData" field of "executionContextCreated" notification. This stems from the fact that Node.js sends this data and eg. VSCode requires it to close connection to the debugger when the program finishes execution. --- cli/tools/repl/session.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'cli') diff --git a/cli/tools/repl/session.rs b/cli/tools/repl/session.rs index e3bdac3b2..361f5abb5 100644 --- a/cli/tools/repl/session.rs +++ b/cli/tools/repl/session.rs @@ -92,17 +92,19 @@ impl ReplSession { for notification in session.notifications() { let method = notification.get("method").unwrap().as_str().unwrap(); let params = notification.get("params").unwrap(); - if method == "Runtime.executionContextCreated" { - context_id = params - .get("context") + let context = params.get("context").unwrap(); + assert!(context + .get("auxData") .unwrap() - .get("id") + .get("isDefault") .unwrap() - .as_u64() - .unwrap(); + .as_bool() + .unwrap()); + context_id = context.get("id").unwrap().as_u64().unwrap(); } } + assert_ne!(context_id, 0); let mut repl_session = ReplSession { worker, -- cgit v1.2.3