Index: lib/cssInjection.js |
=================================================================== |
--- a/lib/cssInjection.js |
+++ b/lib/cssInjection.js |
@@ -21,29 +21,37 @@ |
const {RegExpFilter} = require("filterClasses"); |
const {ElemHide} = require("elemHide"); |
const {ElemHideEmulation} = require("elemHideEmulation"); |
const {checkWhitelisted} = require("whitelisting"); |
const {extractHostFromFrame} = require("url"); |
const {port} = require("messaging"); |
const devtools = require("devtools"); |
+const info = require("info"); |
-const userStyleSheetsSupported = "extensionTypes" in chrome && |
- "CSSOrigin" in chrome.extensionTypes; |
+const cssOriginSupported = "extensionTypes" in chrome && |
+ "CSSOrigin" in chrome.extensionTypes; |
+const userStyleSheetsSupported = cssOriginSupported || |
+ (info.platform == "chromium" && |
+ parseInt(info.platformVersion, 10) >= 60); |
function hideElements(tabId, frameId, selectors) |
{ |
- chrome.tabs.insertCSS(tabId, { |
+ let options = { |
code: selectors.join(", ") + "{display: none !important;}", |
- cssOrigin: "user", |
frameId, |
matchAboutBlank: true, |
runAt: "document_start" |
- }); |
+ }; |
+ |
+ if (cssOriginSupported) |
+ options.cssOrigin = "user"; |
+ |
+ chrome.tabs.insertCSS(tabId, options); |
} |
port.on("elemhide.getSelectors", (msg, sender) => |
{ |
let selectors = []; |
let emulatedPatterns = []; |
let trace = devtools && devtools.hasPanel(sender.page); |
let inject = !userStyleSheetsSupported; |