summaryrefslogtreecommitdiff
path: root/test/haketilo_test
diff options
context:
space:
mode:
Diffstat (limited to 'test/haketilo_test')
-rw-r--r--test/haketilo_test/unit/test_policy_enforcing.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/haketilo_test/unit/test_policy_enforcing.py b/test/haketilo_test/unit/test_policy_enforcing.py
index bbc3eb9..90a6ed9 100644
--- a/test/haketilo_test/unit/test_policy_enforcing.py
+++ b/test/haketilo_test/unit/test_policy_enforcing.py
@@ -39,7 +39,11 @@ payload_policy = {
'csp': f"prefetch-src 'none'; script-src-attr 'none'; script-src 'nonce-{nonce}'; script-src-elem 'nonce-{nonce}';"
}
-content_script = load_script('content/policy_enforcing.js') + ''';{
+def content_script():
+ return load_script('content/policy_enforcing.js') + \
+ content_script_appended_code
+
+content_script_appended_code = ''';{
const smuggled_what_to_do = /^[^#]*#?(.*)$/.exec(document.URL)[1];
const what_to_do = smuggled_what_to_do === "" ? {policy: {allow: true}} :
JSON.parse(decodeURIComponent(smuggled_what_to_do));