diff options
| author | mrmr1993 | 2017-05-01 00:15:51 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2017-05-01 00:15:51 +0100 | 
| commit | 9a1b56a899575d71e07eb3466e5fbf16d5a18571 (patch) | |
| tree | 53cbbfa95ca8acf69f6c5c80737ec4803b76d659 /tests | |
| parent | c3b16da8391f4c37c79611f79f0ecadaa7b3b300 (diff) | |
| download | vimium-9a1b56a899575d71e07eb3466e5fbf16d5a18571.tar.bz2 | |
FF - Fix updates from the exclusions popup
This stops |Exclusions| from holding a reference to the |value|
parameter passed to |Settings.set|. In Firefox, this object is garbage
collected when the owning context (the exclusions popup) is closed.
The fix for all such cases in the future is to switch to using
|Settings.get|, which implicitly does |JSON.parse JSON.stringify value|
and thus returns an object in the same context as |Settings|.
We could fix this generally by doing this for the
|Settings.performPostUpdateHook| call in |Settings.set| instead.
However, I'm not convinced that it warrants the overhead of a
|JSON.parse| for every |Settings.set| call.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/exclusion_test.coffee | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/tests/unit_tests/exclusion_test.coffee b/tests/unit_tests/exclusion_test.coffee index f53d23f6..06e0a51f 100644 --- a/tests/unit_tests/exclusion_test.coffee +++ b/tests/unit_tests/exclusion_test.coffee @@ -29,7 +29,7 @@ isEnabledForUrl = (request) ->  context "Excluded URLs and pass keys",    setup -> -    Exclusions.postUpdateHook( +    Settings.set "exclusionRules",        [          { pattern: "http*://mail.google.com/*", passKeys: "" }          { pattern: "http*://www.facebook.com/*", passKeys: "abab" } @@ -39,7 +39,8 @@ context "Excluded URLs and pass keys",          { pattern: "http*://www.example.com/*", passKeys: "a bb c bba a" }          { pattern: "http*://www.duplicate.com/*", passKeys: "ace" }          { pattern: "http*://www.duplicate.com/*", passKeys: "bdf" } -      ]) +      ] +    Exclusions.postUpdateHook()    should "be disabled for excluded sites", ->      rule = isEnabledForUrl({ url: 'http://mail.google.com/calendar/page' }) | 
