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

Side by Side Diff: include.preload.js

Issue 29469562: Issue 5094 - The MutationObserver callback was wrong (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created June 20, 2017, 2:39 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 { 137 {
138 propertyName = "visibility"; 138 propertyName = "visibility";
139 propertyValue = "hidden"; 139 propertyValue = "hidden";
140 } 140 }
141 141
142 if (el.style.getPropertyValue(propertyName) != propertyValue || 142 if (el.style.getPropertyValue(propertyName) != propertyValue ||
143 el.style.getPropertyPriority(propertyName) != "important") 143 el.style.getPropertyPriority(propertyName) != "important")
144 el.style.setProperty(propertyName, propertyValue, "important"); 144 el.style.setProperty(propertyName, propertyValue, "important");
145 } 145 }
146 146
147 function processMutations(mutations)
148 {
149 for (let mutation of mutations)
150 doHide(mutation.target);
151 }
152
147 doHide(element); 153 doHide(element);
148 154
149 new MutationObserver(doHide).observe( 155 new MutationObserver(processMutations).observe(
150 element, { 156 element, {
151 attributes: true, 157 attributes: true,
152 attributeFilter: ["style"] 158 attributeFilter: ["style"]
153 } 159 }
154 ); 160 );
155 } 161 }
156 162
157 function checkCollapse(element) 163 function checkCollapse(element)
158 { 164 {
159 let mediatype = typeMap.get(element.localName); 165 let mediatype = typeMap.get(element.localName);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 checkCollapse(event.target); 497 checkCollapse(event.target);
492 }, true); 498 }, true);
493 499
494 document.addEventListener("load", event => 500 document.addEventListener("load", event =>
495 { 501 {
496 let element = event.target; 502 let element = event.target;
497 if (/^i?frame$/.test(element.localName)) 503 if (/^i?frame$/.test(element.localName))
498 checkCollapse(element); 504 checkCollapse(element);
499 }, true); 505 }, true);
500 } 506 }
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