summaryrefslogtreecommitdiffstats
path: root/webclients/novnc/include/websock.js
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2012-04-12 18:41:14 +0200
committerChristian Beier <dontmind@freeshell.org>2012-04-12 18:41:14 +0200
commit98f4037785246f77e544bab9196f076fe310be16 (patch)
tree9531342656a66e0963ff9b55a00db2fe3222e31d /webclients/novnc/include/websock.js
parentefcdab50cc10ad121653bfff0da441495af461d3 (diff)
downloadlibvncserver-98f4037785246f77e544bab9196f076fe310be16.zip
libvncserver-98f4037785246f77e544bab9196f076fe310be16.tar.gz
Update our copy of noVNC.
Bugfixes and support for tight encoding with zlib.
Diffstat (limited to 'webclients/novnc/include/websock.js')
-rw-r--r--webclients/novnc/include/websock.js19
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);
}
OpenPOWER on IntegriCloud