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

Unified Diff: lib/content/elemHideEmulation.js

Issue 29847558: Issue 6504 - Remove useInlineStyles for now (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Update issue number in comment Created Aug. 10, 2018, 2:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/content/elemHideEmulation.js
===================================================================
--- a/lib/content/elemHideEmulation.js
+++ b/lib/content/elemHideEmulation.js
@@ -599,16 +599,23 @@
}
function ElemHideEmulation(addSelectorsFunc, hideElemsFunc)
{
this.document = document;
this.addSelectorsFunc = addSelectorsFunc;
this.hideElemsFunc = hideElemsFunc;
this.observer = new MutationObserver(this.observe.bind(this));
+
+ // This flag is supposed to indicate whether we should prefer setting the
+ // style attribute of the element over using CSS selectors. It is set by the
+ // web extension if the tabs.removeCSS API is available (Firefox 53+). But
+ // because of issues with performance (see #6504), we are ignoring the value
+ // of this flag for now; we always set the style attribute.
+ // https://issues.adblockplus.org/ticket/6504#comment:9
this.useInlineStyles = true;
hub 2018/08/10 19:43:16 so if we don't use it, and since the code below ge
Manish Jethani 2018/08/14 16:50:16 I left it there with a comment sorta hoping that s
hub 2018/08/14 17:24:41 Since you remove the code below, I believe it is p
Manish Jethani 2018/08/14 17:46:22 Sounds OK to me. Done.
}
ElemHideEmulation.prototype = {
isSameOrigin(stylesheet)
{
try
{
@@ -801,28 +808,20 @@
generator = evaluate(pattern.selectors, 0, "",
this.document, cssStyles, evaluationTargets);
}
for (let selector of generator)
{
if (selector != null)
{
- if (!this.useInlineStyles)
+ for (let element of this.document.querySelectorAll(selector))
{
- selectors.push(selector);
- selectorFilters.push(pattern.text);
- }
- else
- {
- for (let element of this.document.querySelectorAll(selector))
- {
- elements.push(element);
- elementFilters.push(pattern.text);
- }
+ elements.push(element);
+ elementFilters.push(pattern.text);
}
}
if (performance.now() - cycleStart > MAX_SYNCHRONOUS_PROCESSING_TIME)
{
setTimeout(processPatterns, 0);
return;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld