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

Delta Between Two Patch Sets: lib/content/elemHideEmulation.js

Issue 29713565: Issue 6437 - Filter out patterns that do not match DOM mutations (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Add tests Created April 24, 2018, 12:39 p.m.
Right Patch Set: Process plain selectors on DOM mutations Created April 24, 2018, 1:56 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 | test/browser/elemHideEmulation.js » ('j') | 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-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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // Just in case the getSelectors() generator above had to run some heavy 217 // Just in case the getSelectors() generator above had to run some heavy
218 // document.querySelectorAll() call which didn't produce any results, make 218 // document.querySelectorAll() call which didn't produce any results, make
219 // sure there is at least one point where execution can pause. 219 // sure there is at least one point where execution can pause.
220 yield null; 220 yield null;
221 } 221 }
222 222
223 function PlainSelector(selector) 223 function PlainSelector(selector)
224 { 224 {
225 this._selector = selector; 225 this._selector = selector;
226 this.maybeDependsOnAttributes = /[#.]|\[.+\]/.test(selector); 226 this.maybeDependsOnAttributes = /[#.]|\[.+\]/.test(selector);
227 this.dependsOnDOM = this.maybeDependsOnAttributes;
Manish Jethani 2018/04/24 13:58:32 OK, since Trac #6618 is rejected we have to proces
227 } 228 }
228 229
229 PlainSelector.prototype = { 230 PlainSelector.prototype = {
230 preferHideWithSelector: true,
Manish Jethani 2018/04/24 12:43:01 This is a bug. If there's only the filter "example
231
232 /** 231 /**
233 * Generator function returning a pair of selector 232 * Generator function returning a pair of selector
234 * string and subtree. 233 * string and subtree.
235 * @param {string} prefix the prefix for the selector. 234 * @param {string} prefix the prefix for the selector.
236 * @param {Node} subtree the subtree we work on. 235 * @param {Node} subtree the subtree we work on.
237 * @param {StringifiedStyle[]} styles the stringified style objects. 236 * @param {StringifiedStyle[]} styles the stringified style objects.
238 */ 237 */
239 *getSelectors(prefix, subtree, styles) 238 *getSelectors(prefix, subtree, styles)
240 { 239 {
241 yield [prefix + this._selector, subtree]; 240 yield [prefix + this._selector, subtree];
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 characterData: shouldObserveCharacterData(this.patterns), 878 characterData: shouldObserveCharacterData(this.patterns),
880 subtree: true 879 subtree: true
881 } 880 }
882 ); 881 );
883 this.document.addEventListener("load", this.onLoad.bind(this), true); 882 this.document.addEventListener("load", this.onLoad.bind(this), true);
884 } 883 }
885 } 884 }
886 }; 885 };
887 886
888 exports.ElemHideEmulation = ElemHideEmulation; 887 exports.ElemHideEmulation = ElemHideEmulation;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld