aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-21 09:51:17 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-21 09:51:17 +0100
commit194f23f4d8a874505a5959671dac8a1b9d2c0704 (patch)
tree0778bcdd0353d1f2137653a2d27ce282b90540b8
parent8477d0cf5f2f2526bb3858ca7da26bffd8e98635 (diff)
downloadbrowser-extension-194f23f4d8a874505a5959671dac8a1b9d2c0704.tar.gz
browser-extension-194f23f4d8a874505a5959671dac8a1b9d2c0704.zip
inject scripts to pages utilizing blob: URLs
-rw-r--r--content/content.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/content/content.js b/content/content.js
index 120b16d..7cbb523 100644
--- a/content/content.js
+++ b/content/content.js
@@ -136,7 +136,9 @@ async function main() {
const html_ns = "http://www.w3.org/1999/xhtml";
const script = document.createElementNS(html_ns, "script");
- script.innerText = script_contents;
+ const blobby_opts = {type: "text/javascript;charset=UTF-8"};
+ const blobby = new Blob([script_contents], blobby_opts);
+ script.src = URL.createObjectURL(blobby);
script.setAttribute("nonce", policy.nonce);
document.documentElement.append(script);
script.remove();