Index: lib/cssInjection.js |
=================================================================== |
--- a/lib/cssInjection.js |
+++ b/lib/cssInjection.js |
@@ -21,6 +21,7 @@ |
const {RegExpFilter} = require("filterClasses"); |
const {ElemHide} = require("elemHide"); |
+const {ElemHideEmulation} = require("elemHideEmulation"); |
const {checkWhitelisted} = require("whitelisting"); |
const {extractHostFromFrame} = require("url"); |
const {port} = require("messaging"); |
@@ -43,6 +44,7 @@ |
port.on("elemhide.getSelectors", (msg, sender) => |
{ |
let selectors = []; |
+ let emulatedPatterns = []; |
let trace = devtools && devtools.hasPanel(sender.page); |
let inject = !userStyleSheetsSupported; |
@@ -50,18 +52,23 @@ |
RegExpFilter.typeMap.DOCUMENT | |
RegExpFilter.typeMap.ELEMHIDE)) |
{ |
+ let hostname = extractHostFromFrame(sender.frame); |
let specificOnly = checkWhitelisted(sender.page, sender.frame, |
RegExpFilter.typeMap.GENERICHIDE); |
+ |
selectors = ElemHide.getSelectorsForDomain( |
- extractHostFromFrame(sender.frame), |
+ hostname, |
specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.ALL_MATCHING |
); |
+ |
+ for (let filter of ElemHideEmulation.getRulesForDomain(hostname)) |
+ emulatedPatterns.push({selector: filter.selector, text: filter.text}); |
} |
if (!inject && selectors.length > 0) |
hideElements(sender.page.id, sender.frame.id, selectors); |
- let response = {trace, inject}; |
+ let response = {trace, inject, emulatedPatterns}; |
if (trace || inject) |
response.selectors = selectors; |