summaryrefslogtreecommitdiff
path: root/src/content/staticNS.js
diff options
context:
space:
mode:
authorhackademix2018-09-10 19:10:32 +0200
committerhackademix2018-09-10 19:10:32 +0200
commit48053d96d44abbfa3c659e5fc817d998dda2bb35 (patch)
treee7c8b36edf2db7544c5e8fd543f6e28579e315a8 /src/content/staticNS.js
parent2b45fcb9a42c0acb2f5a88338c67244ae6c4fb8f (diff)
downloadnoscript-48053d96d44abbfa3c659e5fc817d998dda2bb35.tar.gz
noscript-48053d96d44abbfa3c659e5fc817d998dda2bb35.tar.xz
noscript-48053d96d44abbfa3c659e5fc817d998dda2bb35.zip
Better IPV6 support.
Diffstat (limited to 'src/content/staticNS.js')
-rw-r--r--src/content/staticNS.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/content/staticNS.js b/src/content/staticNS.js
index 6179da0..4e192b8 100644
--- a/src/content/staticNS.js
+++ b/src/content/staticNS.js
@@ -33,7 +33,17 @@
backlog.add(eventName);
},
- setup(permissions, MARKER) {
+ async fetchPolicy() {
+ let policy = await Messages.send("fetchChildPolicy", {url: document.URL});
+ if (!policy) {
+ debug(`No answer to fetchChildPolicy message. This should not be happening.`);
+ return false;
+ }
+ this.setup(policy.permissions, policy.MARKER, true);
+ return true;
+ },
+
+ setup(permissions, MARKER, fetched = false) {
this.config.permissions = permissions;
// ugly hack: since now we use registerContentScript instead of the
@@ -75,6 +85,15 @@
this.capabilities = Object.assign(
new Set(["script"]), { has() { return true; } });
} else {
+ if (!fetched) {
+ let hostname = window.location.hostname;
+ if (hostname && hostname.startsWith("[")) {
+ // WebExt match patterns don't seem to support IPV6 (Firefox 63)...
+ debug("Ignoring child policy setup parameters for IPV6 address %s, forcing IPC...", hostname);
+ this.fetchPolicy();
+ return;
+ }
+ }
let perms = this.config.permissions;
this.capabilities = new Set(perms.capabilities);
new DocumentCSP(document).apply(this.capabilities, this.embeddingDocument);