diff --git a/Cargo.lock b/Cargo.lock index 486d5c2a16..fe07675eb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1303,9 +1303,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.287.0" +version = "0.288.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8659fd7969621bea436a6d214589120c1fe22483753e19b009b7110e987e0acf" +checksum = "e569b7a3e463a9f3b111a4279afa06b6909f6ecdc27aeedd3c310a57184ac217" dependencies = [ "anyhow", "bincode", @@ -1759,9 +1759,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.163.0" +version = "0.164.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc9fd52e5fca85a834cc040ae1c6c675d8b718db5e14bbbf76996486dcc17fa" +checksum = "748c200b559272ba65d98c25fc38e789901c847c41273e0232cc0df4cf6cad8b" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -5763,9 +5763,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.196.0" +version = "0.197.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411789e6a59e2169c1bc198562de15241a368dde8961cb18dd1bddbba5e2e5f5" +checksum = "fb8b2ba47cda7f2941f66b4a0eec34b5f21d4ac3566fbc89598ff499a300f406" dependencies = [ "num-bigint", "serde", @@ -7337,9 +7337,9 @@ dependencies = [ [[package]] name = "v8" -version = "0.93.0" +version = "0.93.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abc3ff12243d345cc697c151b29fbb8ad1f898e3f8b7aa1386701ff9f2c7cbbf" +checksum = "82943fec029559cb43f9d7fc36e2bb85121534702d6f893554e737d1b147d140" dependencies = [ "bitflags 2.5.0", "fslock", diff --git a/Cargo.toml b/Cargo.toml index b1d807d96f..e79c943bc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ repository = "https://github.com/denoland/deno" [workspace.dependencies] deno_ast = { version = "=0.39.1", features = ["transpiling"] } -deno_core = { version = "0.287.0" } +deno_core = { version = "0.288.0" } deno_bench_util = { version = "0.149.0", path = "./bench_util" } deno_lockfile = "0.20.0" diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs index bbdcba632d..54b9aaa471 100644 --- a/ext/node/ops/vm_internal.rs +++ b/ext/node/ops/vm_internal.rs @@ -4,7 +4,6 @@ use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::v8; use deno_core::v8::MapFnTo; -use std::rc::Rc; pub const PRIVATE_SYMBOL_NAME: v8::OneByteConst = v8::String::create_external_onebyte_const(b"node:contextify:context"); @@ -82,13 +81,18 @@ impl ContextifyContext { sandbox_obj: v8::Local, ) { let main_context = scope.get_current_context(); - let context_state = main_context - .get_slot::>(scope) - .unwrap() - .clone(); + let context_state = main_context.get_aligned_pointer_from_embedder_data( + deno_core::CONTEXT_STATE_SLOT_INDEX, + ); v8_context.set_security_token(main_context.get_security_token(scope)); - v8_context.set_slot(scope, context_state); + // SAFETY: set embedder data from the creation context + unsafe { + v8_context.set_aligned_pointer_in_embedder_data( + deno_core::CONTEXT_STATE_SLOT_INDEX, + context_state, + ); + } let context = v8::Global::new(scope, v8_context); let sandbox = v8::Global::new(scope, sandbox_obj); @@ -102,7 +106,7 @@ impl ContextifyContext { // lives longer than the execution context, so this should be safe. unsafe { v8_context.set_aligned_pointer_in_embedder_data( - 1, + 2, ptr as *const ContextifyContext as _, ); } @@ -164,7 +168,7 @@ impl ContextifyContext { ) -> Option<&'c ContextifyContext> { let context = object.get_creation_context(scope)?; - let context_ptr = context.get_aligned_pointer_from_embedder_data(1); + let context_ptr = context.get_aligned_pointer_from_embedder_data(2); // SAFETY: We are storing a pointer to the ContextifyContext // in the embedder data of the v8::Context during creation. Some(unsafe { &*(context_ptr as *const ContextifyContext) })