Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trigger Content-Security-Policy errors due to injecting styles #465

Closed
1 task done
taion opened this issue Sep 10, 2018 · 5 comments
Closed
1 task done

Don't trigger Content-Security-Policy errors due to injecting styles #465

taion opened this issue Sep 10, 2018 · 5 comments

Comments

@taion
Copy link
Contributor

taion commented Sep 10, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Pages using react-swipeable-views with locked-down style-src should not show Content-Security-Policy errors from using react-swipeable-views.

Current Behavior

injectStyle tries to inject inline styling for old browsers. IE10 at least doesn't even support style-src, and it's likely the sufficiently old versions of Safari don't do so either.

Steps to Reproduce (for bugs)

This shows up immediately when disabling inline CSS with Content-Security-Policy,

Context

This is just a slight annoyance when using locked-down CSP for styling and using this library. I think the easiest fix (per the title) is to just try-catch the style injection.

Your Environment

Tech Version
react-swipeable-views 0.12.13
React 16.4.0
platform OS X
@oliviertassinari
Copy link
Owner

@taion Yes, I agree. Thanks for raising!

@taion
Copy link
Contributor Author

taion commented Sep 14, 2018

Okay, it turns out there's no actual exception here to catch. What do you think of adding some sort of function to disable the "style injection" behavior?

@oliviertassinari
Copy link
Owner

oliviertassinari commented Sep 22, 2018

@taion What do you think of removing this code? I think that it's time 🚀

// Support old version of iOS and IE 10.
// To be deleted in 2019.

@taion
Copy link
Contributor Author

taion commented Sep 23, 2018

I'd be all for it. It's not quite 2019 yet, though.

@oliviertassinari
Copy link
Owner

Plans are made to be changed :).

@taion taion changed the title Try-catch the style injection in injectStyle Don't trigger Content-Security-Policy errors due to injecting styles Sep 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants