summaryrefslogtreecommitdiff
path: root/runtime/permissions.rs
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2021-04-14 21:10:48 +0200
committerGitHub <noreply@github.com>2021-04-14 21:10:48 +0200
commit5214acd3d9dec56ee159544f0f6bf9834a62c097 (patch)
treeadc369b0214f5660f7c0cfd881d90f80c4800c6b /runtime/permissions.rs
parent83f6d4bf940e8e6fa1393139df51916dbb94470b (diff)
refactor: move timers to deno_timers op crate (#10179)
Move timers out of runtime/ and into a standalone op crate.
Diffstat (limited to 'runtime/permissions.rs')
-rw-r--r--runtime/permissions.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/permissions.rs b/runtime/permissions.rs
index e43e0eaa0..3bdfd16bb 100644
--- a/runtime/permissions.rs
+++ b/runtime/permissions.rs
@@ -9,6 +9,7 @@ use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::url;
use deno_core::ModuleSpecifier;
+use deno_core::OpState;
use log::debug;
use std::collections::HashSet;
use std::fmt;
@@ -968,6 +969,16 @@ impl deno_fetch::FetchPermissions for Permissions {
}
}
+impl deno_timers::TimersPermission for Permissions {
+ fn allow_hrtime(&mut self) -> bool {
+ self.hrtime.check().is_ok()
+ }
+
+ fn check_unstable(&self, state: &OpState, api_name: &'static str) {
+ crate::ops::check_unstable(state, api_name);
+ }
+}
+
impl deno_websocket::WebSocketPermissions for Permissions {
fn check_net_url(&mut self, url: &url::Url) -> Result<(), AnyError> {
self.net.check_url(url)