aboutsummaryrefslogtreecommitdiff
path: root/content/page_actions.js
diff options
context:
space:
mode:
authorWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-13 12:32:22 +0200
committerWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-13 12:32:22 +0200
commitc4ed1b8d44c37938aaa9b12674077274554742eb (patch)
treef51381ab7bf3bd0ec9fd9f1002081760bdd56d4a /content/page_actions.js
parent57f32a269a06ec5102b08824d251afa5456d4195 (diff)
downloadbrowser-extension-c4ed1b8d44c37938aaa9b12674077274554742eb.tar.gz
browser-extension-c4ed1b8d44c37938aaa9b12674077274554742eb.zip
utilize CSP for blocking
Diffstat (limited to 'content/page_actions.js')
-rw-r--r--content/page_actions.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/content/page_actions.js b/content/page_actions.js
index 047bf24..eee0599 100644
--- a/content/page_actions.js
+++ b/content/page_actions.js
@@ -17,6 +17,7 @@
var port;
var loaded = false;
var scripts_awaiting = [];
+ var nonce;
function handle_message(message)
{
@@ -49,14 +50,17 @@
{
let script = document.createElement("script");
script.textContent = script_text;
+ script.setAttribute("nonce", nonce);
document.body.appendChild(script);
}
- function handle_page_actions() {
+ function handle_page_actions(script_nonce) {
document.addEventListener("DOMContentLoaded", document_loaded);
port = browser.runtime.connect({name : CONNECTION_TYPE.PAGE_ACTIONS});
port.onMessage.addListener(handle_message);
port.postMessage({url: document.URL});
+
+ nonce = script_nonce;
}
window.handle_page_actions = handle_page_actions;