summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/fetch/lib.rs13
-rw-r--r--ext/ffi/lib.rs8
-rw-r--r--ext/net/lib.rs20
-rw-r--r--ext/timers/benches/timers_ops.rs18
-rw-r--r--ext/timers/lib.rs9
-rw-r--r--ext/websocket/lib.rs9
6 files changed, 16 insertions, 61 deletions
diff --git a/ext/fetch/lib.rs b/ext/fetch/lib.rs
index b422c2741..dfb1ce059 100644
--- a/ext/fetch/lib.rs
+++ b/ext/fetch/lib.rs
@@ -120,19 +120,6 @@ pub trait FetchPermissions {
fn check_read(&mut self, _p: &Path) -> Result<(), AnyError>;
}
-/// For use with `op_fetch` when the user does not want permissions.
-pub struct NoFetchPermissions;
-
-impl FetchPermissions for NoFetchPermissions {
- fn check_net_url(&mut self, _url: &Url) -> Result<(), AnyError> {
- Ok(())
- }
-
- fn check_read(&mut self, _p: &Path) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
pub fn get_declaration() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_fetch.d.ts")
}
diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs
index 673f83472..e0430366c 100644
--- a/ext/ffi/lib.rs
+++ b/ext/ffi/lib.rs
@@ -37,14 +37,6 @@ pub trait FfiPermissions {
fn check(&mut self, path: &str) -> Result<(), AnyError>;
}
-pub struct NoFfiPermissions;
-
-impl FfiPermissions for NoFfiPermissions {
- fn check(&mut self, _path: &str) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
struct Symbol {
cif: libffi::middle::Cif,
ptr: libffi::middle::CodePtr,
diff --git a/ext/net/lib.rs b/ext/net/lib.rs
index 8909c6f40..ad14c15d8 100644
--- a/ext/net/lib.rs
+++ b/ext/net/lib.rs
@@ -26,26 +26,6 @@ pub trait NetPermissions {
fn check_write(&mut self, _p: &Path) -> Result<(), AnyError>;
}
-/// For use with this crate when the user does not want permission checks.
-pub struct NoNetPermissions;
-
-impl NetPermissions for NoNetPermissions {
- fn check_net<T: AsRef<str>>(
- &mut self,
- _host: &(T, Option<u16>),
- ) -> Result<(), AnyError> {
- Ok(())
- }
-
- fn check_read(&mut self, _p: &Path) -> Result<(), AnyError> {
- Ok(())
- }
-
- fn check_write(&mut self, _p: &Path) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
/// `UnstableChecker` is a struct so it can be placed inside `GothamState`;
/// using type alias for a bool could work, but there's a high chance
/// that there might be another type alias pointing to a bool, which
diff --git a/ext/timers/benches/timers_ops.rs b/ext/timers/benches/timers_ops.rs
index 269d9627d..8d13d5807 100644
--- a/ext/timers/benches/timers_ops.rs
+++ b/ext/timers/benches/timers_ops.rs
@@ -5,12 +5,26 @@ use deno_bench_util::bencher::{benchmark_group, Bencher};
use deno_bench_util::{bench_js_async, bench_js_sync};
use deno_web::BlobStore;
+struct Permissions;
+
+impl deno_timers::TimersPermission for Permissions {
+ fn allow_hrtime(&mut self) -> bool {
+ true
+ }
+ fn check_unstable(
+ &self,
+ _state: &deno_core::OpState,
+ _api_name: &'static str,
+ ) {
+ }
+}
+
fn setup() -> Vec<Extension> {
vec![
deno_webidl::init(),
deno_url::init(),
deno_web::init(BlobStore::default(), None),
- deno_timers::init::<deno_timers::NoTimersPermission>(),
+ deno_timers::init::<Permissions>(),
Extension::builder()
.js(vec![
("setup",
@@ -21,7 +35,7 @@ fn setup() -> Vec<Extension> {
),
])
.state(|state| {
- state.put(deno_timers::NoTimersPermission{});
+ state.put(Permissions{});
Ok(())
})
.build()
diff --git a/ext/timers/lib.rs b/ext/timers/lib.rs
index 2b9948d1f..384627c57 100644
--- a/ext/timers/lib.rs
+++ b/ext/timers/lib.rs
@@ -31,15 +31,6 @@ pub trait TimersPermission {
fn check_unstable(&self, state: &OpState, api_name: &'static str);
}
-pub struct NoTimersPermission;
-
-impl TimersPermission for NoTimersPermission {
- fn allow_hrtime(&mut self) -> bool {
- false
- }
- fn check_unstable(&self, _: &OpState, _: &'static str) {}
-}
-
pub fn init<P: TimersPermission + 'static>() -> Extension {
Extension::builder()
.js(include_js_files!(
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index dbb88dc8d..ebb2186d0 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -59,15 +59,6 @@ pub trait WebSocketPermissions {
/// would override previously used alias.
pub struct UnsafelyIgnoreCertificateErrors(Option<Vec<String>>);
-/// For use with `op_websocket_*` when the user does not want permissions.
-pub struct NoWebSocketPermissions;
-
-impl WebSocketPermissions for NoWebSocketPermissions {
- fn check_net_url(&mut self, _url: &url::Url) -> Result<(), AnyError> {
- Ok(())
- }
-}
-
type WsStream = WebSocketStream<MaybeTlsStream<TcpStream>>;
pub enum WebSocketStreamType {
Client {