Index: subscriptionLink.postload.js |
=================================================================== |
--- a/subscriptionLink.postload.js |
+++ b/subscriptionLink.postload.js |
@@ -1,6 +1,6 @@ |
/* |
* This file is part of Adblock Plus <https://adblockplus.org/>, |
- * Copyright (C) 2006-2016 Eyeo GmbH |
+ * Copyright (C) 2006-2017 eyeo GmbH |
* |
* Adblock Plus is free software: you can redistribute it and/or modify |
* it under the terms of the GNU General Public License version 3 as |
@@ -39,12 +39,23 @@ |
return; |
} |
+ let queryString = null; |
if (link.protocol == "http:" || link.protocol == "https:") |
{ |
- if (link.host != "subscribe.adblockplus.org" || link.pathname != "/") |
- return; |
+ if (link.host == "subscribe.adblockplus.org" && link.pathname == "/") |
+ queryString = link.search.substr(1); |
} |
- else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) |
+ else |
+ { |
+ // Firefox 51 doesn't seem to populate the "search" property for |
+ // links with non-standard URL schemes so we need to extract the query |
+ // string manually. |
+ let match = /^abp:\/*subscribe\/*\?(.*)/i.exec(link.href); |
+ if (match) |
+ queryString = match[1]; |
+ } |
+ |
+ if (!queryString) |
return; |
// This is our link - make sure the browser doesn't handle it |
@@ -54,7 +65,7 @@ |
// Decode URL parameters |
let title = null; |
let url = null; |
- for (let param of link.search.substr(1).split("&")) |
+ for (let param of queryString.split("&")) |
{ |
let parts = param.split("=", 2); |
if (parts.length != 2 || !/\S/.test(parts[1])) |
@@ -84,8 +95,8 @@ |
ext.backgroundPage.sendMessage({ |
type: "subscriptions.add", |
- title: title, |
- url: url, |
+ title, |
+ url, |
confirm: true |
}); |
}, true); |