From 194f23f4d8a874505a5959671dac8a1b9d2c0704 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 21 Feb 2022 09:51:17 +0100 Subject: inject scripts to pages utilizing blob: URLs --- content/content.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'content') 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(); -- cgit v1.2.3