From b5d0bc23d310f5dfead132086a5b223ef413d066 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 14 Dec 2014 06:31:46 +0000 Subject: Wrap RegExp for exclusions in a try catch to prevent parse error fails --- background_scripts/exclusions.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'background_scripts') diff --git a/background_scripts/exclusions.coffee b/background_scripts/exclusions.coffee index 3a8ef1e7..cf7fbbb3 100644 --- a/background_scripts/exclusions.coffee +++ b/background_scripts/exclusions.coffee @@ -6,7 +6,11 @@ RegexpCache = if regexp = @cache[pattern] regexp else - @cache[pattern] = new RegExp("^" + pattern.replace(/\*/g, ".*") + "$") + @cache[pattern] = + try + new RegExp("^" + pattern.replace(/\*/g, ".*") + "$") + catch + /^$/ # Match the empty string. # The Exclusions class manages the exclusion rule setting. # An exclusion is an object with two attributes: pattern and passKeys. -- cgit v1.2.3