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 browser && |
- "CSSOrigin" in browser.extensionTypes; |
+const cssOriginSupported = "extensionTypes" in browser && |
+ "CSSOrigin" in browser.extensionTypes; |
+const userStyleSheetsSupported = cssOriginSupported || |
+ (info.platform == "chromium" && |
+ parseInt(info.platformVersion, 10) >= 64); |
function hideElements(tabId, frameId, selectors) |
{ |
- browser.tabs.insertCSS(tabId, { |
+ let options = { |
code: selectors.join(", ") + "{display: none !important;}", |
- cssOrigin: "user", |
frameId, |
matchAboutBlank: true, |
runAt: "document_start" |
- }); |
+ }; |
+ |
+ if (cssOriginSupported) |
+ options.cssOrigin = "user"; |
+ |
+ browser.tabs.insertCSS(tabId, options); |
} |
port.on("elemhide.getSelectors", (msg, sender) => |
{ |
let selectors = []; |
let emulatedPatterns = []; |
let trace = devtools && devtools.hasPanel(sender.page); |
let inject = !userStyleSheetsSupported; |