diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-06-30 14:12:43 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-06-30 14:13:04 +0200 |
commit | cd5272acb47a53ad71e5a6bcbcb4f712bdd285c5 (patch) | |
tree | 625f92362000c483719a8b1fb70c23979a8dba60 /background | |
parent | 261548ff184926567a623e90df7954aeef842d59 (diff) | |
download | browser-extension-cd5272acb47a53ad71e5a6bcbcb4f712bdd285c5.tar.gz browser-extension-cd5272acb47a53ad71e5a6bcbcb4f712bdd285c5.zip |
refactor 3 miscellaneous fnctionalities to a their single own file
Diffstat (limited to 'background')
-rw-r--r-- | background/policy_injector.js | 9 |
1 files changed, 3 insertions, 6 deletions
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}; |