summaryrefslogtreecommitdiff
path: root/tests/fake.websocket.js
diff options
context:
space:
mode:
authorTim Stableford <tims@bsquare.com>2021-02-18 08:42:34 +0000
committerTim Stableford <tims@bsquare.com>2021-03-04 18:55:06 +0000
commit44d384b99c78d39601820be1890b83b35847fc7b (patch)
treed5da1b8a8b39c08dd3b69f8cf8ef7f3cf82f5880 /tests/fake.websocket.js
parent5a0cceb8156926fe125ca541adae60754ecd3698 (diff)
downloadnovnc-44d384b99c78d39601820be1890b83b35847fc7b.tar.gz
Added support for RTCDataChannel
This work is originally by Ryan Castner <castner.rr@gmail.com> and submitted as a PR here https://github.com/novnc/noVNC/pull/1362 Architecturally it is much the same except it doesn't rename a lot of variables to make this more reviewable. It also avoids unrelated changes such as replacing .onclose with an event listener, which caused numerous test failures. It also adds in ppoffice's fix to initialise the buffers. Like the original author I don't have enough time available to refactor this project to the new style event listeners. Review cleanup for RTCDataChannel support (see below) * More descriptive error when url or channel not set. * Moved websocket property check to WebSock. This had unintended consequences in the tests that required some fixup. Mostly due to some tests not always passing FakeWebsocket. FakeWebsocket also needs to set the listeners to null to be compatible with what is in thw browser and expected by the property check code. The property check code now also takes into account class prototypes for test compatibility. * Removed unreachable code. * Reverted comment. * Cleanup raw channel reference in rfb on websock close. * Use readyState to check whether a socket is open rather than assuming. * Updated RFB constructor documentation Removed an unused boolean passed to attach
Diffstat (limited to 'tests/fake.websocket.js')
-rw-r--r--tests/fake.websocket.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/fake.websocket.js b/tests/fake.websocket.js
index 4db3c59..8fb02c5 100644
--- a/tests/fake.websocket.js
+++ b/tests/fake.websocket.js
@@ -6,6 +6,10 @@ export default class FakeWebSocket {
this.binaryType = "arraybuffer";
this.extensions = "";
+ this.onerror = null;
+ this.onmessage = null;
+ this.onopen = null;
+
if (!protocols || typeof protocols === 'string') {
this.protocol = protocols;
} else {