diff options
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/Cargo.toml | 2 | ||||
| -rw-r--r-- | runtime/build.rs | 10 | ||||
| -rw-r--r-- | runtime/lib.rs | 1 | ||||
| -rw-r--r-- | runtime/permissions.rs | 8 | ||||
| -rw-r--r-- | runtime/web_worker.rs | 1 | ||||
| -rw-r--r-- | runtime/worker.rs | 1 |
6 files changed, 23 insertions, 0 deletions
diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 467623933..a37f344ac 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -40,6 +40,7 @@ deno_webgpu = { version = "0.72.0", path = "../ext/webgpu" } deno_webidl = { version = "0.71.0", path = "../ext/webidl" } deno_websocket = { version = "0.76.0", path = "../ext/websocket" } deno_webstorage = { version = "0.66.0", path = "../ext/webstorage" } +deno_napi = { version = "0.1.0", path = "../ext/napi" } lzzzz = '1.0' @@ -57,6 +58,7 @@ deno_fetch = { version = "0.94.0", path = "../ext/fetch" } deno_ffi = { version = "0.58.0", path = "../ext/ffi" } deno_flash = { version = "0.7.0", path = "../ext/flash" } deno_http = { version = "0.65.0", path = "../ext/http" } +deno_napi = { version = "0.1.0", path = "../ext/napi" } deno_net = { version = "0.63.0", path = "../ext/net" } deno_node = { version = "0.8.0", path = "../ext/node" } deno_tls = { version = "0.58.0", path = "../ext/tls" } diff --git a/runtime/build.rs b/runtime/build.rs index 55a89fb8b..23411fc77 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -120,6 +120,15 @@ mod not_docs { } } + impl deno_napi::NapiPermissions for Permissions { + fn check( + &mut self, + _path: Option<&Path>, + ) -> Result<(), deno_core::error::AnyError> { + unreachable!("snapshotting!") + } + } + impl deno_flash::FlashPermissions for Permissions { fn check_net<T: AsRef<str>>( &mut self, @@ -191,6 +200,7 @@ mod not_docs { None, false, // No --unstable. None, ), + deno_napi::init::<Permissions>(false), deno_http::init(), deno_flash::init::<Permissions>(false), // No --unstable ]; diff --git a/runtime/lib.rs b/runtime/lib.rs index 99813e3d8..d0d27b71c 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -8,6 +8,7 @@ pub use deno_crypto; pub use deno_fetch; pub use deno_ffi; pub use deno_http; +pub use deno_napi; pub use deno_net; pub use deno_node; pub use deno_tls; diff --git a/runtime/permissions.rs b/runtime/permissions.rs index 1568410b3..ec2f146ae 100644 --- a/runtime/permissions.rs +++ b/runtime/permissions.rs @@ -1656,6 +1656,14 @@ impl deno_websocket::WebSocketPermissions for Permissions { } } +// NOTE(bartlomieju): for now, NAPI uses `--allow-ffi` flag, but that might +// change in the future. +impl deno_napi::NapiPermissions for Permissions { + fn check(&mut self, path: Option<&Path>) -> Result<(), AnyError> { + self.ffi.check(path) + } +} + impl deno_ffi::FfiPermissions for Permissions { fn check(&mut self, path: Option<&Path>) -> Result<(), AnyError> { self.ffi.check(path) diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index 09a631916..f08127b22 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -431,6 +431,7 @@ impl WebWorker { unstable, options.unsafely_ignore_certificate_errors.clone(), ), + deno_napi::init::<Permissions>(unstable), deno_node::init::<Permissions>(unstable, options.npm_resolver), ops::os::init_for_worker(), ops::permissions::init(), diff --git a/runtime/worker.rs b/runtime/worker.rs index 3ac3654e2..9b2755939 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -189,6 +189,7 @@ impl MainWorker { unstable, options.unsafely_ignore_certificate_errors.clone(), ), + deno_napi::init::<Permissions>(unstable), deno_node::init::<Permissions>(unstable, options.npm_resolver), ops::os::init(exit_code.clone()), ops::permissions::init(), |
