diff options
Diffstat (limited to 'ext/node/ops')
-rw-r--r-- | ext/node/ops/vm.rs | 2 | ||||
-rw-r--r-- | ext/node/ops/vm_internal.rs | 18 |
2 files changed, 14 insertions, 6 deletions
diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs index 860498f5a..d9a16eeff 100644 --- a/ext/node/ops/vm.rs +++ b/ext/node/ops/vm.rs @@ -145,7 +145,7 @@ mod tests { let isolate = &mut v8::Isolate::new(Default::default()); let scope = &mut v8::HandleScope::new(isolate); - let context = v8::Context::new(scope); + let context = v8::Context::new(scope, Default::default()); let scope = &mut v8::ContextScope::new(scope, context); let source = v8::String::new(scope, "1 + 2").unwrap(); diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs index ca3cac41f..f61308228 100644 --- a/ext/node/ops/vm_internal.rs +++ b/ext/node/ops/vm_internal.rs @@ -35,11 +35,12 @@ impl ContextifyScript { false, Some(host_defined_options), ); - let source = v8::script_compiler::Source::new(source_str, Some(&origin)); + let mut source = + v8::script_compiler::Source::new(source_str, Some(&origin)); let unbound_script = v8::script_compiler::compile_unbound_script( scope, - source, + &mut source, v8::script_compiler::CompileOptions::NoCompileOptions, v8::script_compiler::NoCacheReason::NoReason, ) @@ -226,15 +227,22 @@ pub fn create_v8_context<'a>( let scope = &mut v8::EscapableHandleScope::new(scope); let context = if mode == ContextInitMode::UseSnapshot { - v8::Context::from_snapshot(scope, VM_CONTEXT_INDEX).unwrap() + v8::Context::from_snapshot(scope, VM_CONTEXT_INDEX, Default::default()) + .unwrap() } else { - let ctx = v8::Context::new_from_template(scope, object_template); + let ctx = v8::Context::new( + scope, + v8::ContextOptions { + global_template: Some(object_template), + ..Default::default() + }, + ); // SAFETY: ContextifyContexts will update this to a pointer to the native object unsafe { ctx.set_aligned_pointer_in_embedder_data(1, std::ptr::null_mut()); ctx.set_aligned_pointer_in_embedder_data(2, std::ptr::null_mut()); ctx.set_aligned_pointer_in_embedder_data(3, std::ptr::null_mut()); - ctx.clear_all_slots(scope); + ctx.clear_all_slots(); }; ctx }; |