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

Delta Between Two Patch Sets: composer.postload.js

Issue 29356630: Issue 4330 - Avoid suggesting huge URL filters (Closed)
Left Patch Set: Created Oct. 12, 2016, 7:47 p.m.
Right Patch Set: Changed crazy logic Created Oct. 14, 2016, 5:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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
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
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 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld