From 7caa9c20c250eae31eb9761dfe845911429154d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Wed, 17 Sep 2014 16:31:12 +0900 Subject: [PATCH 1/2] Prevent noVNC loading error when invalid property is set on object Util.set_defaults should accommodate with missing properties to prevent 'Uncaught TypeError: Cannot read property 'call' of undefined' error. --- include/util.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/util.js b/include/util.js index c145d5a6..a6045dac 100644 --- a/include/util.js +++ b/include/util.js @@ -341,6 +341,10 @@ Util.set_defaults = function (obj, conf, defaults) { for (i = 0; i < keys.length; i++) { var setter = obj['_raw_set_' + keys[i]]; + if (!setter) { + Util.Warn('Invalid property ' + keys[i]); + continue; + } if (conf[keys[i]]) { setter.call(obj, conf[keys[i]]); From 77bd04f8338b5ccaf78e2f8e3df0400ad9908ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Wed, 17 Sep 2014 16:44:21 +0900 Subject: [PATCH 2/2] Fix invalid updateState property of RFB It was changed to `onUpdateState` in b1dee9478815b22bf5fee3ee9e44321d4bb46c91. --- tests/vnc_perf.html | 2 +- tests/vnc_playback.html | 2 +- vnc_auto.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/vnc_perf.html b/tests/vnc_perf.html index 18aba355..c439e955 100644 --- a/tests/vnc_perf.html +++ b/tests/vnc_perf.html @@ -202,7 +202,7 @@ dbgmsg(" " + enc + ": " + VNC_frame_data_multi[enc].length); } rfb = new RFB({'target': $D('VNC_canvas'), - 'updateState': updateState}); + 'onUpdateState': updateState}); rfb.testMode(send_array, VNC_frame_encoding); } diff --git a/tests/vnc_playback.html b/tests/vnc_playback.html index 9d7f31f5..b5faf93c 100644 --- a/tests/vnc_playback.html +++ b/tests/vnc_playback.html @@ -131,7 +131,7 @@ if (fname) { message("VNC_frame_data.length: " + VNC_frame_data.length); rfb = new RFB({'target': $D('VNC_canvas'), - 'updateState': updateState}); + 'onUpdateState': updateState}); } } diff --git a/vnc_auto.html b/vnc_auto.html index 53b8220c..ff376fec 100644 --- a/vnc_auto.html +++ b/vnc_auto.html @@ -198,7 +198,7 @@ 'local_cursor': WebUtil.getQueryVar('cursor', true), 'shared': WebUtil.getQueryVar('shared', true), 'view_only': WebUtil.getQueryVar('view_only', false), - 'updateState': updateState, + 'onUpdateState': updateState, 'onXvpInit': xvpInit, 'onPasswordRequired': passwordRequired}); rfb.connect(host, port, password, path);