summaryrefslogtreecommitdiff
path: root/runtime/examples
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-01-07 17:25:34 +0100
committerGitHub <noreply@github.com>2023-01-07 17:25:34 +0100
commitfac64478157ee563b185edb5734688e4523df3a1 (patch)
tree888d562982e1fc37dfb9a4459928bcec84d55dfc /runtime/examples
parent82e930726ee5dbac8e6eae0962c07c72daf9843c (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 'runtime/examples')
-rw-r--r--runtime/examples/hello_runtime.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/examples/hello_runtime.rs b/runtime/examples/hello_runtime.rs
index 19496918e..fca7ff2c9 100644
--- a/runtime/examples/hello_runtime.rs
+++ b/runtime/examples/hello_runtime.rs
@@ -4,7 +4,7 @@ use deno_core::error::AnyError;
use deno_core::FsModuleLoader;
use deno_runtime::deno_broadcast_channel::InMemoryBroadcastChannel;
use deno_runtime::deno_web::BlobStore;
-use deno_runtime::permissions::Permissions;
+use deno_runtime::permissions::PermissionsContainer;
use deno_runtime::worker::MainWorker;
use deno_runtime::worker::WorkerOptions;
use deno_runtime::BootstrapOptions;
@@ -71,7 +71,7 @@ async fn main() -> Result<(), AnyError> {
let js_path =
Path::new(env!("CARGO_MANIFEST_DIR")).join("examples/hello_runtime.js");
let main_module = deno_core::resolve_path(&js_path.to_string_lossy())?;
- let permissions = Permissions::allow_all();
+ let permissions = PermissionsContainer::allow_all();
let mut worker = MainWorker::bootstrap_from_options(
main_module.clone(),