diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-11-26 23:09:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-26 23:09:48 +0100 |
commit | 3a320db27014925bb40f10dd4e706302bc06c1f1 (patch) | |
tree | 5b5b8bd9a925960a454b825949c950b09467c7b4 /cli/tools/repl/session.rs | |
parent | d8ab492d016f45346002ae0e9bceac7e900b670a (diff) |
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.
Diffstat (limited to 'cli/tools/repl/session.rs')
-rw-r--r-- | cli/tools/repl/session.rs | 14 |
1 files changed, 8 insertions, 6 deletions
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, |