diff options
author | JustOff <Off.Just.Off@gmail.com> | 2020-10-23 20:01:06 +0300 |
---|---|---|
committer | JustOff <Off.Just.Off@gmail.com> | 2020-10-23 20:01:06 +0300 |
commit | 07979516421ea5dc5f9a108bcca7d331cab8fea1 (patch) | |
tree | ca3612f1fa81ff94904ecea6eceb0de080c40752 | |
parent | d2e206780fb2a52bc5ac534097da2765ff356dda (diff) | |
download | github-wc-polyfill-07979516421ea5dc5f9a108bcca7d331cab8fea1.tar.gz |
Code cleanup
-rw-r--r-- | bootstrap.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/bootstrap.js b/bootstrap.js index bee1312..b456478 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -46,19 +46,18 @@ var httpObserver = { try { if (subject.responseStatus == 200 && (subject.loadInfo.externalContentPolicyType == Ci.nsIContentPolicy.TYPE_DOCUMENT || - subject.loadInfo.externalContentPolicyType == Ci.nsIContentPolicy.TYPE_SUBDOCUMENT)) { - if (subject.getResponseHeader("Content-Type").indexOf("text/html") != -1) { - let csp = subject.getResponseHeader("Content-Security-Policy"); - csp = csp.replace("script-src ", "script-src " + hashQueueMicrotask + " "); - if (isSeaMonkey) { - csp = csp.replace("script-src ", "script-src github.com " + hashToggleAttribute + " "); - csp = csp.replace("default-src 'none'", "default-src github.com/socket-worker.js gist.github.com/socket-worker.js"); - } - subject.setResponseHeader("Content-Security-Policy", csp, false); - subject.QueryInterface(Ci.nsITraceableChannel); - let newListener = new tracingListener(); - newListener.originalListener = subject.setNewListener(newListener); + subject.loadInfo.externalContentPolicyType == Ci.nsIContentPolicy.TYPE_SUBDOCUMENT) && + subject.getResponseHeader("Content-Type").indexOf("text/html") != -1) { + let csp = subject.getResponseHeader("Content-Security-Policy"); + csp = csp.replace("script-src ", "script-src " + hashQueueMicrotask + " "); + if (isSeaMonkey) { + csp = csp.replace("script-src ", "script-src github.com gist.github.com " + hashToggleAttribute + " "); + csp = csp.replace("default-src 'none'", "default-src github.com/socket-worker.js gist.github.com/socket-worker.js"); } + subject.setResponseHeader("Content-Security-Policy", csp, false); + subject.QueryInterface(Ci.nsITraceableChannel); + let newListener = new tracingListener(); + newListener.originalListener = subject.setNewListener(newListener); } else if (subject.URI.path == "/socket-worker.js") { let csp = subject.getResponseHeader("Content-Security-Policy"); csp = csp.replace("worker-src ", "worker-src github.githubassets.com "); |