Index: subscriptionLink.postload.js |
diff --git a/subscriptionLink.postload.js b/subscriptionLink.postload.js |
index 7212d635eae05f1a2c6746a03c50209da7b79310..c99cd1416980af4da48fa295b2acea107e5cf252 100644 |
--- a/subscriptionLink.postload.js |
+++ b/subscriptionLink.postload.js |
@@ -43,20 +43,32 @@ if ("ext" in window && document instanceof HTMLDocument) |
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 |
+ { |
+ // Old versions of Chrome (30) don't 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]; |
} |
- else if (!/^abp:\/*subscribe\/*\?/i.test(link.href)) |
+ |
+ if (!queryString) |
return; |
// This is our link - make sure the browser doesn't handle it |
event.preventDefault(); |
event.stopPropagation(); |
- // Decode URL parameters |
- var params = link.search.substr(1).split("&"); |
+ // Decode URL parameters (Note: Old versions of Chrome (30) don't populate |
Sebastian Noack
2016/05/24 12:48:06
Nit: That comment, or at least the part you added,
kzar
2016/05/24 12:59:40
Whoops missed that, Done.
|
+ // link.search here so we have to grab the search part of the URL manually.) |
+ var params = queryString.split("&"); |
var title = null; |
var url = null; |
for (var i = 0; i < params.length; i++) |