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

Uncaught TypeError: data.indexOf is not a function in _handle_msg_from_outside method in host.js #21

Open
joeyaza opened this issue Nov 21, 2018 · 5 comments

Comments

@joeyaza
Copy link

joeyaza commented Nov 21, 2018

I get the above error as it expects data to be a string but in my case is coming in as an object from the PostMessage. And running .indexOf on a non-string throws an error.
Is there any way to counter this?
potentially, data could be stringified so its certain to be a string? or typeof data could be ascertained prior to make sure it is a string before running the indexOf method..

@seansd-zz
Copy link
Collaborator

Yeah the code was written before automatic JSON parsing of objects sent via postMessage started happening. Since the communication protocol is always expected to be a string internally I would do a typeof check and then reject the message if it's not a string.

@joeyaza
Copy link
Author

joeyaza commented Nov 22, 2018

shall I change and make a PR ?

@seansd-zz
Copy link
Collaborator

sure go for it

@kevingilbert100
Copy link

Any update here?

@hotbrainy
Copy link

I have same issue. how can it be solve?

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

No branches or pull requests

4 participants