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

feat: Guard against missing window.CSSStyleSheet #1088

Merged

Conversation

mydea
Copy link
Contributor

@mydea mydea commented Jan 10, 2023

We get a lot of reports from users of sentry that seem to originate from browsers where window.CSSStyleSheet is not available. See e.g. getsentry/sentry-javascript#6534

This adds a simple guard that skips stylesheet observing when this is not defined.

@mydea mydea force-pushed the fn/guard-against-cssstylesheet-rrweb branch from f558568 to f426d3e Compare January 10, 2023 13:16
Copy link
Member

@YunFeng0817 YunFeng0817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. The guard is good and I think can add it for sure. BTW, do you figure out the root cause of the error? I'm worried that this PR may not fix the bug from the root.

@YunFeng0817 YunFeng0817 requested a review from Juice10 January 12, 2023 03:49
Copy link
Contributor

@Juice10 Juice10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im surprised this is needed since the CSSStyleSheet API seems to be supported by all browsers: https://caniuse.com/mdn-api_cssstylesheet

@mydea
Copy link
Contributor Author

mydea commented Jan 12, 2023

Yeah, we thought the same, but kept getting bug reports for this. I'd say one of two things is happening:

Either A) it is somehow related to some rather obscure browser or B) something is messing with the global objects. 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.0 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants