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

Unified Diff: lib/content/elemHideEmulation.js

Issue 29723684: Issue 6382 - Catch InvalidAccessError exception when checking styles. (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Shrink the try{} block Created March 20, 2018, 2:53 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
@@ -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://issues.adblockplus.org/ticket/6382
+ continue;
kzar 2018/04/18 16:12:30 I wonder if we should check that the exception rea
hub 2018/04/18 18:48:23 The intent here is to catch the exception to not i
kzar 2018/04/19 07:29:29 Acknowledged.
+ }
+
if (!rules)
continue;
for (let rule of rules)
{
if (rule.type != rule.STYLE_RULE)
continue;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld