rodneyrehm / viewport-units-buggyfill

Making viewport units (vh|vw|vmin|vmax) work properly in Mobile Safari.
MIT License
1.59k stars 151 forks source link

Fix access denied error in internet explorer #64

Closed jabes closed 8 years ago

jabes commented 9 years ago

Fixes a bug in IE that is triggered when a call to CSSRuleList is made on a remote stylesheet

rodneyrehm commented 9 years ago

sorry for getting back to you this late (conference, out of the country, …)

Does the problem you're solving relate to this fix and if so, should we make them work the same way?

jabes commented 8 years ago

Your reply was faster than mine! Yes these are similar fixes that solve the same problem, however I would advocate you use more explicit checking rather than wrapping inside a try/catch because it's both more readable and more performant. https://stackoverflow.com/questions/3217294/javascript-try-catch-performance-vs-error-checking-code

jabes commented 8 years ago

Okay, after doing a little browser testing, it looks like Firefox also has a security issue with cross-domain stylesheets. Simply calling cssRules will throw a SecurityError so typeof is not enough. A try/catch should be used: http://stackoverflow.com/a/23613052

rodneyrehm commented 8 years ago

if you update the PR I'll try to merge it tomorrow

rodneyrehm commented 8 years ago

ping @jabes :)

jabes commented 8 years ago

Oops I forgot! Work is super hectic at the moment. I'll update the PR tomorrow I promise :)

rap2hpoutre commented 8 years ago

+1

jabes commented 8 years ago

@rodneyrehm I have made a few commits that use a try/catch to check for access permissions on css rule lists to avoid throwing security errors.

rodneyrehm commented 8 years ago

Sorry for not getting to this for so long… I sqashed the PR and merged it locally: 7a63b40. (I excluded your Remove duplicate try catch commit, though)