summaryrefslogtreecommitdiff
path: root/runtime/snapshot.rs
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /runtime/snapshot.rs
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'runtime/snapshot.rs')
-rw-r--r--runtime/snapshot.rs76
1 files changed, 45 insertions, 31 deletions
diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs
index 041132f97..3bf515131 100644
--- a/runtime/snapshot.rs
+++ b/runtime/snapshot.rs
@@ -5,12 +5,12 @@ use crate::ops::bootstrap::SnapshotOptions;
use crate::shared::maybe_transpile_source;
use crate::shared::runtime;
use deno_cache::SqliteBackedCache;
-use deno_core::error::AnyError;
use deno_core::snapshot::*;
use deno_core::v8;
use deno_core::Extension;
use deno_http::DefaultHttpPropertyExtractor;
use deno_io::fs::FsError;
+use deno_permissions::PermissionCheckError;
use std::borrow::Cow;
use std::io::Write;
use std::path::Path;
@@ -26,7 +26,7 @@ impl deno_websocket::WebSocketPermissions for Permissions {
&mut self,
_url: &deno_core::url::Url,
_api_name: &str,
- ) -> Result<(), deno_core::error::AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -42,7 +42,7 @@ impl deno_fetch::FetchPermissions for Permissions {
&mut self,
_url: &deno_core::url::Url,
_api_name: &str,
- ) -> Result<(), deno_core::error::AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -50,28 +50,26 @@ impl deno_fetch::FetchPermissions for Permissions {
&mut self,
_p: &'a Path,
_api_name: &str,
- ) -> Result<Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
impl deno_ffi::FfiPermissions for Permissions {
- fn check_partial_no_path(
- &mut self,
- ) -> Result<(), deno_core::error::AnyError> {
+ fn check_partial_no_path(&mut self) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
fn check_partial_with_path(
&mut self,
_path: &str,
- ) -> Result<PathBuf, AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
impl deno_napi::NapiPermissions for Permissions {
- fn check(&mut self, _path: &str) -> std::result::Result<PathBuf, AnyError> {
+ fn check(&mut self, _path: &str) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -81,20 +79,27 @@ impl deno_node::NodePermissions for Permissions {
&mut self,
_url: &deno_core::url::Url,
_api_name: &str,
- ) -> Result<(), deno_core::error::AnyError> {
+ ) -> Result<(), PermissionCheckError> {
+ unreachable!("snapshotting!")
+ }
+ fn check_net(
+ &mut self,
+ _host: (&str, Option<u16>),
+ _api_name: &str,
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
fn check_read_path<'a>(
&mut self,
_path: &'a Path,
- ) -> Result<Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
fn check_read_with_api_name(
&mut self,
_p: &str,
_api_name: Option<&str>,
- ) -> Result<PathBuf, deno_core::error::AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
fn query_read_all(&mut self) -> bool {
@@ -104,14 +109,14 @@ impl deno_node::NodePermissions for Permissions {
&mut self,
_p: &str,
_api_name: Option<&str>,
- ) -> Result<PathBuf, deno_core::error::AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
fn check_sys(
&mut self,
_kind: &str,
_api_name: &str,
- ) -> Result<(), deno_core::error::AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -121,7 +126,7 @@ impl deno_net::NetPermissions for Permissions {
&mut self,
_host: &(T, Option<u16>),
_api_name: &str,
- ) -> Result<(), deno_core::error::AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -129,7 +134,7 @@ impl deno_net::NetPermissions for Permissions {
&mut self,
_p: &str,
_api_name: &str,
- ) -> Result<PathBuf, deno_core::error::AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -137,7 +142,7 @@ impl deno_net::NetPermissions for Permissions {
&mut self,
_p: &str,
_api_name: &str,
- ) -> Result<PathBuf, deno_core::error::AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -145,7 +150,7 @@ impl deno_net::NetPermissions for Permissions {
&mut self,
_p: &'a Path,
_api_name: &str,
- ) -> Result<std::borrow::Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -158,7 +163,7 @@ impl deno_fs::FsPermissions for Permissions {
_write: bool,
_path: &'a Path,
_api_name: &str,
- ) -> Result<std::borrow::Cow<'a, Path>, FsError> {
+ ) -> Result<Cow<'a, Path>, FsError> {
unreachable!("snapshotting!")
}
@@ -166,11 +171,14 @@ impl deno_fs::FsPermissions for Permissions {
&mut self,
_path: &str,
_api_name: &str,
- ) -> Result<PathBuf, AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
- fn check_read_all(&mut self, _api_name: &str) -> Result<(), AnyError> {
+ fn check_read_all(
+ &mut self,
+ _api_name: &str,
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -179,7 +187,7 @@ impl deno_fs::FsPermissions for Permissions {
_path: &Path,
_display: &str,
_api_name: &str,
- ) -> Result<(), AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -187,7 +195,7 @@ impl deno_fs::FsPermissions for Permissions {
&mut self,
_path: &str,
_api_name: &str,
- ) -> Result<PathBuf, AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -195,11 +203,14 @@ impl deno_fs::FsPermissions for Permissions {
&mut self,
_path: &str,
_api_name: &str,
- ) -> Result<PathBuf, AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
- fn check_write_all(&mut self, _api_name: &str) -> Result<(), AnyError> {
+ fn check_write_all(
+ &mut self,
+ _api_name: &str,
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -208,7 +219,7 @@ impl deno_fs::FsPermissions for Permissions {
_path: &Path,
_display: &str,
_api_name: &str,
- ) -> Result<(), AnyError> {
+ ) -> Result<(), PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -216,7 +227,7 @@ impl deno_fs::FsPermissions for Permissions {
&mut self,
_path: &'a Path,
_api_name: &str,
- ) -> Result<std::borrow::Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -224,7 +235,7 @@ impl deno_fs::FsPermissions for Permissions {
&mut self,
_path: &'a Path,
_api_name: &str,
- ) -> Result<std::borrow::Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -234,7 +245,7 @@ impl deno_kv::sqlite::SqliteDbHandlerPermissions for Permissions {
&mut self,
_path: &str,
_api_name: &str,
- ) -> Result<PathBuf, AnyError> {
+ ) -> Result<PathBuf, PermissionCheckError> {
unreachable!("snapshotting!")
}
@@ -242,7 +253,7 @@ impl deno_kv::sqlite::SqliteDbHandlerPermissions for Permissions {
&mut self,
_path: &'a Path,
_api_name: &str,
- ) -> Result<Cow<'a, Path>, AnyError> {
+ ) -> Result<Cow<'a, Path>, PermissionCheckError> {
unreachable!("snapshotting!")
}
}
@@ -289,7 +300,9 @@ pub fn create_runtime_snapshot(
deno_cron::local::LocalCronHandler::new(),
),
deno_napi::deno_napi::init_ops_and_esm::<Permissions>(),
- deno_http::deno_http::init_ops_and_esm::<DefaultHttpPropertyExtractor>(),
+ deno_http::deno_http::init_ops_and_esm::<DefaultHttpPropertyExtractor>(
+ deno_http::Options::default(),
+ ),
deno_io::deno_io::init_ops_and_esm(Default::default()),
deno_fs::deno_fs::init_ops_and_esm::<Permissions>(fs.clone()),
deno_node::deno_node::init_ops_and_esm::<Permissions>(None, fs.clone()),
@@ -301,6 +314,7 @@ pub fn create_runtime_snapshot(
),
ops::fs_events::deno_fs_events::init_ops(),
ops::os::deno_os::init_ops(Default::default()),
+ ops::otel::deno_otel::init_ops(),
ops::permissions::deno_permissions::init_ops(),
ops::process::deno_process::init_ops(None),
ops::signal::deno_signal::init_ops(),