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

Side by Side Diff: chrome/content/elemHideEmulation.js

Issue 29481659: Issue 5381 - iterate stylesheet with an array subscript (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created July 6, 2017, 1:33 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 addSelectors(stylesheets) 396 addSelectors(stylesheets)
397 { 397 {
398 let selectors = []; 398 let selectors = [];
399 let selectorFilters = []; 399 let selectorFilters = [];
400 400
401 let elements = []; 401 let elements = [];
402 let elementFilters = []; 402 let elementFilters = [];
403 403
404 let cssStyles = []; 404 let cssStyles = [];
405 405
406 for (let stylesheet of stylesheets) 406 // Chrome < 51 doesn't have an iterable StyleSheetList
407 // https://issues.adblockplus.org/ticket/5381
408 for (let i = 0; i < stylesheets.length; i++)
407 { 409 {
410 let stylesheet = stylesheets[i];
408 // Explicitly ignore third-party stylesheets to ensure consistent behavior 411 // Explicitly ignore third-party stylesheets to ensure consistent behavior
409 // between Firefox and Chrome. 412 // between Firefox and Chrome.
410 if (!this.isSameOrigin(stylesheet)) 413 if (!this.isSameOrigin(stylesheet))
411 continue; 414 continue;
412 415
413 let rules = stylesheet.cssRules; 416 let rules = stylesheet.cssRules;
414 if (!rules) 417 if (!rules)
415 continue; 418 continue;
416 419
417 for (let rule of rules) 420 for (let rule of rules)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 474
472 if (this.patterns.length > 0) 475 if (this.patterns.length > 0)
473 { 476 {
474 let {document} = this.window; 477 let {document} = this.window;
475 this.addSelectors(document.styleSheets); 478 this.addSelectors(document.styleSheets);
476 document.addEventListener("load", this.onLoad.bind(this), true); 479 document.addEventListener("load", this.onLoad.bind(this), true);
477 } 480 }
478 }); 481 });
479 } 482 }
480 }; 483 };
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