diff options
| -rw-r--r-- | background_scripts/exclusions.coffee | 1 | ||||
| -rw-r--r-- | tests/unit_tests/exclusion_test.coffee | 5 | ||||
| -rw-r--r-- | tests/unit_tests/test_chrome_stubs.coffee | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee index 10450670..42d3b872 100644 --- a/background_scripts/exclusions.coffee +++ b/background_scripts/exclusions.coffee @@ -10,6 +10,7 @@ RegexpCache = try new RegExp("^" + pattern.replace(/\*/g, ".*") + "$") catch + BgUtils.log "bad regexp in exclusion rule: #{pattern}" /^$/ # Match the empty string. # The Exclusions class manages the exclusion rule setting. An exclusion is an object with two attributes: diff --git a/tests/unit_tests/exclusion_test.coffee b/tests/unit_tests/exclusion_test.coffee index 54cb4ed3..f53d23f6 100644 --- a/tests/unit_tests/exclusion_test.coffee +++ b/tests/unit_tests/exclusion_test.coffee @@ -16,6 +16,7 @@ extend(global, require "../../lib/utils.js") Utils.getCurrentVersion = -> '1.44' extend(global,require "../../lib/settings.js") extend(global,require "../../lib/clipboard.js") +extend(global, require "../../background_scripts/bg_utils.js") extend(global, require "../../background_scripts/exclusions.js") extend(global, require "../../background_scripts/commands.js") extend(global, require "../../background_scripts/main.js") @@ -70,3 +71,7 @@ context "Excluded URLs and pass keys", assert.isTrue rule.isEnabledForUrl assert.equal "abcdef", rule.passKeys + should "be enabled for malformed regular expressions", -> + Exclusions.postUpdateHook [ { pattern: "http*://www.bad-regexp.com/*[a-", passKeys: "" } ] + rule = isEnabledForUrl({ url: 'http://www.bad-regexp.com/pages' }) + assert.isTrue rule.isEnabledForUrl diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee index bbcd01e7..b0b527c5 100644 --- a/tests/unit_tests/test_chrome_stubs.coffee +++ b/tests/unit_tests/test_chrome_stubs.coffee @@ -30,6 +30,7 @@ exports.chrome = extension: getURL: (path) -> path getBackgroundPage: -> {} + getViews: -> [] tabs: onSelectionChanged: |
