mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
feat(permissions): Deno.mainModule
doesn't require permissions (#25667)
Closes https://github.com/denoland/deno/issues/7315.
This commit is contained in:
parent
62e952559f
commit
e81c67ba22
2 changed files with 1 additions and 8 deletions
|
@ -4,7 +4,6 @@ use deno_core::error::AnyError;
|
||||||
use deno_core::op2;
|
use deno_core::op2;
|
||||||
use deno_core::ModuleSpecifier;
|
use deno_core::ModuleSpecifier;
|
||||||
use deno_core::OpState;
|
use deno_core::OpState;
|
||||||
use deno_permissions::PermissionsContainer;
|
|
||||||
|
|
||||||
deno_core::extension!(
|
deno_core::extension!(
|
||||||
deno_runtime,
|
deno_runtime,
|
||||||
|
@ -20,12 +19,6 @@ deno_core::extension!(
|
||||||
fn op_main_module(state: &mut OpState) -> Result<String, AnyError> {
|
fn op_main_module(state: &mut OpState) -> Result<String, AnyError> {
|
||||||
let main_url = state.borrow::<ModuleSpecifier>();
|
let main_url = state.borrow::<ModuleSpecifier>();
|
||||||
let main_path = main_url.to_string();
|
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)
|
Ok(main_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ itest!(import_meta {
|
||||||
});
|
});
|
||||||
|
|
||||||
itest!(main_module {
|
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",
|
output: "run/main_module/main.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue