Temasys / AdapterJS

AdapterJS Javascript Polyfill and Tools for WebRTC - Skylink WebRTC
http://skylink.io/web
Other
428 stars 100 forks source link

AJS-293: Prevent listening to messages that does not come from self to extension #288

Closed oooookk7 closed 6 years ago

oooookk7 commented 6 years ago

This resolves the issue where getUserMedia({ video: { mediaSource: "screen" } }) for chrome as it listens to all messages in the same page. Currently in the deprecated method which some apps would still be using, the extension would listen to messages from window.postMessage() and react upon it. That however is a current problem in the AdapterJS since it is listening to all messages instead of acting upon specific messages, and that causes issues for JS plugins that are using the window.postMessage() as well.

The current PR just simply listens for specific messages instead.

johache commented 6 years ago

LGTM, I just wanna make sure that the logic is : if evt.data.chromeExtensionStatus === whatever, remove the event handle and do something else, ignore the message and keep the event handler

oooookk7 commented 6 years ago

@johache yes that is the logic intended, so that we don't remove the event listener when it shouldn't.

oooookk7 commented 6 years ago

@johache so it's considered mergeable?

johache commented 6 years ago

Yep, I already approved the PR :)