From 0d1a522a03c22749e96dab06ca7b3e8b428df701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 6 Aug 2021 21:10:04 +0200 Subject: revert: allow URL for permissions (#11600) Revert changes to "net" permissions in regards to handling URLs introduced in 15b0e61de. --- runtime/js/11_workers.js | 11 ++++++----- runtime/js/40_permissions.js | 12 ------------ 2 files changed, 6 insertions(+), 17 deletions(-) (limited to 'runtime') diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js index a0385357d..b59832635 100644 --- a/runtime/js/11_workers.js +++ b/runtime/js/11_workers.js @@ -94,9 +94,10 @@ value = ArrayPrototypeMap(value, (route) => { if (route instanceof URL) { if (permission === "net") { - route = route.host; - } - if (permission === "env") { + throw new Error( + `Expected 'string' for net permission, received 'URL'`, + ); + } else if (permission === "env") { throw new Error( `Expected 'string' for env permission, received 'URL'`, ); @@ -124,12 +125,12 @@ write = "inherit", }) { return { - env: parseArrayPermission(env, "env"), + env: parseUnitPermission(env, "env"), hrtime: parseUnitPermission(hrtime, "hrtime"), net: parseArrayPermission(net, "net"), plugin: parseUnitPermission(plugin, "plugin"), read: parseArrayPermission(read, "read"), - run: parseArrayPermission(run, "run"), + run: parseUnitPermission(run, "run"), write: parseArrayPermission(write, "write"), }; } diff --git a/runtime/js/40_permissions.js b/runtime/js/40_permissions.js index 019e65446..c84f8fde8 100644 --- a/runtime/js/40_permissions.js +++ b/runtime/js/40_permissions.js @@ -167,10 +167,6 @@ desc.path = pathFromURL(desc.path); } else if (desc.name === "run") { desc.command = pathFromURL(desc.command); - } else if (desc.name === "net") { - if (desc.host instanceof URL) { - desc.host = desc.host.host; - } } const state = opQuery(desc); @@ -190,10 +186,6 @@ desc.path = pathFromURL(desc.path); } else if (desc.name === "run") { desc.command = pathFromURL(desc.command); - } else if (desc.name === "net") { - if (desc.host instanceof URL) { - desc.host = desc.host.host; - } } const state = opRevoke(desc); @@ -213,10 +205,6 @@ desc.path = pathFromURL(desc.path); } else if (desc.name === "run") { desc.command = pathFromURL(desc.command); - } else if (desc.name === "net") { - if (desc.host instanceof URL) { - desc.host = desc.host.host; - } } const state = opRequest(desc); -- cgit v1.2.3