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

Side by Side Diff: subscriptionLink.postload.js

Issue 29338592: Issue 3828 - Ignore simulated clicks on abp:subscribe links (Closed)
Patch Set: Created March 17, 2016, 8:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 11 matching lines...) Expand all
22 // whether variable ext exists before continuing to avoid 22 // whether variable ext exists before continuing to avoid
23 // "Uncaught ReferenceError: ext is not defined". See https://crbug.com/416907 23 // "Uncaught ReferenceError: ext is not defined". See https://crbug.com/416907
24 if ("ext" in window && document instanceof HTMLDocument) 24 if ("ext" in window && document instanceof HTMLDocument)
25 { 25 {
26 document.addEventListener("click", function(event) 26 document.addEventListener("click", function(event)
27 { 27 {
28 // Ignore right-clicks 28 // Ignore right-clicks
29 if (event.button == 2) 29 if (event.button == 2)
30 return; 30 return;
31 31
32 // Ignore simulated clicks.
33 if (event.isTrusted == false)
34 return;
35
32 // Search the link associated with the click 36 // Search the link associated with the click
33 var link = event.target; 37 var link = event.target;
34 while (!(link instanceof HTMLAnchorElement)) 38 while (!(link instanceof HTMLAnchorElement))
35 { 39 {
36 link = link.parentNode; 40 link = link.parentNode;
37 41
38 if (!link) 42 if (!link)
39 return; 43 return;
40 } 44 }
41 45
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (!/^(https?|ftp):/.test(url)) 87 if (!/^(https?|ftp):/.test(url))
84 return; 88 return;
85 89
86 ext.backgroundPage.sendMessage({ 90 ext.backgroundPage.sendMessage({
87 type: "add-subscription", 91 type: "add-subscription",
88 title: title, 92 title: title,
89 url: url 93 url: url
90 }); 94 });
91 }, true); 95 }, true);
92 } 96 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld