jitsi / js-utils

Utilities for Jitsi JS projects
Apache License 2.0
33 stars 60 forks source link

fix(postis): do not try to parse invalid messages #47

Open paweldomas opened 3 years ago

paweldomas commented 3 years ago

There can be many different libraries or even different posis instances sending messages via postMessage, so don't try parse JSON unless it's expected to work.

saghul commented 3 years ago

Sorry I missed this. What problems do you run into, after https://github.com/jitsi/js-utils/commit/79326aaa113d1e2cd320670333653dc15f6872e6 ?

paweldomas commented 3 years ago

@saghul so the thing is that the code still tries to parse JSON even if it's not expected jitsi format and scope

saghul commented 2 years ago

Ah I had missed you changed how the event is emitted too.

I'd like to avoid that, since it would break the apps of those who are using an old version of external_api.js against a newer backend.

I know, I know, that's not something we encourage, but I'd rather not break it unless we must and it looks to me like an extra JSON.parse is not the end of the world...