]> git.proxmox.com Git - mirror_novnc.git/blobdiff - tests/playback-ui.js
Work around Siemens touch panel authentication bug
[mirror_novnc.git] / tests / playback-ui.js
index 03b08fe15132b91b60048013201a37a130672b5f..1565b8ffb8ccb50db424b3c89be688e052870b1f 100644 (file)
@@ -1,12 +1,13 @@
+/* global VNC_frame_data, VNC_frame_encoding */
+
 import * as WebUtil from '../app/webutil.js';
 import RecordingPlayer from './playback.js';
 
-var frames = null;
-var encoding = null;
+let frames = null;
+let encoding = null;
 
 function message(str) {
-    console.log(str);
-    var cell = document.getElementById('messages');
+    const cell = document.getElementById('messages');
     cell.textContent += str + "\n";
     cell.scrollTop = cell.scrollHeight;
 }
@@ -21,7 +22,7 @@ function loadFile() {
     message("Loading " + fname);
 
     return new Promise(function (resolve, reject) {
-        var script = document.createElement("script");
+        const script = document.createElement("script");
         script.onload = resolve;
         script.onerror = reject;
         document.body.appendChild(script);
@@ -30,10 +31,10 @@ function loadFile() {
 }
 
 function enableUI() {
-    var iterations = WebUtil.getQueryVar('iterations', 3);
+    const iterations = WebUtil.getQueryVar('iterations', 3);
     document.getElementById('iterations').value = iterations;
 
-    var mode = WebUtil.getQueryVar('mode', 3);
+    const mode = WebUtil.getQueryVar('mode', 3);
     if (mode === 'realtime') {
         document.getElementById('mode2').checked = true;
     } else {
@@ -115,14 +116,15 @@ IterationPlayer.prototype = {
         this._nextIteration();
     },
 
-    _disconnected: function (rfb, reason, frame) {
-        if (reason) {
+    _disconnected: function (clean, frame) {
+        if (!clean) {
             this._state = 'failed';
         }
 
-        var evt = new Event('rfbdisconnected');
-        evt.reason = reason;
+        const evt = new Event('rfbdisconnected');
+        evt.clean = clean;
         evt.frame = frame;
+        evt.iteration = this._iteration;
 
         this.onrfbdisconnected(evt);
     },
@@ -134,7 +136,7 @@ function start() {
 
     const iterations = document.getElementById('iterations').value;
 
-    var mode;
+    let mode;
 
     if (document.getElementById('mode1').checked) {
         message(`Starting performance playback (fullspeed) [${iterations} iteration(s)]`);
@@ -149,7 +151,7 @@ function start() {
         message(`Iteration ${evt.number} took ${evt.duration}ms`);
     };
     player.onrfbdisconnected = function (evt) {
-        if (evt.reason) {
+        if (!evt.clean) {
             message(`noVNC sent disconnected during iteration ${evt.iteration} frame ${evt.frame}`);
         }
     };