Index: lib/content/elemHideEmulation.js |
=================================================================== |
--- a/lib/content/elemHideEmulation.js |
+++ b/lib/content/elemHideEmulation.js |
@@ -521,26 +521,37 @@ |
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; |
- if (!rules) |
- continue; |
- |
- for (let rule of rules) |
+ try |
{ |
- if (rule.type != rule.STYLE_RULE) |
+ let rules = stylesheet.cssRules; |
kzar
2018/03/19 15:52:07
If this is the only line that could cause the exce
hub
2018/03/20 14:53:53
Done.
|
+ if (!rules) |
continue; |
- cssStyles.push(stringifyStyle(rule)); |
+ for (let rule of rules) |
+ { |
+ if (rule.type != rule.STYLE_RULE) |
+ continue; |
+ |
+ cssStyles.push(stringifyStyle(rule)); |
+ } |
+ } |
+ catch (e) |
+ { |
+ // On Firefox, there is a chance that an InvalidAccessError |
kzar
2018/03/19 15:52:07
How come this happens? Is there a Firefox bug / di
hub
2018/03/20 16:16:02
It's not a bug.
https://searchfox.org/mozilla-cen
kzar
2018/04/18 16:12:30
Acknowledged.
In fact that link you gave is prett
hub
2018/04/18 18:48:23
Done.
|
+ // get thrown when accessing cssRules. Just skip the stylesheet |
+ // in that case. |
+ // See https://issues.adblockplus.org/ticket/6382 |
+ continue; |
} |
} |
let patterns = this.patterns.slice(); |
let pattern = null; |
let generator = null; |
let processPatterns = () => |