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

Unified Diff: lib/notification.js

Issue 29329776: Issue 3254 - Fix exception when navigating to about:addons and similar pages (Closed)
Patch Set: Created Nov. 5, 2015, 7:26 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
@@ -214,17 +214,31 @@ let Notification = exports.Notification
if (Prefs.notifications_ignoredcategories.indexOf("*") != -1)
continue;
}
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 host;
+ if (typeof URL == "function")
+ host = new URL(url).hostname;
+ else
+ {
+ try
+ {
+ host = Services.io.newURI(url, null, null).host;
+ }
+ catch (e)
+ {
+ // Ignore, an exception is excepted for about: and similar schemes
Thomas Greiner 2015/11/10 17:54:19 Detail: I suppose you meant to write "expected" he
Wladimir Palant 2015/11/11 07:49:27 Yes, I fixed that before pushing.
+ 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, host, false, null))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld