From cd5272acb47a53ad71e5a6bcbcb4f712bdd285c5 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 30 Jun 2021 14:12:43 +0200 Subject: refactor 3 miscellaneous fnctionalities to a their single own file --- background/policy_injector.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'background/policy_injector.js') diff --git a/background/policy_injector.js b/background/policy_injector.js index f05a422..4f70aac 100644 --- a/background/policy_injector.js +++ b/background/policy_injector.js @@ -14,6 +14,7 @@ * IMPORT gen_unique * IMPORT url_item * IMPORT get_query_best + * IMPORT csp_rule * IMPORTS_END */ @@ -40,16 +41,12 @@ function inject(details) if (settings !== undefined && settings.allow) return {cancel : false}; - let nonce = gen_unique(url).substring(1); + let nonce = gen_unique(url); let headers = details.responseHeaders.filter(is_noncsp_header); - let rule = `script-src 'nonce-${nonce}';`; - if (is_chrome) - rule += `script-src-elem 'nonce-${nonce}';`; - headers.push({ name : "content-security-policy", - value : rule + value : csp_rule(nonce) }); return {responseHeaders: headers}; -- cgit v1.2.3