diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/build.rs | 84 |
1 files changed, 75 insertions, 9 deletions
diff --git a/runtime/build.rs b/runtime/build.rs index 52933f19b..920aafc9f 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -41,6 +41,76 @@ mod not_docs { println!("Snapshot written to: {} ", snapshot_path.display()); } + struct Permissions; + + impl deno_fetch::FetchPermissions for Permissions { + fn check_net_url( + &mut self, + _url: &deno_core::url::Url, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + + fn check_read( + &mut self, + _p: &Path, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + } + + impl deno_websocket::WebSocketPermissions for Permissions { + fn check_net_url( + &mut self, + _url: &deno_core::url::Url, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + } + + impl deno_timers::TimersPermission for Permissions { + fn allow_hrtime(&mut self) -> bool { + unreachable!("snapshotting!") + } + + fn check_unstable( + &self, + _state: &deno_core::OpState, + _api_name: &'static str, + ) { + unreachable!("snapshotting!") + } + } + + impl deno_ffi::FfiPermissions for Permissions { + fn check(&mut self, _path: &str) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + } + + impl deno_net::NetPermissions for Permissions { + fn check_net<T: AsRef<str>>( + &mut self, + _host: &(T, Option<u16>), + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + + fn check_read( + &mut self, + _p: &Path, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + + fn check_write( + &mut self, + _p: &Path, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + } + fn create_runtime_snapshot(snapshot_path: &Path, files: Vec<PathBuf>) { let extensions: Vec<Extension> = vec![ deno_webidl::init(), @@ -48,7 +118,7 @@ mod not_docs { deno_url::init(), deno_tls::init(), deno_web::init(deno_web::BlobStore::default(), Default::default()), - deno_fetch::init::<deno_fetch::NoFetchPermissions>( + deno_fetch::init::<Permissions>( "".to_owned(), None, None, @@ -56,21 +126,17 @@ mod not_docs { None, None, ), - deno_websocket::init::<deno_websocket::NoWebSocketPermissions>( - "".to_owned(), - None, - None, - ), + deno_websocket::init::<Permissions>("".to_owned(), None, None), deno_webstorage::init(None), deno_crypto::init(None), deno_webgpu::init(false), - deno_timers::init::<deno_timers::NoTimersPermission>(), + deno_timers::init::<Permissions>(), deno_broadcast_channel::init( deno_broadcast_channel::InMemoryBroadcastChannel::default(), false, // No --unstable. ), - deno_ffi::init::<deno_ffi::NoFfiPermissions>(false), - deno_net::init::<deno_net::NoNetPermissions>( + deno_ffi::init::<Permissions>(false), + deno_net::init::<Permissions>( None, false, // No --unstable. None, ), |