mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
feat: never prompt for hrtime permission (#13696)
This commit is contained in:
parent
57f4b0e5af
commit
e5b5753dd3
1 changed files with 11 additions and 15 deletions
|
@ -1156,7 +1156,7 @@ impl Default for Permissions {
|
|||
env: Permissions::new_env(&None, false),
|
||||
run: Permissions::new_run(&None, false),
|
||||
ffi: Permissions::new_ffi(&None, false),
|
||||
hrtime: Permissions::new_hrtime(false, false),
|
||||
hrtime: Permissions::new_hrtime(false),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1263,12 +1263,12 @@ impl Permissions {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new_hrtime(state: bool, prompt: bool) -> UnitPermission {
|
||||
pub fn new_hrtime(state: bool) -> UnitPermission {
|
||||
unit_permission_from_flag_bool(
|
||||
state,
|
||||
"hrtime",
|
||||
"high precision time",
|
||||
prompt,
|
||||
false, // never prompt for hrtime
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1280,7 +1280,7 @@ impl Permissions {
|
|||
env: Permissions::new_env(&opts.allow_env, opts.prompt),
|
||||
run: Permissions::new_run(&opts.allow_run, opts.prompt),
|
||||
ffi: Permissions::new_ffi(&opts.allow_ffi, opts.prompt),
|
||||
hrtime: Permissions::new_hrtime(opts.allow_hrtime, opts.prompt),
|
||||
hrtime: Permissions::new_hrtime(opts.allow_hrtime),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1292,7 +1292,7 @@ impl Permissions {
|
|||
env: Permissions::new_env(&Some(vec![]), false),
|
||||
run: Permissions::new_run(&Some(vec![]), false),
|
||||
ffi: Permissions::new_ffi(&Some(vec![]), false),
|
||||
hrtime: Permissions::new_hrtime(true, false),
|
||||
hrtime: Permissions::new_hrtime(true),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2400,7 +2400,7 @@ mod tests {
|
|||
},
|
||||
hrtime: UnitPermission {
|
||||
state: PermissionState::Prompt,
|
||||
..Permissions::new_hrtime(false, false)
|
||||
..Permissions::new_hrtime(false)
|
||||
},
|
||||
};
|
||||
#[rustfmt::skip]
|
||||
|
@ -2516,7 +2516,7 @@ mod tests {
|
|||
},
|
||||
hrtime: UnitPermission {
|
||||
state: PermissionState::Denied,
|
||||
..Permissions::new_hrtime(false, false)
|
||||
..Permissions::new_hrtime(false)
|
||||
},
|
||||
};
|
||||
#[rustfmt::skip]
|
||||
|
@ -2546,7 +2546,7 @@ mod tests {
|
|||
env: Permissions::new_env(&None, true),
|
||||
run: Permissions::new_run(&None, true),
|
||||
ffi: Permissions::new_ffi(&None, true),
|
||||
hrtime: Permissions::new_hrtime(false, true),
|
||||
hrtime: Permissions::new_hrtime(false),
|
||||
};
|
||||
|
||||
let prompt_value = PERMISSION_PROMPT_STUB_VALUE_SETTER.lock();
|
||||
|
@ -2584,10 +2584,7 @@ mod tests {
|
|||
assert!(perms.env.check("HOME").is_ok());
|
||||
assert!(perms.env.check("PATH").is_err());
|
||||
|
||||
prompt_value.set(true);
|
||||
assert!(perms.hrtime.check().is_ok());
|
||||
prompt_value.set(false);
|
||||
assert!(perms.hrtime.check().is_ok());
|
||||
assert!(perms.hrtime.check().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2599,7 +2596,7 @@ mod tests {
|
|||
env: Permissions::new_env(&None, true),
|
||||
run: Permissions::new_run(&None, true),
|
||||
ffi: Permissions::new_ffi(&None, true),
|
||||
hrtime: Permissions::new_hrtime(false, true),
|
||||
hrtime: Permissions::new_hrtime(false),
|
||||
};
|
||||
|
||||
let prompt_value = PERMISSION_PROMPT_STUB_VALUE_SETTER.lock();
|
||||
|
@ -2817,7 +2814,7 @@ mod tests {
|
|||
fn test_create_child_permissions() {
|
||||
let mut main_perms = Permissions {
|
||||
env: Permissions::new_env(&Some(vec![]), false),
|
||||
hrtime: Permissions::new_hrtime(true, false),
|
||||
hrtime: Permissions::new_hrtime(true),
|
||||
net: Permissions::new_net(&Some(svec!["foo", "bar"]), false),
|
||||
..Default::default()
|
||||
};
|
||||
|
@ -2876,7 +2873,6 @@ mod tests {
|
|||
let worker_perms = create_child_permissions(
|
||||
&mut main_perms,
|
||||
ChildPermissionsArg {
|
||||
hrtime: ChildUnitPermissionArg::Granted,
|
||||
read: ChildUnaryPermissionArg::Granted,
|
||||
run: ChildUnaryPermissionArg::GrantedList(svec!["foo", "bar"]),
|
||||
..Default::default()
|
||||
|
|
Loading…
Reference in a new issue