aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/exclusions.coffee
diff options
context:
space:
mode:
authorStephen Blott2017-05-01 07:01:18 +0100
committerGitHub2017-05-01 07:01:18 +0100
commit8a74fd31f3086538cfad50df30e0e2c87cd0a6cc (patch)
tree53cbbfa95ca8acf69f6c5c80737ec4803b76d659 /background_scripts/exclusions.coffee
parentc3b16da8391f4c37c79611f79f0ecadaa7b3b300 (diff)
parent9a1b56a899575d71e07eb3466e5fbf16d5a18571 (diff)
downloadvimium-8a74fd31f3086538cfad50df30e0e2c87cd0a6cc.tar.bz2
Merge pull request #2500 from mrmr1993/ff-fix-exclusions
FF - Fix "Save Changes" from the exclusions popup
Diffstat (limited to 'background_scripts/exclusions.coffee')
-rw-r--r--background_scripts/exclusions.coffee9
1 files changed, 6 insertions, 3 deletions
diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee
index 42d3b872..fec66f4c 100644
--- a/background_scripts/exclusions.coffee
+++ b/background_scripts/exclusions.coffee
@@ -20,12 +20,12 @@ Exclusions =
# Make RegexpCache, which is required on the page popup, accessible via the Exclusions object.
RegexpCache: RegexpCache
- rules: Settings.get("exclusionRules")
+ rules: Settings.get "exclusionRules"
# Merge the matching rules for URL, or null. In the normal case, we use the configured @rules; hence, this
# is the default. However, when called from the page popup, we are testing what effect candidate new rules
# would have on the current tab. In this case, the candidate rules are provided by the caller.
- getRule: (url, rules=@rules) ->
+ getRule: (url, rules = @rules) ->
matchingRules = (rule for rule in rules when rule.pattern and 0 <= url.search RegexpCache.get rule.pattern)
# An absolute exclusion rule (one with no passKeys) takes priority.
for rule in matchingRules
@@ -47,7 +47,10 @@ Exclusions =
@rules = rules.filter (rule) -> rule and rule.pattern
Settings.set "exclusionRules", @rules
- postUpdateHook: (@rules) ->
+ postUpdateHook: (rules) ->
+ # NOTE(mrmr1993): In FF, the |rules| argument will be garbage collected when the exclusions popup is
+ # closed. Do NOT store it/use it asynchronously.
+ @rules = Settings.get "exclusionRules"
RegexpCache.clear()
# Register postUpdateHook for exclusionRules setting.