diff options
author | Leo K <crowlkats@toaxl.com> | 2021-08-06 15:04:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 15:04:00 +0200 |
commit | 15b0e61de523c1a0157e754379f0ec7decf0c23e (patch) | |
tree | 4d3aed3e1b80dbe38e70dad363c64532656c7e5a /runtime/js/11_workers.js | |
parent | b6b71c3d590722117db04fda7362d3b23245c3c3 (diff) |
feat(runtime): allow URL for permissions (#11578)
Diffstat (limited to 'runtime/js/11_workers.js')
-rw-r--r-- | runtime/js/11_workers.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js index 602046a14..a0385357d 100644 --- a/runtime/js/11_workers.js +++ b/runtime/js/11_workers.js @@ -93,7 +93,16 @@ } else if (ArrayIsArray(value)) { value = ArrayPrototypeMap(value, (route) => { if (route instanceof URL) { - route = pathFromURL(route); + if (permission === "net") { + route = route.host; + } + if (permission === "env") { + throw new Error( + `Expected 'string' for env permission, received 'URL'`, + ); + } else { + route = pathFromURL(route); + } } return route; }); @@ -115,12 +124,12 @@ write = "inherit", }) { return { - env: parseUnitPermission(env, "env"), + env: parseArrayPermission(env, "env"), hrtime: parseUnitPermission(hrtime, "hrtime"), net: parseArrayPermission(net, "net"), plugin: parseUnitPermission(plugin, "plugin"), read: parseArrayPermission(read, "read"), - run: parseUnitPermission(run, "run"), + run: parseArrayPermission(run, "run"), write: parseArrayPermission(write, "write"), }; } |