diff options
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 8e1529569..19fe44a3a 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -411,7 +411,6 @@ impl JsRuntime { } global_context = v8::Global::new(scope, context); - scope.set_default_context(context); } (isolate, snapshot_options) } else { @@ -931,6 +930,14 @@ impl JsRuntime { pub fn snapshot(mut self) -> v8::StartupData { self.state.borrow_mut().inspector.take(); + // Set the context to be snapshot's default context + { + let context = self.global_context(); + let mut scope = self.handle_scope(); + let local_context = v8::Local::new(&mut scope, context); + scope.set_default_context(local_context); + } + // Serialize the module map and store its data in the snapshot. { let snapshotted_data = { |