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.
This commit is contained in:
Bartek Iwańczuk 2022-11-26 23:09:48 +01:00 committed by GitHub
parent d8ab492d01
commit 3a320db270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 8 deletions

View file

@ -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,