diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-01-07 17:25:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-07 17:25:34 +0100 |
commit | fac64478157ee563b185edb5734688e4523df3a1 (patch) | |
tree | 888d562982e1fc37dfb9a4459928bcec84d55dfc /cli/build.rs | |
parent | 82e930726ee5dbac8e6eae0962c07c72daf9843c (diff) |
refactor(permissions): add PermissionsContainer struct for internal mutability (#17134)
Turns out we were cloning permissions which after prompting were discarded,
so the state of permissions was never preserved. To handle that we need to store
all permissions behind "Arc<Mutex<>>" (because there are situations where we
need to send them to other thread).
Testing and benching code still uses "Permissions" in most places - it's undesirable
to share the same permission set between various test/bench files - otherwise
granting or revoking permissions in one file would influence behavior of other test
files.
Diffstat (limited to 'cli/build.rs')
-rw-r--r-- | cli/build.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/build.rs b/cli/build.rs index faeaed073..b4acc0d1d 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -7,7 +7,7 @@ use std::path::PathBuf; use deno_core::snapshot_util::*; use deno_core::Extension; use deno_runtime::deno_cache::SqliteBackedCache; -use deno_runtime::permissions::Permissions; +use deno_runtime::permissions::PermissionsContainer; use deno_runtime::*; mod ts { @@ -294,13 +294,13 @@ fn create_cli_snapshot(snapshot_path: PathBuf, files: Vec<PathBuf>) { deno_console::init(), deno_url::init(), deno_tls::init(), - deno_web::init::<Permissions>( + deno_web::init::<PermissionsContainer>( deno_web::BlobStore::default(), Default::default(), ), - deno_fetch::init::<Permissions>(Default::default()), + deno_fetch::init::<PermissionsContainer>(Default::default()), deno_cache::init::<SqliteBackedCache>(None), - deno_websocket::init::<Permissions>("".to_owned(), None, None), + deno_websocket::init::<PermissionsContainer>("".to_owned(), None, None), deno_webstorage::init(None), deno_crypto::init(None), deno_webgpu::init(false), @@ -308,15 +308,15 @@ fn create_cli_snapshot(snapshot_path: PathBuf, files: Vec<PathBuf>) { deno_broadcast_channel::InMemoryBroadcastChannel::default(), false, // No --unstable. ), - deno_node::init::<Permissions>(None), // No --unstable. - deno_ffi::init::<Permissions>(false), - deno_net::init::<Permissions>( + deno_node::init::<PermissionsContainer>(None), // No --unstable. + deno_ffi::init::<PermissionsContainer>(false), + deno_net::init::<PermissionsContainer>( None, false, // No --unstable. None, ), - deno_napi::init::<Permissions>(false), + deno_napi::init::<PermissionsContainer>(false), deno_http::init(), - deno_flash::init::<Permissions>(false), // No --unstable + deno_flash::init::<PermissionsContainer>(false), // No --unstable ]; create_snapshot(CreateSnapshotOptions { |