Closed gaearon closed 8 years ago
we already have something in place to deal with foreign resources: importCrossOriginLinks. We should try making that work before simply silencing something. Maybe the try-catch then becomes unnecessary?
The problem is document.styleSheets
itself throws in some cases (maybe has to do with IE permissions). How do we work around that?
it probably throws when accessing something you shouldn't. the only way I see this would work is by dopping the forEach
and going with a for () { try{ … } catch(e){} }
loop. do you want to try it out and send a PR?
Submitted as #39.
I have not tested this yet (written in browser).
I also don't like complete error swallowing, shall we at least do console.warn
?
I have made this PR (https://github.com/rodneyrehm/viewport-units-buggyfill/pull/64) which fixed this issue for me. I received this error in IE9 after calling sheet.cssRules on a remote stylesheet from inside an iframe. Since the CSSRuleList should always be an array-like object, it is better to use typeof.
fixed by merging #64
I'm getting occasional localized errors in my JS logs translating as "Access denied" from IE 11 with stacks like this:
I don't think the line numbers are very accurate, but from my understand this is caused by accessing
document.styleSheets
when some stylesheet is loaded from another host.Shall we try-catch it?