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

Side by Side Diff: include.preload.js

Issue 29370970: [adblockpluschrome] Issue 3596 - Added support for CSS property filters to devtools panel (Closed)
Patch Set: No longer use ElementHidingTracer to log ElemHideEmulationFilter in the devpanel Created Jan. 12, 2017, 1:38 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 | lib/devtools.js » ('j') | 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-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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 var shadow = shadowRoot(this); 483 var shadow = shadowRoot(this);
484 return shadow == ourShadowRoot ? null : shadow; 484 return shadow == ourShadowRoot ? null : shadow;
485 } 485 }
486 }); 486 });
487 }, null); 487 }, null);
488 } 488 }
489 489
490 return shadow; 490 return shadow;
491 }, 491 },
492 492
493 addSelectors: function(selectors) 493 addSelectors: function(selectors, filters)
494 { 494 {
495 if (selectors.length == 0) 495 if (selectors.length == 0)
496 return; 496 return;
497 497
498 // In case of an ElemHideEmulationFilter the selector doesn't match the
499 // selector of the filter ([-abp-properties=...] vs actual css selector
500 // depending on the sites css). To still allow the devtools panel to find
501 // the correct filter addSelector gets also passed the filterText of the
502 // ElemHideEmulationFilter used to produce the selectors.
503 if (filters)
Sebastian Noack 2017/01/12 17:03:29 Yeah, this is more like it works on Firefox curren
Sebastian Noack 2017/01/12 17:03:29 And yes, it's also not great that we message the b
wspee 2017/01/19 16:20:15 Done.
wspee 2017/01/19 16:20:15 Done.
504 {
505 let traceSelectors = [];
506 for (let filter of filters)
507 traceSelectors.push(filter.replace(/^.*?##/, ""));
508 ext.backgroundPage.sendMessage({
509 type: "devtools.traceElemHide",
510 selectors: traceSelectors
511 });
512 }
513
498 if (!this.style) 514 if (!this.style)
499 { 515 {
500 // Create <style> element lazily, only if we add styles. Add it to 516 // Create <style> element lazily, only if we add styles. Add it to
501 // the shadow DOM if possible. Otherwise fallback to the <head> or 517 // the shadow DOM if possible. Otherwise fallback to the <head> or
502 // <html> element. If we have injected a style element before that 518 // <html> element. If we have injected a style element before that
503 // has been removed (the sheet property is null), create a new one. 519 // has been removed (the sheet property is null), create a new one.
504 this.style = document.createElement("style"); 520 this.style = document.createElement("style");
505 (this.shadow || document.head 521 (this.shadow || document.head
506 || document.documentElement).appendChild(this.style); 522 || document.documentElement).appendChild(this.style);
507 523
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 checkCollapse(event.target); 609 checkCollapse(event.target);
594 }, true); 610 }, true);
595 611
596 document.addEventListener("load", function(event) 612 document.addEventListener("load", function(event)
597 { 613 {
598 var element = event.target; 614 var element = event.target;
599 if (/^i?frame$/.test(element.localName)) 615 if (/^i?frame$/.test(element.localName))
600 checkCollapse(element); 616 checkCollapse(element);
601 }, true); 617 }, true);
602 } 618 }
OLDNEW
« no previous file with comments | « no previous file | lib/devtools.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld