diff --git a/Cargo.lock b/Cargo.lock index 6da1207fb84388..e9fada1784ed9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1357,9 +1357,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.301.0" +version = "0.302.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d595cedb88ce9972e35b6b6ea3832792a570412c06c4ef2fe2b1e54505595e51" +checksum = "063e249fa30a9ee3320f5b1a69f86be1d98db234a112671ad85f648c876a6705" dependencies = [ "anyhow", "bincode", @@ -1843,9 +1843,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.177.0" +version = "0.178.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e89d5b94f766a73ecfa03b8481c9b4932d137670bdd9b227e5fcf283175af7" +checksum = "1df4f8e16146f71cd35f3730350005be64807e37a89900366b55d6d798ab545a" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -6078,9 +6078,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.210.0" +version = "0.211.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef949bc9a8f4eb6c6620ed5e52c60f8d7239ef31c9c5e1eb3ad88d882ad9bde2" +checksum = "74f34bfd3eb4e7d79bfb7ec0c0870cc4413289c047502c87e3011f09a5d0dd98" dependencies = [ "num-bigint", "serde", @@ -7718,9 +7718,9 @@ dependencies = [ [[package]] name = "v8" -version = "0.101.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06bc034c7b5e85fac85d2c6f181878266dd344790702d03e946c25cba78646a9" +checksum = "88a710d5b95bff79a90708203cf9f74384e080d21fc6664aa4df463f2c66ac83" dependencies = [ "bindgen", "bitflags 2.5.0", diff --git a/Cargo.toml b/Cargo.toml index aa1e35dd47892d..df400fc4d4c0bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "=0.41.2", features = ["transpiling"] } -deno_core = { version = "0.301.0" } +deno_core = { version = "0.302.0" } deno_bench_util = { version = "0.158.0", path = "./bench_util" } deno_lockfile = "0.20.0" diff --git a/ext/node/global.rs b/ext/node/global.rs index 2434a64fd42714..0fc215bd4d7790 100644 --- a/ext/node/global.rs +++ b/ext/node/global.rs @@ -207,7 +207,7 @@ pub fn global_object_middleware<'s>( deno_globals, node_globals, }; - scope.get_current_context().set_slot(scope, storage); + scope.get_current_context().set_slot(storage); } fn is_managed_key( @@ -269,7 +269,7 @@ pub fn getter<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -302,7 +302,7 @@ pub fn setter<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -329,7 +329,7 @@ pub fn query<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -361,7 +361,7 @@ pub fn deleter<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -390,7 +390,7 @@ pub fn enumerator<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -424,7 +424,7 @@ pub fn definer<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); @@ -458,7 +458,7 @@ pub fn descriptor<'s>( let context = scope.get_current_context(); let inner = { - let storage = context.get_slot::(scope).unwrap(); + let storage = context.get_slot::().unwrap(); storage.inner_for_mode(mode) }; let inner = v8::Local::new(scope, inner); diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs index 860498f5a15a97..d9a16eefff8a50 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 ca3cac41f1fd22..f61308228c2ff8 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 };