Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/content/elemHideEmulation.js

Issue 29590629: Issue 5956 - Catch exception when enumerating stylesheets (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Oct. 27, 2017, 11:27 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/content/elemHideEmulation.js
===================================================================
--- a/lib/content/elemHideEmulation.js
+++ b/lib/content/elemHideEmulation.js
@@ -406,35 +406,44 @@
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)
+ {
+ // 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)
- {
- if (rule.type != rule.STYLE_RULE)
+ let rules = stylesheet.cssRules;
+ 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)
+ {
+ // Make sure to not interrupt.
+ // On Firefox we seem to get a InvalidAccessError when
+ // enumerating the stylesheets.
+ }
let patterns = this.patterns.slice();
let pattern = null;
let generator = null;
let processPatterns = () =>
{
let cycleStart = performance.now();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld