Index: background.js |
diff --git a/background.js b/background.js |
index cb7a861be117f6a390b74ffa1370bb9de50ba33f..243628d159da0c23fab35de53715324de3113d60 100644 |
--- a/background.js |
+++ b/background.js |
@@ -21,6 +21,7 @@ const {RegExpFilter} = require("filterClasses"); |
const {ElemHide} = require("elemHide"); |
const {checkWhitelisted} = require("whitelisting"); |
const {extractHostFromFrame} = require("url"); |
+const {userStylesheetsSupported, hideElements} = require("css"); |
const {port} = require("messaging"); |
const devtools = require("devtools"); |
@@ -45,7 +46,32 @@ port.on("get-selectors", (msg, sender) => |
selectors = []; |
} |
- return {selectors, trace}; |
Sebastian Noack
2017/04/29 22:11:03
How about moving this message handler (i.e. this f
Manish Jethani
2017/05/01 23:18:05
Done, there is now a elemHideHelper module that ha
|
+ if (!userStylesheetsSupported) |
+ return {selectors, trace, inject: true}; |
+ |
+ return new Promise(resolve => |
+ { |
+ hideElements(sender.page.id, sender.frame.id, selectors, error => |
+ { |
+ let response = {trace, inject: !!error}; |
+ |
+ if (trace || error) |
+ response.selectors = selectors; |
+ |
+ resolve(response); |
+ }); |
+ }); |
+}); |
+ |
+port.on("hide-elements", (msg, sender) => |
+{ |
+ return new Promise(resolve => |
+ { |
+ hideElements(sender.page.id, sender.frame.id, msg.selectors, error => |
+ { |
+ resolve({success: !error}); |
+ }); |
+ }); |
}); |
port.on("forward", (msg, sender) => |