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

Delta Between Two Patch Sets: include.preload.js

Issue 29348869: Issue 4101 - Prevent runaway MutationObservers (Closed)
Left Patch Set: Rebased. Created Aug. 11, 2016, 1:49 p.m.
Right Patch Set: Removed _collapsed logic, addressed nits Created Aug. 11, 2016, 1:52 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 function collapseElement() 151 function collapseElement()
152 { 152 {
153 var propertyName = "display"; 153 var propertyName = "display";
154 var propertyValue = "none"; 154 var propertyValue = "none";
155 if (element.localName == "frame") 155 if (element.localName == "frame")
156 { 156 {
157 propertyName = "visibility"; 157 propertyName = "visibility";
158 propertyValue = "hidden"; 158 propertyValue = "hidden";
159 } 159 }
160 160
161 if (element.style.getPropertyValue(propertyName) !== propertyValue || 161 if (element.style.getPropertyValue(propertyName) != propertyValue ||
162 element.style.getPropertyPriority(propertyName) !== "important") 162 element.style.getPropertyPriority(propertyName) != "important")
163 element.style.setProperty(propertyName, propertyValue, "important"); 163 element.style.setProperty(propertyName, propertyValue, "important");
164 } 164 }
165 165
166 if (collapse && !element._collapsed) 166 if (collapse)
167 { 167 {
168 collapseElement(); 168 collapseElement();
169 element._collapsed = true;
170 169
171 if (MutationObserver) 170 if (MutationObserver)
172 new MutationObserver(collapseElement).observe( 171 new MutationObserver(collapseElement).observe(
173 element, { 172 element, {
174 attributes: true, 173 attributes: true,
175 attributeFilter: ["style"] 174 attributeFilter: ["style"]
176 } 175 }
177 ); 176 );
178 } 177 }
179 } 178 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 }, true); 614 }, true);
616 615
617 return updateStylesheet; 616 return updateStylesheet;
618 } 617 }
619 618
620 if (document instanceof HTMLDocument) 619 if (document instanceof HTMLDocument)
621 { 620 {
622 checkSitekey(); 621 checkSitekey();
623 window.updateStylesheet = init(document); 622 window.updateStylesheet = init(document);
624 } 623 }
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