OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Last right click state stored for element blocking via the context menu. | 36 // Last right click state stored for element blocking via the context menu. |
37 let lastRightClickEvent = null; | 37 let lastRightClickEvent = null; |
38 let lastRightClickEventIsMostRecent = false; | 38 let lastRightClickEventIsMostRecent = false; |
39 | 39 |
40 | 40 |
41 /* Utilities */ | 41 /* Utilities */ |
42 | 42 |
43 function getFiltersForElement(element, callback) | 43 function getFiltersForElement(element, callback) |
44 { | 44 { |
| 45 let src = element.getAttribute("src"); |
45 ext.backgroundPage.sendMessage( | 46 ext.backgroundPage.sendMessage( |
46 { | 47 { |
47 type: "composer.getFilters", | 48 type: "composer.getFilters", |
48 tagName: element.localName, | 49 tagName: element.localName, |
49 id: element.id, | 50 id: element.id, |
50 src: element.getAttribute("src"), | 51 src: src && src.length <= 1000 ? src : null, |
51 style: element.getAttribute("style"), | 52 style: element.getAttribute("style"), |
52 classes: Array.prototype.slice.call(element.classList), | 53 classes: Array.prototype.slice.call(element.classList), |
53 urls: getURLsFromElement(element), | 54 urls: getURLsFromElement(element), |
54 mediatype: typeMap[element.localName], | 55 mediatype: typeMap[element.localName], |
55 baseURL: document.location.href | 56 baseURL: document.location.href |
56 }, | 57 }, |
57 response => | 58 response => |
58 { | 59 { |
59 callback(response.filters, response.selectors); | 60 callback(response.filters, response.selectors); |
60 }); | 61 }); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 } | 577 } |
577 }); | 578 }); |
578 } | 579 } |
579 break; | 580 break; |
580 } | 581 } |
581 }); | 582 }); |
582 | 583 |
583 if (window == window.top) | 584 if (window == window.top) |
584 ext.backgroundPage.sendMessage({type: "composer.ready"}); | 585 ext.backgroundPage.sendMessage({type: "composer.ready"}); |
585 } | 586 } |
OLD | NEW |