Index: lib/content/elemHideEmulation.js |
=================================================================== |
--- a/lib/content/elemHideEmulation.js |
+++ b/lib/content/elemHideEmulation.js |
@@ -603,17 +603,30 @@ |
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; |
+ try |
+ { |
+ rules = stylesheet.cssRules; |
+ } |
+ catch (e) |
+ { |
+ // On Firefox, there is a chance that an InvalidAccessError |
+ // get thrown when accessing cssRules. Just skip the stylesheet |
+ // in that case. |
+ // See https://searchfox.org/mozilla-central/rev/f65d7528e34ef1a7665b4a1a7b7cdb1388fcd3aa/layout/style/StyleSheet.cpp#699 |
+ continue; |
+ } |
+ |
if (!rules) |
continue; |
for (let rule of rules) |
{ |
if (rule.type != rule.STYLE_RULE) |
continue; |