summaryrefslogtreecommitdiff
path: root/core/rfb.js
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-04-18 13:55:11 +0200
committerPierre Ossman <ossman@cendio.se>2021-04-18 14:26:30 +0200
commitde9fc9508cb4bc6776792f0c7731da17519d4f24 (patch)
tree7c382f4e705992227930571ccd5beee7ab52fee8 /core/rfb.js
parent9376191fc4500b9001bc0dc3ff9f0e0351797319 (diff)
downloadnovnc-de9fc9508cb4bc6776792f0c7731da17519d4f24.tar.gz
Don't fake open events in Websock
We don't know if the caller is prepared to receive those events right now as normally they would get them on a fresh new stack later. We also can't delay delivery since then we might deliver the event after any pending "message" events. Better to push the problem one layer up to the caller, which now needs to be more aware of the state of the WebSocket object it is trying to use.
Diffstat (limited to 'core/rfb.js')
-rw-r--r--core/rfb.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/rfb.js b/core/rfb.js
index 2257da3..074eb51 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -484,6 +484,10 @@ export default class RFB extends EventTargetMixin {
if (this._sock.readyState === 'closed') {
this._fail("Cannot use already closed WebSocket/RTCDataChannel");
}
+
+ if (this._sock.readyState === 'open') {
+ this._socketOpen();
+ }
}
// Make our elements part of the page