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

Side by Side Diff: include.preload.js

Issue 6317759025643520: Issue 1396 - Avoid infinite recursion when collapsing <input type="image"> elements (Closed)
Patch Set: Addressed comment Created Sept. 24, 2014, 5:01 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 29 matching lines...) Expand all
40 { 40 {
41 type: "should-collapse", 41 type: "should-collapse",
42 url: url, 42 url: url,
43 mediatype: typeMap[tag] 43 mediatype: typeMap[tag]
44 }, 44 },
45 45
46 function(response) 46 function(response)
47 { 47 {
48 if (response && element.parentNode) 48 if (response && element.parentNode)
49 { 49 {
50 var property = "display";
51 var value = "none";
52
50 // <frame> cannot be removed, doing that will mess up the frameset 53 // <frame> cannot be removed, doing that will mess up the frameset
51 if (tag == "frame") 54 if (tag == "frame")
52 element.style.setProperty("visibility", "hidden", "important"); 55 {
53 else 56 property = "visibility";
54 element.style.setProperty("display", "none", "important"); 57 value = "hidden";
58 }
59
60 // <input type="image"> elements try to load their image again
61 // when the "display" CSS property is set. So we have to check
62 // that it isn't already collapsed to avoid an infinite recursion.
63 if (element.style.getPropertyValue(property) != value ||
64 element.style.getPropertyPriority(property) != "important")
65 element.style.setProperty(property, value, "important");
55 } 66 }
56 } 67 }
57 ); 68 );
58 } 69 }
59 } 70 }
60 71
61 function checkSitekey() 72 function checkSitekey()
62 { 73 {
63 var attr = document.documentElement.getAttribute("data-adblockkey"); 74 var attr = document.documentElement.getAttribute("data-adblockkey");
64 if (attr) 75 if (attr)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 }, true); 210 }, true);
200 211
201 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 212 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
202 } 213 }
203 214
204 if (document instanceof HTMLDocument) 215 if (document instanceof HTMLDocument)
205 { 216 {
206 checkSitekey(); 217 checkSitekey();
207 init(document); 218 init(document);
208 } 219 }
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