summaryrefslogtreecommitdiff
path: root/runtime/js/10_permissions.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-04-16 14:09:07 +0200
committerGitHub <noreply@github.com>2022-04-16 14:09:07 +0200
commit0bb96cde726127291dccb62145e76a50b2efcd2f (patch)
treee18e2512369c5c1393c2e45efef594e1e8ca4af5 /runtime/js/10_permissions.js
parent8b31fc23cd80de9baa62535e95367da7a21c9cfd (diff)
refactor: update runtime code for primordial check x in y (#13642)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'runtime/js/10_permissions.js')
-rw-r--r--runtime/js/10_permissions.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/js/10_permissions.js b/runtime/js/10_permissions.js
index f3498b950..1a9be1f27 100644
--- a/runtime/js/10_permissions.js
+++ b/runtime/js/10_permissions.js
@@ -21,6 +21,7 @@
FunctionPrototypeCall,
PromiseResolve,
PromiseReject,
+ ReflectHas,
SymbolFor,
TypeError,
} = window.__bootstrap.primordials;
@@ -120,7 +121,10 @@
*/
function cache(desc, state) {
let { name: key } = desc;
- if ((desc.name === "read" || desc.name === "write") && "path" in desc) {
+ if (
+ (desc.name === "read" || desc.name === "write") &&
+ ReflectHas(desc, "path")
+ ) {
key += `-${desc.path}`;
} else if (desc.name === "net" && desc.host) {
key += `-${desc.host}`;