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

Unified Diff: subscriptionLink.postload.js

Issue 29452181: Noissue - Merge current tip to Edge bookmark (Closed)
Patch Set: Created May 30, 2017, 3:49 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 | « stats.js ('k') | utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « stats.js ('k') | utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld