diff options
| author | snek <snek@deno.com> | 2024-08-05 08:28:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-05 08:28:12 -0700 |
| commit | 649725442ad39d3ec2963f668c3ecfb3bb81a4c2 (patch) | |
| tree | 497a3873fa82bf40b0ffe842a620530e10346267 /ext/node/ops/vm_internal.rs | |
| parent | e97764e7ecfea960987b63a550fb45bc3d2171da (diff) | |
feat: upgrade deno_core (#24886)
Fixes: https://github.com/denoland/deno/issues/24869
Includes changes for `node:vm` rewrite.
Diffstat (limited to 'ext/node/ops/vm_internal.rs')
| -rw-r--r-- | ext/node/ops/vm_internal.rs | 18 |
1 files changed, 13 insertions, 5 deletions
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 }; |
