diff options
author | hackademix | 2018-09-08 11:50:40 +0200 |
---|---|---|
committer | hackademix | 2018-09-08 11:50:40 +0200 |
commit | 7514aa20f959cd997e328cf8d15121d602a5c4fc (patch) | |
tree | 68e23c72ca9086b0f45b36a339dfb875a2cf65fe /src/lib/restricted.js | |
parent | 9edcf2f1f7f38c7cc933f467545a330391f70fbe (diff) | |
download | noscript-7514aa20f959cd997e328cf8d15121d602a5c4fc.tar.gz noscript-7514aa20f959cd997e328cf8d15121d602a5c4fc.tar.xz noscript-7514aa20f959cd997e328cf8d15121d602a5c4fc.zip |
Saner message dispatching.
Diffstat (limited to 'src/lib/restricted.js')
-rw-r--r-- | src/lib/restricted.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/restricted.js b/src/lib/restricted.js index 6415221..b9bddae 100644 --- a/src/lib/restricted.js +++ b/src/lib/restricted.js @@ -21,7 +21,9 @@ function isRestrictedURL(u) { try { if (typeof u === "string") u = new URL(u); - return u.protocol === "https:" && domains.includes(tld.normalize(u.hostname || "")); + let {protocol, hostname} = u; + return (!/^(?:https?|file|data):$/.test(protocol)) + || protocol === "https:" && hostname && domains.includes(tld.normalize(hostname)); } catch (e) { return false; } |