diff options
Diffstat (limited to 'content/content.js')
-rw-r--r-- | content/content.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/content/content.js b/content/content.js index c492d53..998ff49 100644 --- a/content/content.js +++ b/content/content.js @@ -143,12 +143,17 @@ async function main() { for (const script_contents of scripts) { const html_ns = "http://www.w3.org/1999/xhtml"; const script = document.createElementNS(html_ns, "script"); + const load_prom = new Promise( + (...cbs) => [script.onload, script.onerror] = cbs + ); 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); + await load_prom; script.remove(); } } |