| Index: lib/content/elemHideEmulation.js |
| =================================================================== |
| --- a/lib/content/elemHideEmulation.js |
| +++ b/lib/content/elemHideEmulation.js |
| @@ -406,35 +406,51 @@ |
| let elementFilters = []; |
| let cssStyles = []; |
| let stylesheetOnlyChange = !!stylesheets; |
| if (!stylesheets) |
| stylesheets = this.document.styleSheets; |
| - for (let stylesheet of stylesheets) |
| + try |
| { |
| - // Explicitly ignore third-party stylesheets to ensure consistent behavior |
| - // between Firefox and Chrome. |
| - if (!this.isSameOrigin(stylesheet)) |
| - continue; |
| + for (let stylesheet of stylesheets) |
| + { |
| + try |
| + { |
| + // Explicitly ignore third-party stylesheets to ensure consistent behavior |
|
kzar
2017/11/03 10:20:50
Nit: This line is too long, did you check the code
|
| + // between Firefox and Chrome. |
| + if (!this.isSameOrigin(stylesheet)) |
| + continue; |
| + |
| + let rules = stylesheet.cssRules; |
| + if (!rules) |
| + continue; |
| - let rules = stylesheet.cssRules; |
| - if (!rules) |
| - continue; |
| + for (let rule of rules) |
| + { |
| + if (rule.type != rule.STYLE_RULE) |
| + continue; |
| - for (let rule of rules) |
| - { |
| - if (rule.type != rule.STYLE_RULE) |
| - continue; |
| - |
| - cssStyles.push(stringifyStyle(rule)); |
| + cssStyles.push(stringifyStyle(rule)); |
| + } |
| + } |
| + catch (e) |
| + { |
| + // On Firefox we seem to get a InvalidAccessError when |
|
kzar
2017/11/03 10:20:50
Nit: "...get an...".
|
| + // accessing the stylesheet under some circumstances. |
| + } |
| } |
| } |
| + catch (e) |
| + { |
| + // On Firefox we seem to get a InvalidAccessError when |
|
kzar
2017/11/03 10:20:50
Maybe combine these two identical comments and add
|
| + // enumerating the stylesheet under some circumstances. |
| + } |
| let patterns = this.patterns.slice(); |
| let pattern = null; |
| let generator = null; |
| let processPatterns = () => |
| { |
| let cycleStart = performance.now(); |