[Pkg-mozext-commits] [adblock-plus] 59/87: Noissue - Removed redundant URL compatibility logic
David Prévot
taffit at moszumanska.debian.org
Sat Apr 30 17:59:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 985dac02fe421d97fc588a6657f1a57a985261ae
Author: Sebastian Noack <sebastian at adblockplus.org>
Date: Mon Apr 4 13:16:50 2016 +0200
Noissue - Removed redundant URL compatibility logic
https://codereview.adblockplus.org/29339343
---
lib/notification.js | 17 ++++++-----------
lib/synchronizer.js | 15 ++++++++++++---
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/lib/notification.js b/lib/notification.js
index 0531ef1..51ed509 100644
--- a/lib/notification.js
+++ b/lib/notification.js
@@ -220,20 +220,15 @@ var Notification = exports.Notification =
if (Prefs.enabled && typeof url === "string" && notification.urlFilters instanceof Array)
{
let host;
- if (typeof URL == "function")
+ try
+ {
host = new URL(url).hostname;
- else
+ }
+ catch (e)
{
- try
- {
- host = Services.io.newURI(url, null, null).host;
- }
- catch (e)
- {
- // Ignore, an exception is expected for about: and similar schemes
- host = "";
- }
+ host = "";
}
+
let exception = defaultMatcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, host, false, null);
if (exception instanceof WhitelistFilter)
continue;
diff --git a/lib/synchronizer.js b/lib/synchronizer.js
index 1abb6f1..a9abb52 100644
--- a/lib/synchronizer.js
+++ b/lib/synchronizer.js
@@ -206,9 +206,18 @@ var Synchronizer = exports.Synchronizer =
// Process parameters
if (params.homepage)
{
- let uri = Utils.makeURI(params.homepage);
- if (uri && (uri.scheme == "http" || uri.scheme == "https"))
- subscription.homepage = uri.spec;
+ let url;
+ try
+ {
+ url = new URL(params.homepage);
+ }
+ catch (e)
+ {
+ url = null;
+ }
+
+ if (url && (url.protocol == "http" || url.protocol == "https"))
+ subscription.homepage = url.href;
}
if (params.title)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list