diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-03-04 17:21:01 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-03-04 17:25:17 +0100 |
commit | 33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa (patch) | |
tree | 973ad2ffefaa9f365e19c10c192377de3bc7748f /content | |
parent | b43acfe39681f1a0a143e64231856a09a72f8a60 (diff) | |
download | browser-extension-33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa.tar.gz browser-extension-33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa.zip |
for () loop styling
Diffstat (limited to 'content')
-rw-r--r-- | content/policy_enforcing.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content/policy_enforcing.js b/content/policy_enforcing.js index f6f4081..0bbe3c6 100644 --- a/content/policy_enforcing.js +++ b/content/policy_enforcing.js @@ -174,9 +174,11 @@ function sanitize_element_urls(element) { let some_attr_blocked = false; - for (const attr of [...element.attributes || []] - .filter(attr => /^(href|src|data)$/i.test(attr.localName)) - .filter(attr => bad_url_reg.test(attr.value))) { + const bad_attrs = [...(element.attributes || [])] + .filter(attr => /^(href|src|data)$/i.test(attr.localName)) + .filter(attr => bad_url_reg.test(attr.value)); + + for (const attr of bad_attrs) { /* * Under some browsers (Mozilla) removing attributes doesn't stop their * javascript from executing, but replacing them does. For 'src' and |