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

Failed to read the 'contentDocument' property on older browsers => broken page #14313

Closed
3 tasks done
jlowcs opened this issue Nov 14, 2024 · 5 comments · Fixed by getsentry/rrweb#222
Closed
3 tasks done
Assignees
Labels
Package: react Issues related to the Sentry React SDK

Comments

@jlowcs
Copy link

jlowcs commented Nov 14, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react

SDK Version

8.36.0

Framework Version

react 18.3.1

Link to Sentry event

https://changeorg.sentry.io/issues/6048039184/events/9fa3cc0ed21f4efab1dd24971ce140b0/

Reproduction Example/SDK Setup

No response

Steps to Reproduce

Hard to say.

We are noticing some Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "..." errors coming from older browsers. This results in a broken page for us.

My guess is that those older browsers are throwing a SecurityError instead of returning null when accessing a iframe.contentDocument on an iframe that is hiding its content to Sentry (in this case a Stripe iframe).

This specific error is coming from this line, but there might be other instances of this accessor within the Sentry code.

Image

Expected Result

Sentry should catch that error instead of letting it bubble.

Something like this:

function getIframeContentDocument(n) {
  try {
    return n.contentDocument;
  } catch (e) {
    return null;
  }
}
const iframeDoc = getIframeContentDocument(n)

Actual Result

Error is thrown and is breaking the page.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 14, 2024
@github-actions github-actions bot added the Package: react Issues related to the Sentry React SDK label Nov 14, 2024
@mydea
Copy link
Member

mydea commented Nov 15, 2024

@billyvg / @chargome sounds reasonable to me to guard this in rrweb, what do you think? I checked and we do not use this in sentry-javascript itself, so try-catching this in rrweb sounds OK to me?

@chargome
Copy link
Member

Yep catching sounds good to me here, I'll open up a pr today

@jlowcs
Copy link
Author

jlowcs commented Nov 27, 2024

The error is still showing up on 8.40.0. Looking at the source of it, it seems to be coming from https://github.com/getsentry/rrweb. Maybe rrweb was not bumped within sentry-javascript?

@billyvg
Copy link
Member

billyvg commented Dec 4, 2024

@jlowcs Yeah it hasn't been bumped yet, will let you know when we do

@billyvg
Copy link
Member

billyvg commented Dec 10, 2024

@jlowcs This should be released now in 8.43.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react Issues related to the Sentry React SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants