-
Notifications
You must be signed in to change notification settings - Fork 35
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
[PLAYER-7] fix issue when destroy a not fully initialized player #66
Conversation
6395bc0
to
cc6a7f7
Compare
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.
LGTM as is, but a couple suggestions for improvment.
src/DeviceRenderer.js
Outdated
/** | ||
* if the websocket is in connecting state, | ||
* we can't destroy the instance cause object is not fully initialized | ||
*/ | ||
if (this.webRTCWebsocket.readyState !== 0) { |
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.
I think it could be a little bit cleaner to reverse the condition:
/** | |
* if the websocket is in connecting state, | |
* we can't destroy the instance cause object is not fully initialized | |
*/ | |
if (this.webRTCWebsocket.readyState !== 0) { | |
/** | |
* if the websocket is in connecting state, | |
* we can't destroy the instance cause object is not fully initialized | |
*/ | |
if (this.webRTCWebsocket.readyState === 0) { | |
return; | |
} |
I don't know if we could also add an event listener for when the socket is ready ? Maybe it's useless since the page would get closed anyway? I was thinking of something like this:
/** | |
* if the websocket is in connecting state, | |
* we can't destroy the instance cause object is not fully initialized | |
*/ | |
if (this.webRTCWebsocket.readyState !== 0) { | |
/** | |
* if the websocket is in connecting state, | |
* we can't destroy the instance cause object is not fully initialized | |
*/ | |
if (this.webRTCWebsocket.readyState === 0) { | |
this.addListener(this.webRTCWebsocket, 'open', this.destroy.bind(this), {once: true}); | |
return; | |
} |
cc6a7f7
to
cfcdfd4
Compare
cfcdfd4
to
abecc80
Compare
aeba690
into
integration/player-7-fix-issue-when-destroy-a-not-fully-initialized-player
…stroy-a-not-fully-initialized-player [PLAYER-7] fix issue when destroy a not fully initialized player
Description
When calling setupRender and destroy() in a loop destroy() destroy try to delete object not already load
see https://genymobile.atlassian.net/browse/PLAYER-7
Type of change