Consider using adoptedStyleSheets for injecting stylesheets #8151
Labels
language: javascript
Issues which require knowing JavaScript.
priority: 1 - middle
Issues which should be done at some point, but aren't that important.
It has been known for a long time that qutebrowser's current method of injecting stylesheets breaks on sites with strict Content Security Policy (#7498, #7342). Looking at how Stylus does this now (https://github.com/openstyles/stylus/blob/671c012c3d6eac770d4bfc8830a6f3b31ad08232/content/style-injector.js), they are using
document.adoptedStyleSheets
as an alternative method.I can verify that
adoptedStyleSheets
works for sites with strict CSP. It can be a good idea to use it as a fallback when the old method does not work, or maybe just drop the old method and use it everywhere - I am not aware of any downsides of theadoptedStyleSheets
way, but I am not a web dev so I may be missing something.The text was updated successfully, but these errors were encountered: