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

Wrap .sheet.cssRules access in try...catch. #1693

Merged
merged 2 commits into from
Apr 7, 2019

Conversation

PaulJThompson
Copy link
Contributor

Summary

Wrap accesses to .sheet.cssRules in a try...catch block. On Firefox, this access can cause a DOMException to be thrown ('SecurityError') which interrupts the entire process. Log-and-resume to avoid it.

This PR fixes/implements the following bugs/features

Explain the motivation for making this change. What existing problem does the pull request solve?

The uncaught exception means that the entire html2canvas operation is interrupted and no image is produced. At least for our application, the cssRule can be safely ignored.

Test plan (required)

I'm still working on this. Adding a file into tests/reftests isn't working because the documents don't get cloned first before copying them.

Code formatting

Please make sure that code adheres to the project code formatting. Running npm run format will automatically format your code correctly.

Closing issues
closes #1673

@PaulJThompson
Copy link
Contributor Author

@cschramm thanks for approving my PR. However, I don't have write access to this repos. Do you?

@cschramm
Copy link

No, I just wanted to express that I run into the same issue and that the solution seems fine to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node.sheet.cssRules accessed outside of try-catch, so the thrown DOMException is uncaught
3 participants