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

Consider using adoptedStyleSheets for injecting stylesheets #8151

Open
infmagic2047 opened this issue Mar 31, 2024 · 2 comments
Open

Consider using adoptedStyleSheets for injecting stylesheets #8151

infmagic2047 opened this issue Mar 31, 2024 · 2 comments
Labels
language: javascript Issues which require knowing JavaScript. priority: 1 - middle Issues which should be done at some point, but aren't that important.

Comments

@infmagic2047
Copy link

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 the adoptedStyleSheets way, but I am not a web dev so I may be missing something.

@The-Compiler
Copy link
Member

Oh, interesting find for sure, I wasn't aware of this!

@ulrikdem if you still use qutebrowser, and have the time, this might be one for you to look at?

@The-Compiler The-Compiler added priority: 1 - middle Issues which should be done at some point, but aren't that important. language: javascript Issues which require knowing JavaScript. labels Mar 31, 2024
@ulrikdem
Copy link
Contributor

Sorry, I am not currently using qutebrowser, and don't have the time to look into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language: javascript Issues which require knowing JavaScript. priority: 1 - middle Issues which should be done at some point, but aren't that important.
Projects
None yet
Development

No branches or pull requests

3 participants