1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

feat(permissions): Deno.mainModule doesn't require permissions (#25667)

Closes https://github.com/denoland/deno/issues/7315.
This commit is contained in:
Nathan Whitaker 2024-09-16 13:43:52 -07:00 committed by GitHub
parent 62e952559f
commit e81c67ba22
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 8 deletions

View file

@ -4,7 +4,6 @@ use deno_core::error::AnyError;
use deno_core::op2;
use deno_core::ModuleSpecifier;
use deno_core::OpState;
use deno_permissions::PermissionsContainer;
deno_core::extension!(
deno_runtime,
@ -20,12 +19,6 @@ deno_core::extension!(
fn op_main_module(state: &mut OpState) -> Result<String, AnyError> {
let main_url = state.borrow::<ModuleSpecifier>();
let main_path = main_url.to_string();
if main_url.scheme() == "file" {
let main_path = main_url.to_file_path().unwrap();
state
.borrow_mut::<PermissionsContainer>()
.check_read_blind(&main_path, "main_module", "Deno.mainModule")?;
}
Ok(main_path)
}

View file

@ -1553,7 +1553,7 @@ itest!(import_meta {
});
itest!(main_module {
args: "run --quiet --allow-read --reload run/main_module/main.ts",
args: "run --quiet --reload run/main_module/main.ts",
output: "run/main_module/main.out",
});