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 /core/runtime.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 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index b1ce14883..8cb38de2f 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -88,6 +88,8 @@ pub struct JsRuntime { allocations: IsolateAllocations, extensions: Vec<Extension>, event_loop_middlewares: Vec<Box<OpEventLoopFn>>, + // Marks if this is considered the top-level runtime. Used only be inspector. + is_main: bool, } pub(crate) struct DynImportModEvaluate { @@ -274,7 +276,13 @@ pub struct RuntimeOptions { /// [CompiledWasmModuleStore]. If no [CompiledWasmModuleStore] is specified, /// `WebAssembly.Module` objects cannot be serialized. pub compiled_wasm_module_store: Option<CompiledWasmModuleStore>, + + /// Start inspector instance to allow debuggers to connect. pub inspector: bool, + + /// Describe if this is the main runtime instance, used by debuggers in some + /// situation - like disconnecting when program finishes running. + pub is_main: bool, } #[derive(Copy, Clone, PartialEq, Eq)] @@ -498,6 +506,7 @@ impl JsRuntime { Some(JsRuntimeInspector::new( &mut isolate, global_context.clone(), + options.is_main, )) } else { None @@ -532,6 +541,7 @@ impl JsRuntime { extensions: options.extensions, state: state_rc, module_map: Some(module_map_rc), + is_main: options.is_main, }; // Init resources and ops before extensions to make sure they are @@ -949,6 +959,7 @@ impl JsRuntime { state.inspector = Some(JsRuntimeInspector::new( self.v8_isolate.as_mut().unwrap(), state.global_realm.clone().unwrap().0, + self.is_main, )); } |