Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/notification.js

Issue 29329604: Issue 3254 - Anti-adblock warning should not show when Adblock Plus is disabled (Closed)
Patch Set: Fixed parameter Created Nov. 2, 2015, 2:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
{
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld