Index: lib/content/elemHideEmulation.js |
=================================================================== |
--- a/lib/content/elemHideEmulation.js |
+++ b/lib/content/elemHideEmulation.js |
@@ -122,16 +122,30 @@ |
} |
styles.sort(); |
return { |
style: styles.join(" "), |
subSelectors: splitSelector(rule.selectorText) |
}; |
} |
+function getCSSRules(stylesheet) |
+{ |
+ try |
+ { |
+ return stylesheet.cssRules; |
+ } |
+ catch (e) |
+ { |
+ // On Firefox, a style sheet injected by another extension has the same |
+ // origin, but accessing the cssRules property is still an error. |
+ // See #6594. |
+ } |
+} |
+ |
let scopeSupported = null; |
function tryQuerySelector(subtree, selector, all) |
{ |
let elements = null; |
try |
{ |
elements = all ? subtree.querySelectorAll(selector) : |
@@ -603,17 +617,17 @@ |
for (let stylesheet of stylesheets || []) |
{ |
// Explicitly ignore third-party stylesheets to ensure consistent behavior |
// between Firefox and Chrome. |
if (!this.isSameOrigin(stylesheet)) |
continue; |
- let rules = stylesheet.cssRules; |
+ let rules = getCSSRules(stylesheet); |
if (!rules) |
continue; |
for (let rule of rules) |
{ |
if (rule.type != rule.STYLE_RULE) |
continue; |