| Index: lib/notification.js |
| =================================================================== |
| --- a/lib/notification.js |
| +++ b/lib/notification.js |
| @@ -19,18 +19,18 @@ |
| * @fileOverview Handles notifications. |
| */ |
| Cu.import("resource://gre/modules/Services.jsm"); |
| let {Prefs} = require("prefs"); |
| let {Downloader, Downloadable, MILLIS_IN_MINUTE, MILLIS_IN_HOUR, MILLIS_IN_DAY} = require("downloader"); |
| let {Utils} = require("utils"); |
| -let {Matcher} = require("matcher"); |
| -let {Filter, RegExpFilter} = require("filterClasses"); |
| +let {Matcher, defaultMatcher} = require("matcher"); |
| +let {Filter, RegExpFilter, WhitelistFilter} = require("filterClasses"); |
| let INITIAL_DELAY = 1 * MILLIS_IN_MINUTE; |
| let CHECK_INTERVAL = 1 * MILLIS_IN_HOUR; |
| let EXPIRATION_INTERVAL = 1 * MILLIS_IN_DAY; |
| let TYPE = { |
| information: 0, |
| question: 1, |
| critical: 2 |
| @@ -212,22 +212,27 @@ let Notification = exports.Notification |
| if (shown instanceof Array && shown.indexOf(notification.id) != -1) |
| continue; |
| if (Prefs.notifications_ignoredcategories.indexOf("*") != -1) |
| continue; |
| } |
| if (typeof url === "string" || notification.urlFilters instanceof Array) |
| { |
| - if (typeof url === "string" && notification.urlFilters instanceof Array) |
| + if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array) |
| { |
| + let host = (typeof URL == "function" ? new URL(url).hostname : Utils.makeURI(url).host); |
| + let exception = defaultMatcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, false, null); |
| + if (exception instanceof WhitelistFilter) |
| + continue; |
| + |
| let matcher = new Matcher(); |
| for (let urlFilter of notification.urlFilters) |
| matcher.add(Filter.fromText(urlFilter)); |
| - if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, url)) |
| + if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, false, null)) |
| continue; |
| } |
| else |
| continue; |
| } |
| if (notification.targets instanceof Array) |
| { |