diff options
Diffstat (limited to 'webclients/novnc/include/websock.js')
-rw-r--r-- | webclients/novnc/include/websock.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/webclients/novnc/include/websock.js b/webclients/novnc/include/websock.js index a688f76..33350df 100644 --- a/webclients/novnc/include/websock.js +++ b/webclients/novnc/include/websock.js @@ -14,16 +14,23 @@ * read binary data off of the receive queue. */ +/*jslint browser: true, bitwise: false, plusplus: false */ +/*global Util, Base64 */ + // Load Flash WebSocket emulator if needed -if (window.WebSocket) { +if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) { Websock_native = true; -} else if (window.MozWebSocket) { +} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) { Websock_native = true; window.WebSocket = window.MozWebSocket; } else { /* no builtin WebSocket so load web_socket.js */ + + // To enable debug: + // window.WEB_SOCKET_DEBUG=1; + Websock_native = false; (function () { function get_INCLUDE_URI() { @@ -34,11 +41,11 @@ if (window.WebSocket) { var start = "<script src='" + get_INCLUDE_URI(), end = "'><\/script>", extra = ""; - WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() + + window.WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() + "web-socket-js/WebSocketMain.swf"; if (Util.Engine.trident) { Util.Debug("Forcing uncached load of WebSocketMain.swf"); - WEB_SOCKET_SWF_LOCATION += "?" + Math.random(); + window.WEB_SOCKET_SWF_LOCATION += "?" + Math.random(); } extra += start + "web-socket-js/swfobject.js" + end; extra += start + "web-socket-js/web_socket.js" + end; @@ -83,7 +90,7 @@ function get_rQi() { } function set_rQi(val) { rQi = val; -}; +} function rQlen() { return rQ.length - rQi; @@ -115,6 +122,7 @@ function rQshift32() { (rQ[rQi++] ); } function rQshiftStr(len) { + if (typeof(len) === 'undefined') { len = rQlen(); } var arr = rQ.slice(rQi, rQi + len); rQi += len; return arr.map(function (num) { @@ -122,6 +130,7 @@ function rQshiftStr(len) { } function rQshiftBytes(len) { + if (typeof(len) === 'undefined') { len = rQlen(); } rQi += len; return rQ.slice(rQi-len, rQi); } |