-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix: set innerText instead of innerHTML #264
Conversation
I also noticed that the original demo works only in Safari but not in Chrome or Firefox: see [object Object] in the frame. |
Really? I was serving it also, so I wonder if it's to do with that. I'm using http-server: http-server -c-1
http-server --v
# v14.1.1 I'll try some other options |
I re-tested and I realized it's from Fx nightly that I get compat issues, it could be a pref I've changed, I'm not sure. Anyway, this works as expected in
Tested using both of these: cd channel-messaging-basic
http-server -c-1
# ^C
python3 -m http.server
I don't see this using the browser versions listed above, could you check again? I did get |
btw @pepelsbey, this is ready for another look when you have time. No rush 🙌🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I got distracted by the compatibility. It has been like that before this PR, so it’s irrelevant here. LGTM!
Thank you! |
Setting innerHTML from an iframe allows unsafe contents in the main page. Switching to innerText instead.
Also adding some styles so it's apparent what is the iframe in the index.html
Compat:
I've noticed this breaks in Fx, but works in Chrome and Safari. It could be down to stricter handling of targetOrigins (
*
in this case) see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#security_concerns