mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(runtime): fix permission status cache keys (#15899)
This commit is contained in:
parent
ee208c1b20
commit
38280990da
2 changed files with 17 additions and 3 deletions
|
@ -86,3 +86,11 @@ Deno.test(async function permissionDescriptorValidation() {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Regression test for https://github.com/denoland/deno/issues/15894.
|
||||
Deno.test(async function permissionStatusObjectsNotEqual() {
|
||||
assert(
|
||||
await Deno.permissions.query({ name: "env", variable: "A" }) !=
|
||||
await Deno.permissions.query({ name: "env", variable: "B" }),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -122,12 +122,18 @@
|
|||
function cache(desc, state) {
|
||||
let { name: key } = desc;
|
||||
if (
|
||||
(desc.name === "read" || desc.name === "write") &&
|
||||
(desc.name === "read" || desc.name === "write" || desc.name === "ffi") &&
|
||||
ReflectHas(desc, "path")
|
||||
) {
|
||||
key += `-${desc.path}`;
|
||||
key += `-${desc.path}&`;
|
||||
} else if (desc.name === "net" && desc.host) {
|
||||
key += `-${desc.host}`;
|
||||
key += `-${desc.host}&`;
|
||||
} else if (desc.name === "run" && desc.command) {
|
||||
key += `-${desc.command}&`;
|
||||
} else if (desc.name === "env" && desc.variable) {
|
||||
key += `-${desc.variable}&`;
|
||||
} else {
|
||||
key += "$";
|
||||
}
|
||||
if (MapPrototypeHas(statusCache, key)) {
|
||||
const status = MapPrototypeGet(statusCache, key);
|
||||
|
|
Loading…
Reference in a new issue