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

Delta Between Two Patch Sets: include.preload.js

Issue 29365801: Issue 4676 - Replace non-standard CSSStyleSheet.addRule() call by CSSStyleSheet.insertRule() (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome
Left Patch Set: Created Nov. 30, 2016, 1:37 p.m.
Right Patch Set: Changed indentation Created Nov. 30, 2016, 1:50 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 // Safari only allows 8192 primitive selectors to be injected at once[1], we 575 // Safari only allows 8192 primitive selectors to be injected at once[1], we
576 // therefore chunk the inserted selectors into groups of 200 to be safe. 576 // therefore chunk the inserted selectors into groups of 200 to be safe.
577 // (Chrome also has a limit, larger... but we're not certain exactly what it 577 // (Chrome also has a limit, larger... but we're not certain exactly what it
578 // is! Edge apparently has no such limit.) 578 // is! Edge apparently has no such limit.)
579 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69 debb75fc1de/Source/WebCore/css/RuleSet.h#L68 579 // [1] - https://github.com/WebKit/webkit/blob/1cb2227f6b2a1035f7bdc46e5ab69 debb75fc1de/Source/WebCore/css/RuleSet.h#L68
580 for (var i = 0; i < selectors.length; i += this.selectorGroupSize) 580 for (var i = 0; i < selectors.length; i += this.selectorGroupSize)
581 { 581 {
582 var selector = selectors.slice(i, i + this.selectorGroupSize).join(", "); 582 var selector = selectors.slice(i, i + this.selectorGroupSize).join(", ");
583 this.style.sheet.insertRule(selector + "{display: none !important;}", 583 this.style.sheet.insertRule(selector + "{display: none !important;}",
584 this.style.sheet.cssRules.length); 584 this.style.sheet.cssRules.length);
kzar 2016/11/30 13:48:20 Nit: The indentation of this line looks weird, sho
Wladimir Palant 2016/11/30 13:52:11 Ok, I've changed indentation.
585 } 585 }
586 }, 586 },
587 587
588 apply: function() 588 apply: function()
589 { 589 {
590 var selectors = null; 590 var selectors = null;
591 var propertyFiltersLoaded = false; 591 var propertyFiltersLoaded = false;
592 592
593 var checkLoaded = function() 593 var checkLoaded = function()
594 { 594 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 checkCollapse(event.target); 639 checkCollapse(event.target);
640 }, true); 640 }, true);
641 641
642 document.addEventListener("load", function(event) 642 document.addEventListener("load", function(event)
643 { 643 {
644 var element = event.target; 644 var element = event.target;
645 if (/^i?frame$/.test(element.localName)) 645 if (/^i?frame$/.test(element.localName))
646 checkCollapse(element); 646 checkCollapse(element);
647 }, true); 647 }, true);
648 } 648 }
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