From 9a1b56a899575d71e07eb3466e5fbf16d5a18571 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Mon, 1 May 2017 00:15:51 +0100 Subject: 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. --- tests/unit_tests/exclusion_test.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') 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' }) -- cgit v1.2.3