diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-06-06 23:37:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-06 23:37:53 -0400 |
commit | 386d5c8310891c5dc9627abbf2374e60bb4e50d2 (patch) | |
tree | 920367bb6e14a5d259a01765962e93ff991c1fa0 /ext/net/lib.rs | |
parent | a17794d5cf0c8d1ecc624c490071e5b3a5856bc7 (diff) |
refactor: remove `PermissionsContainer` in deno_runtime (#24119)
Also removes permissions being passed in for node resolution. It was
completely useless because we only checked it for reading package.json
files, but Deno reading package.json files for resolution is perfectly
fine.
My guess is this is also a perf improvement because Deno is doing less
work.
Diffstat (limited to 'ext/net/lib.rs')
-rw-r--r-- | ext/net/lib.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ext/net/lib.rs b/ext/net/lib.rs index fa8074b34..3b6c05282 100644 --- a/ext/net/lib.rs +++ b/ext/net/lib.rs @@ -30,6 +30,35 @@ pub trait NetPermissions { -> Result<(), AnyError>; } +impl NetPermissions for deno_permissions::PermissionsContainer { + #[inline(always)] + fn check_net<T: AsRef<str>>( + &mut self, + host: &(T, Option<u16>), + api_name: &str, + ) -> Result<(), AnyError> { + deno_permissions::PermissionsContainer::check_net(self, host, api_name) + } + + #[inline(always)] + fn check_read( + &mut self, + path: &Path, + api_name: &str, + ) -> Result<(), AnyError> { + deno_permissions::PermissionsContainer::check_read(self, path, api_name) + } + + #[inline(always)] + fn check_write( + &mut self, + path: &Path, + api_name: &str, + ) -> Result<(), AnyError> { + deno_permissions::PermissionsContainer::check_write(self, path, api_name) + } +} + /// Helper for checking unstable features. Used for sync ops. fn check_unstable(state: &OpState, api_name: &str) { // TODO(bartlomieju): replace with `state.feature_checker.check_or_exit` |