diff options
| author | Luca Casonato <hello@lcas.dev> | 2021-10-04 22:56:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-04 22:56:24 +0200 |
| commit | 64a7187238c4f291f254bd6eb58138a3a6534898 (patch) | |
| tree | f1d552ffdfab2324e818589b5d357a674dd22a2c /ext/timers/benches/timers_ops.rs | |
| parent | c6ae41fd8701b0fc5735ae4a6fa288f5cb35f03a (diff) | |
chore: remove No*Permissions structs (#12316)
These are confusing. They say they are "for users that don't care about
permissions", but that isn't correct. `NoTimersPermissions` disables
permissions instead of enabling them.
I would argue that implementors should decide what permissions they want
themselves, and not take our opinionated permissions struct.
Diffstat (limited to 'ext/timers/benches/timers_ops.rs')
| -rw-r--r-- | ext/timers/benches/timers_ops.rs | 18 |
1 files changed, 16 insertions, 2 deletions
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() |
