Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ repository = "https://github.com/denoland/deno"

[workspace.dependencies]
deno_ast = { version = "=0.46.6", features = ["transpiling"] }
deno_core = { version = "0.345.0" }
deno_core = { version = "0.346.0" }

deno_cache_dir = "=0.20.0"
deno_config = { version = "=0.54.2", features = ["workspace"] }
Expand Down
2 changes: 1 addition & 1 deletion cli/lsp/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5861,7 +5861,7 @@ mod tests {
rx,
Arc::new(AtomicBool::new(true)),
);
let mut op_state = OpState::new(None, None);
let mut op_state = OpState::new(None);
op_state.put(state);
op_state
}
Expand Down
8 changes: 8 additions & 0 deletions cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,14 @@ fn setup_panic_hook() {
orig_hook(panic_info);
deno_runtime::exit(1);
}));

fn error_handler(file: &str, line: i32, message: &str) {
// Override C++ abort with a rust panic, so we
// get our message above and a nice backtrace.
panic!("Fatal error in {file}:{line}: {message}");
}

deno_core::v8::V8::set_fatal_error_handler(error_handler);
}

fn exit_with_message(message: &str, code: i32) -> ! {
Expand Down
2 changes: 1 addition & 1 deletion cli/tsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ mod tests {
.context("Unable to get CWD")
.unwrap(),
);
let mut op_state = OpState::new(None, None);
let mut op_state = OpState::new(None);
op_state.put(state);
op_state
}
Expand Down
6 changes: 5 additions & 1 deletion ext/ffi/dlfcn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ struct FunctionData {
turbocall: Option<Turbocall>,
}

impl GarbageCollected for FunctionData {}
impl GarbageCollected for FunctionData {
fn get_name(&self) -> &'static std::ffi::CStr {
c"FunctionData"
}
}

// Create a JavaScript function for synchronous FFI call to
// the given symbol.
Expand Down
6 changes: 5 additions & 1 deletion ext/net/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ pub struct NetPermToken {
pub resolved_ips: Vec<String>,
}

impl deno_core::GarbageCollected for NetPermToken {}
impl deno_core::GarbageCollected for NetPermToken {
fn get_name(&self) -> &'static std::ffi::CStr {
c"NetPermToken"
}
}

impl NetPermToken {
/// Checks if the given address is included in the resolved IPs.
Expand Down
30 changes: 25 additions & 5 deletions ext/net/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ struct EndpointResource {
session_store: Arc<dyn ClientSessionStore>,
}

impl GarbageCollected for EndpointResource {}
impl GarbageCollected for EndpointResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"EndpointResource"
}
}

#[op2]
#[cppgc]
Expand Down Expand Up @@ -294,7 +298,11 @@ impl Drop for ListenerResource {
}
}

impl GarbageCollected for ListenerResource {}
impl GarbageCollected for ListenerResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"ListenerResource"
}
}

#[op2]
#[cppgc]
Expand Down Expand Up @@ -345,14 +353,22 @@ struct ConnectionResource(
RefCell<Option<quinn::ZeroRttAccepted>>,
);

impl GarbageCollected for ConnectionResource {}
impl GarbageCollected for ConnectionResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"ConnectionResource"
}
}

struct IncomingResource(
RefCell<Option<quinn::Incoming>>,
Arc<QuicServerConfig>,
);

impl GarbageCollected for IncomingResource {}
impl GarbageCollected for IncomingResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"IncomingResource"
}
}

#[op2(async)]
#[cppgc]
Expand Down Expand Up @@ -481,7 +497,11 @@ pub(crate) fn op_quic_incoming_ignore(

struct ConnectingResource(RefCell<Option<quinn::Connecting>>);

impl GarbageCollected for ConnectingResource {}
impl GarbageCollected for ConnectingResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"ConnectingResource"
}
}

#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
Expand Down
18 changes: 10 additions & 8 deletions ext/node/global.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright 2018-2025 the Deno authors. MIT license.

use std::rc::Rc;

use deno_core::v8;
use deno_core::v8::GetPropertyNamesArgs;
use deno_core::v8::MapFnTo;
Expand All @@ -11,13 +13,13 @@ use deno_core::v8::MapFnTo;
// these mapped functions per-thread. We should revisit it in the future and
// ideally remove altogether.
thread_local! {
pub static GETTER_MAP_FN: v8::NamedPropertyGetterCallback<'static> = getter.map_fn_to();
pub static SETTER_MAP_FN: v8::NamedPropertySetterCallback<'static> = setter.map_fn_to();
pub static QUERY_MAP_FN: v8::NamedPropertyQueryCallback<'static> = query.map_fn_to();
pub static DELETER_MAP_FN: v8::NamedPropertyDeleterCallback<'static> = deleter.map_fn_to();
pub static ENUMERATOR_MAP_FN: v8::NamedPropertyEnumeratorCallback<'static> = enumerator.map_fn_to();
pub static DEFINER_MAP_FN: v8::NamedPropertyDefinerCallback<'static> = definer.map_fn_to();
pub static DESCRIPTOR_MAP_FN: v8::NamedPropertyGetterCallback<'static> = descriptor.map_fn_to();
pub static GETTER_MAP_FN: v8::NamedPropertyGetterCallback = getter.map_fn_to();
pub static SETTER_MAP_FN: v8::NamedPropertySetterCallback = setter.map_fn_to();
pub static QUERY_MAP_FN: v8::NamedPropertyQueryCallback = query.map_fn_to();
pub static DELETER_MAP_FN: v8::NamedPropertyDeleterCallback = deleter.map_fn_to();
pub static ENUMERATOR_MAP_FN: v8::NamedPropertyEnumeratorCallback = enumerator.map_fn_to();
pub static DEFINER_MAP_FN: v8::NamedPropertyDefinerCallback = definer.map_fn_to();
pub static DESCRIPTOR_MAP_FN: v8::NamedPropertyGetterCallback = descriptor.map_fn_to();
}

