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

Unified 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: Simplify further Created Sept. 17, 2017, 1:38 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 | lib/cssInjection.js » ('j') | lib/cssInjection.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -436,17 +436,17 @@
).join(", ");
this.style.sheet.insertRule(selector + "{display: none !important;}",
this.style.sheet.cssRules.length);
}
},
addSelectors(selectors, filters)
{
- if (!selectors || selectors.length == 0)
+ if (selectors.length == 0)
return;
if (this.inject)
{
// Insert the style rules inline if we have been instructed by the
// background page to do so. This is usually the case, except on platforms
// that do support user stylesheets via the chrome.tabs.insertCSS API
// (Firefox 53 onwards for now and possibly Chrome in the near future).
@@ -496,20 +496,23 @@
this.style.parentElement.removeChild(this.style);
this.style = null;
if (response.trace)
this.tracer = new ElementHidingTracer();
this.inject = response.inject;
- if (this.inject)
- this.addSelectors(response.selectors);
- else if (this.tracer)
- this.tracer.addSelectors(response.selectors);
+ if (response.selectors)
Manish Jethani 2017/09/17 13:51:38 Check for the existence of response.selectors sinc
+ {
+ if (this.inject)
+ this.addSelectors(response.selectors);
+ else if (this.tracer)
+ this.tracer.addSelectors(response.selectors);
+ }
this.elemHideEmulation.apply();
});
}
};
if (document instanceof HTMLDocument)
{
« no previous file with comments | « no previous file | lib/cssInjection.js » ('j') | lib/cssInjection.js » ('J')

Powered by Google App Engine
This is Rietveld