diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-09-09 17:47:51 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-09-09 18:50:58 +0200 |
commit | 44e89d8ec71b441a431c848567f34b9a36f6b982 (patch) | |
tree | 62881ff7fc0084bdb8a7c29c10e270a9a3b1245d /background/stream_filter.js | |
parent | e2d26bad35bbe3876862b482f7963d713238313b (diff) | |
download | browser-extension-44e89d8ec71b441a431c848567f34b9a36f6b982.tar.gz browser-extension-44e89d8ec71b441a431c848567f34b9a36f6b982.zip |
simplify CSP handling
All page's CSP rules are now removed when a payload is to be injected. When there is no payload, CSP rules are not modified but only supplemented with Hachette's own.
Diffstat (limited to 'background/stream_filter.js')
-rw-r--r-- | background/stream_filter.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/background/stream_filter.js b/background/stream_filter.js index 96b6132..3e30a4b 100644 --- a/background/stream_filter.js +++ b/background/stream_filter.js @@ -12,7 +12,7 @@ /* * IMPORTS_START * IMPORT browser - * IMPORT is_csp_header_name + * IMPORT csp_header_regex * IMPORTS_END */ @@ -116,8 +116,7 @@ function may_define_csp_rules(html) const doc = new DOMParser().parseFromString(html, "text/html"); for (const meta of doc.querySelectorAll("head>meta[http-equiv]")) { - if (is_csp_header_name(meta.getAttribute("http-equiv"), true) && - meta.content) + if (csp_header_regex.test(meta.httpEquiv) && meta.content) return true; } |