diff options
author | JustOff <Off.Just.Off@gmail.com> | 2021-07-24 19:56:54 +0300 |
---|---|---|
committer | JustOff <Off.Just.Off@gmail.com> | 2021-07-24 19:56:54 +0300 |
commit | 2c2c566ac87d28414381f273b7367a52583bc178 (patch) | |
tree | 51ae01bfeb8b73523f578b37f232ea7ae21a96a1 | |
parent | 20f137d84bde4a9dcdf0ffe3808815e0e74178f0 (diff) | |
download | github-wc-polyfill-2c2c566ac87d28414381f273b7367a52583bc178.tar.gz |
Improve compatibility with uBlock Origin
This resolves #26.
-rw-r--r-- | bootstrap.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bootstrap.js b/bootstrap.js index f3f2c90..715e42a 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -196,12 +196,12 @@ var httpObserver = { try { let csp = subject.getResponseHeader("Content-Security-Policy"); if (gitlab.test(subject.URI.host)) { - csp = csp.replace("script-src ", "script-src " + hashCElements + " "); + csp = csp.replace(/script-src /g, "script-src " + hashCElements + " "); } else { - csp = csp.replace("script-src ", "script-src " + hashBase + " "); + csp = csp.replace(/script-src /g, "script-src " + hashBase + " "); if (isSeaMonkey) { - csp = csp.replace("script-src ", "script-src github.com gist.github.com " + hashSeaMonkey + " "); - csp = csp.replace("default-src 'none'", "default-src github.com gist.github.com"); + csp = csp.replace(/script-src /g, "script-src github.com gist.github.com " + hashSeaMonkey + " "); + csp = csp.replace(/default-src 'none'/g, "default-src github.com gist.github.com"); } } subject.setResponseHeader("Content-Security-Policy", csp, false); @@ -216,7 +216,7 @@ var httpObserver = { newListener.originalListener = subject.setNewListener(newListener); } else if (subject.URI.path.indexOf("/socket-worker-") == 0) { let csp = subject.getResponseHeader("Content-Security-Policy"); - csp = csp.replace("worker-src ", "worker-src github.githubassets.com "); + csp = csp.replace(/worker-src /g, "worker-src github.githubassets.com "); subject.setResponseHeader("Content-Security-Policy", csp, false); } } catch (e) {} |