diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-01-15 12:35:47 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-01-15 12:35:47 +0100 |
commit | 07a883feeeea63cc23fb5100a0618f29b0a5da9f (patch) | |
tree | 87569023aee35929308381344221f68566adc2ac /common | |
parent | e7d11c7c1173d07db741301053db78b835a73ab3 (diff) | |
download | browser-extension-07a883feeeea63cc23fb5100a0618f29b0a5da9f.tar.gz browser-extension-07a883feeeea63cc23fb5100a0618f29b0a5da9f.zip |
make blocking rules queryable in pattern tree just as mappings are
Diffstat (limited to 'common')
-rw-r--r-- | common/policy.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/policy.js b/common/policy.js index 0ac71d6..7ab9b5d 100644 --- a/common/policy.js +++ b/common/policy.js @@ -70,10 +70,15 @@ function decide_policy(patterns_tree, url, default_allow, secret) } if (payloads !== undefined) { + /* + * mapping will be either the actual mapping identifier or "~allow" if + * we matched a simple script block/allow rule. + */ policy.mapping = Object.keys(payloads).sort()[0]; const payload = payloads[policy.mapping]; - if (payload.allow !== undefined) { - policy.allow = payload.allow; + if (policy.mapping === "~allow") { + /* Convert 0/1 back to false/true. */ + policy.allow = !!payload; } else /* if (payload.identifier) */ { policy.allow = false; policy.payload = payload; |