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

Side by Side Diff: include.preload.js

Issue 29545645: Issue 5695 - Use tabs.insertCSS if extensionTypes.CSSOrigin exists (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Always pass selectors if trace or inject is true Created Sept. 19, 2017, 5:44 a.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 | lib/cssInjection.js » ('j') | lib/cssInjection.js » ('J')
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 let selector = preparedSelectors.slice( 434 let selector = preparedSelectors.slice(
435 i, i + this.selectorGroupSize 435 i, i + this.selectorGroupSize
436 ).join(", "); 436 ).join(", ");
437 this.style.sheet.insertRule(selector + "{display: none !important;}", 437 this.style.sheet.insertRule(selector + "{display: none !important;}",
438 this.style.sheet.cssRules.length); 438 this.style.sheet.cssRules.length);
439 } 439 }
440 }, 440 },
441 441
442 addSelectors(selectors, filters) 442 addSelectors(selectors, filters)
443 { 443 {
444 if (!selectors || selectors.length == 0) 444 if (selectors.length == 0)
445 return; 445 return;
446 446
447 if (this.inject) 447 if (this.inject)
448 { 448 {
449 // Insert the style rules inline if we have been instructed by the 449 // Insert the style rules inline if we have been instructed by the
450 // background page to do so. This is usually the case, except on platforms 450 // background page to do so. This is usually the case, except on platforms
451 // that do support user stylesheets via the chrome.tabs.insertCSS API 451 // that do support user stylesheets via the chrome.tabs.insertCSS API
452 // (Firefox 53 onwards for now and possibly Chrome in the near future). 452 // (Firefox 53 onwards for now and possibly Chrome in the near future).
453 // Once all supported platforms have implemented this API, we can remove 453 // Once all supported platforms have implemented this API, we can remove
454 // the code below. See issue #5090. 454 // the code below. See issue #5090.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 checkCollapse(event.target); 523 checkCollapse(event.target);
524 }, true); 524 }, true);
525 525
526 document.addEventListener("load", event => 526 document.addEventListener("load", event =>
527 { 527 {
528 let element = event.target; 528 let element = event.target;
529 if (/^i?frame$/.test(element.localName)) 529 if (/^i?frame$/.test(element.localName))
530 checkCollapse(element); 530 checkCollapse(element);
531 }, true); 531 }, true);
532 } 532 }
OLDNEW
« no previous file with comments | « no previous file | lib/cssInjection.js » ('j') | lib/cssInjection.js » ('J')

Powered by Google App Engine
This is Rietveld