From b4939f33795b42f4a6bb47a803a9c83b531454a4 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 21 Jun 2024 10:49:39 +0530 Subject: fix: upgrade deno_core to 0.291.0 (#24297) --- ext/net/ops_tls.rs | 36 +++++++++++++----------------------- ext/node/ops/blocklist.rs | 2 ++ ext/node/ops/crypto/x509.rs | 2 ++ ext/node/ops/vm.rs | 2 ++ ext/node/ops/vm_internal.rs | 5 ++++- ext/node/ops/zlib/mod.rs | 2 ++ ext/tls/tls_key.rs | 4 ++++ 7 files changed, 29 insertions(+), 24 deletions(-) (limited to 'ext') diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index c52985908..adfa8224c 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -195,41 +195,34 @@ pub struct StartTlsArgs { } #[op2] -pub fn op_tls_key_null<'s>( - scope: &mut v8::HandleScope<'s>, -) -> Result, AnyError> { - Ok(deno_core::cppgc::make_cppgc_object( - scope, - TlsKeysHolder::from(TlsKeys::Null), - )) +#[cppgc] +pub fn op_tls_key_null() -> TlsKeysHolder { + TlsKeysHolder::from(TlsKeys::Null) } #[op2] -pub fn op_tls_key_static<'s>( - scope: &mut v8::HandleScope<'s>, - #[string] cert: String, - #[string] key: String, -) -> Result, AnyError> { +#[cppgc] +pub fn op_tls_key_static( + #[string] cert: &str, + #[string] key: &str, +) -> Result { let cert = load_certs(&mut BufReader::new(cert.as_bytes()))?; let key = load_private_keys(key.as_bytes())? .into_iter() .next() .unwrap(); - Ok(deno_core::cppgc::make_cppgc_object( - scope, - TlsKeysHolder::from(TlsKeys::Static(TlsKey(cert, key))), - )) + Ok(TlsKeysHolder::from(TlsKeys::Static(TlsKey(cert, key)))) } /// Legacy op -- will be removed in Deno 2.0. #[op2] -pub fn op_tls_key_static_from_file<'s, NP>( +#[cppgc] +pub fn op_tls_key_static_from_file( state: &mut OpState, - scope: &mut v8::HandleScope<'s>, #[string] api: String, #[string] cert_file: String, #[string] key_file: String, -) -> Result, AnyError> +) -> Result where NP: NetPermissions + 'static, { @@ -244,10 +237,7 @@ where .into_iter() .next() .unwrap(); - Ok(deno_core::cppgc::make_cppgc_object( - scope, - TlsKeysHolder::from(TlsKeys::Static(TlsKey(cert, key))), - )) + Ok(TlsKeysHolder::from(TlsKeys::Static(TlsKey(cert, key)))) } #[op2] diff --git a/ext/node/ops/blocklist.rs b/ext/node/ops/blocklist.rs index ce32c14ba..b853a5723 100644 --- a/ext/node/ops/blocklist.rs +++ b/ext/node/ops/blocklist.rs @@ -22,6 +22,8 @@ pub struct BlockListResource { blocklist: RefCell, } +impl deno_core::GcResource for BlockListResource {} + #[derive(Serialize)] struct SocketAddressSerialization(String, String); diff --git a/ext/node/ops/crypto/x509.rs b/ext/node/ops/crypto/x509.rs index 8ae7c314d..517a3a943 100644 --- a/ext/node/ops/crypto/x509.rs +++ b/ext/node/ops/crypto/x509.rs @@ -19,6 +19,8 @@ pub(crate) struct Certificate { cert: X509Certificate<'static>, } +impl deno_core::GcResource for Certificate {} + impl Certificate { fn fingerprint(&self) -> Option { self.pem.as_ref().map(|pem| { diff --git a/ext/node/ops/vm.rs b/ext/node/ops/vm.rs index 7b12b72b7..2614c4f73 100644 --- a/ext/node/ops/vm.rs +++ b/ext/node/ops/vm.rs @@ -29,6 +29,8 @@ pub struct Script { inner: i::ContextifyScript, } +impl deno_core::GcResource for Script {} + impl Script { fn new( scope: &mut v8::HandleScope, diff --git a/ext/node/ops/vm_internal.rs b/ext/node/ops/vm_internal.rs index 4af182595..0ac714c9f 100644 --- a/ext/node/ops/vm_internal.rs +++ b/ext/node/ops/vm_internal.rs @@ -64,6 +64,8 @@ pub struct ContextifyContext { sandbox: v8::Global, } +impl deno_core::GcResource for ContextifyContext {} + impl ContextifyContext { pub fn attach( scope: &mut v8::HandleScope, @@ -125,7 +127,7 @@ impl ContextifyContext { } pub fn from_sandbox_obj<'a>( - scope: &mut v8::HandleScope, + scope: &mut v8::HandleScope<'a>, sandbox_obj: v8::Local, ) -> Option<&'a Self> { let private_str = @@ -136,6 +138,7 @@ impl ContextifyContext { .get_private(scope, private_symbol) .and_then(|wrapper| { deno_core::cppgc::try_unwrap_cppgc_object::(wrapper) + .map(|s| s as _) }) } diff --git a/ext/node/ops/zlib/mod.rs b/ext/node/ops/zlib/mod.rs index 7f2871a16..9e030176a 100644 --- a/ext/node/ops/zlib/mod.rs +++ b/ext/node/ops/zlib/mod.rs @@ -233,6 +233,8 @@ struct Zlib { inner: RefCell>, } +impl deno_core::GcResource for Zlib {} + impl deno_core::Resource for Zlib { fn name(&self) -> Cow { "zlib".into() diff --git a/ext/tls/tls_key.rs b/ext/tls/tls_key.rs index 18064a91a..66fea3a69 100644 --- a/ext/tls/tls_key.rs +++ b/ext/tls/tls_key.rs @@ -50,6 +50,8 @@ pub enum TlsKeys { pub struct TlsKeysHolder(RefCell); +impl deno_core::GcResource for TlsKeysHolder {} + impl TlsKeysHolder { pub fn take(&self) -> TlsKeys { std::mem::take(&mut *self.0.borrow_mut()) @@ -222,6 +224,8 @@ pub struct TlsKeyLookup { RefCell>>>, } +impl deno_core::GcResource for TlsKeyLookup {} + impl TlsKeyLookup { /// Multiple `poll` calls are safe, but this method is not starvation-safe. Generally /// only one `poll`er should be active at any time. -- cgit v1.2.3