/// Convert an ASCII string to a UTF-16 byte encoding of the string.
Expand Down Expand Up @@ -224,7 +226,7 @@ pub fn global_object_middleware<'s>(
deno_globals,
node_globals,
};
scope.get_current_context().set_slot(storage);
scope.get_current_context().set_slot(Rc::new(storage));
}

fn is_managed_key(
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/blocklist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ pub struct BlockListResource {
blocklist: RefCell<BlockList>,
}

impl deno_core::GarbageCollected for BlockListResource {}
impl deno_core::GarbageCollected for BlockListResource {
fn get_name(&self) -> &'static std::ffi::CStr {
c"BlockListResource"
}
}

#[derive(Serialize)]
struct SocketAddressSerialization(String, String);
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/crypto/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ pub struct Hasher {
pub hash: Rc<RefCell<Option<Hash>>>,
}

impl GarbageCollected for Hasher {}
impl GarbageCollected for Hasher {
fn get_name(&self) -> &'static std::ffi::CStr {
c"Hasher"
}
}

impl Hasher {
pub fn new(
Expand Down
12 changes: 10 additions & 2 deletions ext/node/ops/crypto/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ pub enum KeyObjectHandle {
Secret(Box<[u8]>),
}

impl GarbageCollected for KeyObjectHandle {}
impl GarbageCollected for KeyObjectHandle {
fn get_name(&self) -> &'static std::ffi::CStr {
c"KeyObjectHandle"
}
}

#[derive(Clone)]
pub enum AsymmetricPrivateKey {
Expand Down Expand Up @@ -1916,7 +1920,11 @@ struct KeyObjectHandlePair {
public_key: RefCell<Option<KeyObjectHandle>>,
}

impl GarbageCollected for KeyObjectHandlePair {}
impl GarbageCollected for KeyObjectHandlePair {
fn get_name(&self) -> &'static std::ffi::CStr {
c"KeyObjectHandlePair"
}
}

impl KeyObjectHandlePair {
pub fn new(
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/crypto/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ pub(crate) struct Certificate {
inner: Yoke<CertificateView<'static>, Box<CertificateSources>>,
}

impl deno_core::GarbageCollected for Certificate {}
impl deno_core::GarbageCollected for Certificate {
fn get_name(&self) -> &'static std::ffi::CStr {
c"Certificate"
}
}

impl Certificate {
fn fingerprint<D: Digest>(&self) -> Option<String> {
Expand Down
12 changes: 10 additions & 2 deletions ext/node/ops/handle_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ pub struct AsyncWrap {
async_id: i64,
}

impl GarbageCollected for AsyncWrap {}
impl GarbageCollected for AsyncWrap {
fn get_name(&self) -> &'static std::ffi::CStr {
c"AsyncWrap"
}
}

impl AsyncWrap {
pub(crate) fn create(state: &mut OpState, provider: i32) -> Self {
Expand Down Expand Up @@ -85,7 +89,11 @@ pub struct HandleWrap {
state: Rc<Cell<State>>,
}

impl GarbageCollected for HandleWrap {}
impl GarbageCollected for HandleWrap {
fn get_name(&self) -> &'static std::ffi::CStr {
c"HandleWrap"
}
}

impl HandleWrap {
pub(crate) fn create(handle: Option<ResourceId>) -> Self {
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/inspector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ struct JSInspectorSession {
tx: RefCell<Option<mpsc::UnboundedSender<String>>>,
}

impl GarbageCollected for JSInspectorSession {}
impl GarbageCollected for JSInspectorSession {
fn get_name(&self) -> &'static std::ffi::CStr {
c"JSInspectorSession"
}
}

#[derive(Debug, thiserror::Error, deno_error::JsError)]
pub enum InspectorConnectError {
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/perf_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ pub struct EldHistogram {
started: Cell<bool>,
}

impl GarbageCollected for EldHistogram {}
impl GarbageCollected for EldHistogram {
fn get_name(&self) -> &'static std::ffi::CStr {
c"EldHistogram"
}
}

#[op2]
impl EldHistogram {
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/sqlite/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ pub struct DatabaseSync {
location: String,
}

impl GarbageCollected for DatabaseSync {}
impl GarbageCollected for DatabaseSync {
fn get_name(&self) -> &'static std::ffi::CStr {
c"DatabaseSync"
}
}

fn set_db_config(
conn: &rusqlite::Connection,
Expand Down
6 changes: 5 additions & 1 deletion ext/node/ops/sqlite/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ pub struct Session {
pub(crate) db: Rc<RefCell<Option<rusqlite::Connection>>>,
}

impl GarbageCollected for Session {}
impl GarbageCollected for Session {
fn get_name(&self) -> &'static std::ffi::CStr {
c"Session"
}
}

impl Drop for Session {
fn drop(&mut self) {
Expand Down
Loading
Loading