| Index: lib/ui.js |
| =================================================================== |
| --- a/lib/ui.js |
| +++ b/lib/ui.js |
| @@ -895,9 +895,9 @@ |
| /** |
| * Handles clicks inside the browser's content area, will intercept clicks on |
| - * abp: links. This can be called either with an event object or with the link |
| - * target (if it is the former then link target will be retrieved from event |
| - * target). |
| + * abp: links as well as links to subscribe.adblockplus.org. This can be called |
| + * either with an event object or with the link target (if it is the former then |
| + * link target will be retrieved from event target). |
| */ |
| onBrowserClick: function (/**Window*/ window, /**Event*/ event, /**String*/ linkTarget) |
| { |
| @@ -909,29 +909,33 @@ |
| // Search the link associated with the click |
| let link = event.target; |
| - while (link && !(link instanceof Ci.nsIDOMHTMLAnchorElement)) |
| + while (!(link instanceof Ci.nsIDOMHTMLAnchorElement)) |
| + { |
| link = link.parentNode; |
| - if (!link || link.protocol != "abp:") |
| - return; |
| + if (!link) |
| + return; |
| + } |
| + linkTarget = link.href; |
| + } |
| + let match = /^(?:abp:\/*subscribe|https?:\/*subscribe\.adblockplus\.org)\/*\?(.*)/i.exec(linkTarget); |
|
Sebastian Noack
2015/04/01 12:29:49
I think we should use DOM API's (i.e. the anchor e
Thomas Greiner
2015/04/01 12:41:15
It's a different situation than on Chrome since we
Sebastian Noack
2015/04/01 12:44:20
I'm not sure what you mean. Since you already use
Thomas Greiner
2015/04/01 12:51:30
There are two ways to get a link target here. One
|
| + if (!match) |
| + return; |
| + |
| + if (event) |
| + { |
| // This is our link - make sure the browser doesn't handle it |
| event.preventDefault(); |
| event.stopPropagation(); |
| - |
| - linkTarget = link.href; |
| } |
| - let match = /^abp:\/*subscribe\/*\?(.*)/i.exec(linkTarget); |
| - if (!match) |
| - return; |
| - |
| // Decode URL parameters |
| let title = null; |
| let url = null; |
| let mainSubscriptionTitle = null; |
| let mainSubscriptionURL = null; |
| - for (let param of match[1].split('&')) |
| + for (let param of match[1].split("&")) |
| { |
| let parts = param.split("=", 2); |
| if (parts.length != 2 || !/\S/.test(parts[1])) |