summaryrefslogtreecommitdiff
path: root/src/content/content.js
diff options
context:
space:
mode:
authorhackademix2018-09-04 19:48:07 +0200
committerhackademix2018-09-04 19:48:07 +0200
commit1814bfa03d090e7f0de7c68124c83fa3adacbfa5 (patch)
tree93c2ec4320638596427ce82c4f7b2088e94f8c35 /src/content/content.js
parent26470b84f681b7db9e500bb4503eab7b8b202879 (diff)
downloadnoscript-1814bfa03d090e7f0de7c68124c83fa3adacbfa5.tar.gz
noscript-1814bfa03d090e7f0de7c68124c83fa3adacbfa5.tar.xz
noscript-1814bfa03d090e7f0de7c68124c83fa3adacbfa5.zip
Work-around for CSP not being honored when the HEAD element has not been inserted yet.
Diffstat (limited to 'src/content/content.js')
-rw-r--r--src/content/content.js14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/content/content.js b/src/content/content.js
index fb68ae4..302ee8a 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -83,19 +83,7 @@ ns.on("capabilities", () => {
});
if (!ns.canScript) {
- addEventListener("beforescriptexecute", e => e.preventDefault());
- let mo = new MutationObserver(mutations => {
- for (let m of mutations) {
- console.log(`Mutation `, m);
- if (m.type !== "attribute") continue;
- if (/^on\w+/i.test(m.attributeName)) {
- m.target.removeAttribute(m.attributeName);
- } else if (/^\s*(javascript|data):/i.test(m.target.attributes[m.attributeName])) {
- m.target.setAttribute(m.attributeName, "#");
- }
- }
- });
- // mo.observe(document.documentElement, {attributes: true, subtree: true});
+
if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
(async () => {
for (let r of await navigator.serviceWorker.getRegistrations()) {