-
Notifications
You must be signed in to change notification settings - Fork 572
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
Fixes issue fetching font css when cssRules are inaccessilbe #384
Conversation
When cssRules are inaccessible in a style sheet, getCSSRules will throw an exception trying to read them, and then the catch handler will fetch the css. But, when it goes to insert the rule, it has a bug where it uses sheet.cssRules.length, which causes an exception again and the rules are lost. This results in the error: Error inlining remote css file SecurityError: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules This is referenced in a few issues such as issue bubkoo#49.
💖 Thanks for opening this pull request! 💖 Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #384 +/- ##
=======================================
Coverage 62.93% 62.93%
=======================================
Files 10 10
Lines 580 580
Branches 143 143
=======================================
Hits 365 365
Misses 151 151
Partials 64 64 ☔ View full report in Codecov by Sentry. |
I ran this branch locally, and it fixed my issue reported here for the most part. The part that's not fixed is the icons, but that appears to be a separate issue. |
When can we get this PR reviewed and merged in? This bug is blocking us from adopting this package. |
+1 |
2 similar comments
+1 |
+1 |
+1! May we have this merged? Thank you so much! |
1 similar comment
+1! May we have this merged? Thank you so much! |
pls merge |
+1 |
+1 needs this issue fixed |
We need this to be merged in. |
+1 pls |
Come on, we need this. |
Why is this not merged yet? |
there is a default fix for this first get the fonts
|
This doesn't work. |
@diadal Please can you share with us your reluctance to merge? There seems some hesitation on your part but without knowing why, we're just left not knowing what is happening and whether to persevere with this library or not. |
👋 @dancrevier Congrats on merging your first pull request! 🎉🎉🎉 |
🎉 This PR is included in version 1.11.13 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes the handling of font css when cssRules are inaccessible.
Description
When cssRules are inaccessible in a style sheet, getCSSRules will throw an exception trying to read them, and then the catch handler will fetch the css. But, when it goes to insert the rule, it has a bug where it uses sheet.cssRules.length, which causes an exception again and the rules are lost.
This results in the error:
This is referenced in a few issues such as issue #49.
Motivation and Context
This fixes issues when fonts are referenced via external style sheets and the css cannot be read. The resulting image
will be missing the fonts that failed. This error is mentioned in a few issues such as #49.
Types of changes
Self Check before Merge