summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-03-04 17:21:01 +0100
committerWojtek Kosior <koszko@koszko.org>2022-03-04 17:25:17 +0100
commit33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa (patch)
tree973ad2ffefaa9f365e19c10c192377de3bc7748f
parentb43acfe39681f1a0a143e64231856a09a72f8a60 (diff)
downloadbrowser-extension-33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa.tar.gz
browser-extension-33b6872c33ec2a68ac5abda6eb0de23fc9d9fdaa.zip
for () loop styling
-rw-r--r--content/policy_enforcing.js8
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