tomhodgins / deqaf

Decaffeinate CSS stylesheets client-side
MIT License
30 stars 0 forks source link

SecurityError in FF 68 Mac #1

Closed brandonkal closed 5 years ago

brandonkal commented 5 years ago

The issue is occuring on line 21 of index.js

Image of Error

Demo: https://codepen.io/tomhodgins/pen/aRWqro

brandonkal commented 5 years ago

After further investigation, I have identified the issue and why I was only seeing it in FF Mac. This is a CORS issue that is thrown when the code cannot read a specific stylesheet. In my case, it was caused by the Saka Key browser extension. Because deqaf is attempting to read the stylesheet injected by the extension, an error is thrown. This will also happen for stylesheets from other origins depending on the CORS configuration.

I would suggest wrapping in a try{} when attempting to read stylesheet.cssRules so it can reach the stylesheet that should be processed.

Awesome work by the way!

tomhodgins commented 5 years ago

Thanks @brandonkal, I think I know just the fix that's needed here, so I've added this: https://github.com/tomhodgins/deqaf/blob/master/index.js#L20&L28

Hopefully this new version takes care of this issue! :D

brandonkal commented 5 years ago

That did the trick. Thanks!