mirror of
https://github.com/novnc/noVNC.git
synced 2026-05-26 07:08:06 +00:00
Previously, setting `innerHTML` was used to display the statuses. These could include content communicated from the remote VNC server, allowing the remove VNC server to inject HTML into the noVNC page. This commit switches all uses of `innerHTML` to use `textContent`, which is not vulnerable to the HTML injection.
135 lines
4.6 KiB
HTML
135 lines
4.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>VNC Playback</title>
|
|
</head>
|
|
<body>
|
|
|
|
Iterations: <input id='iterations' style='width:50'>
|
|
Perftest:<input type='radio' id='mode1' name='mode' checked>
|
|
Realtime:<input type='radio' id='mode2' name='mode'>
|
|
|
|
<input id='startButton' type='button' value='Start' style='width:100px'
|
|
onclick="start();" disabled>
|
|
|
|
<br><br>
|
|
|
|
Results:<br>
|
|
<textarea id="messages" style="font-size: 9;" cols=80 rows=25></textarea>
|
|
|
|
<br><br>
|
|
|
|
<div id="VNC_screen">
|
|
<div id="VNC_status_bar" class="VNC_status_bar" style="margin-top: 0px;">
|
|
<table border=0 width=100%><tr>
|
|
<td><div id="VNC_status">Loading</div></td>
|
|
</tr></table>
|
|
</div>
|
|
<canvas id="VNC_canvas" width="640px" height="20px">
|
|
Canvas not supported.
|
|
</canvas>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<!--
|
|
<script type='text/javascript'
|
|
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
|
-->
|
|
|
|
<script type="text/javascript">
|
|
var INCLUDE_URI= "../";
|
|
</script>
|
|
<script src="../core/util.js"></script>
|
|
<script src="../app/webutil.js"></script>
|
|
|
|
<script>
|
|
var fname, start_time;
|
|
|
|
function message(str) {
|
|
console.log(str);
|
|
var cell = document.getElementById('messages');
|
|
cell.textContent += str + "\n";
|
|
cell.scrollTop = cell.scrollHeight;
|
|
}
|
|
|
|
fname = WebUtil.getQueryVar('data', null);
|
|
if (fname) {
|
|
message("Loading " + fname);
|
|
// Load supporting scripts
|
|
WebUtil.load_scripts({
|
|
'core': ["base64.js", "websock.js", "des.js", "input/keysym.js",
|
|
"input/keysymdef.js", "input/xtscancodes.js", "input/util.js",
|
|
"input/devices.js", "display.js", "rfb.js", "inflator.js"],
|
|
'tests': ["playback.js"],
|
|
'recordings': [fname]});
|
|
|
|
} else {
|
|
message("Must specify data=FOO in query string.");
|
|
}
|
|
|
|
disconnected = function (rfb, reason) {
|
|
if (reason) {
|
|
message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
|
|
test_state = 'failed';
|
|
}
|
|
}
|
|
|
|
notification = function (rfb, mesg, level, options) {
|
|
document.getElementById('VNC_status').textContent = mesg;
|
|
}
|
|
|
|
function start() {
|
|
document.getElementById('startButton').value = "Running";
|
|
document.getElementById('startButton').disabled = true;
|
|
|
|
iterations = document.getElementById('iterations').value;
|
|
iteration = 0;
|
|
start_time = (new Date()).getTime();
|
|
|
|
if (document.getElementById('mode1').checked) {
|
|
message("Starting performance playback (fullspeed) [" + iterations + " iteration(s)]");
|
|
mode = 'perftest';
|
|
} else {
|
|
message("Starting realtime playback [" + iterations + " iteration(s)]");
|
|
mode = 'realtime';
|
|
}
|
|
|
|
//recv_message = rfb.testMode(send_array, VNC_frame_encoding);
|
|
|
|
next_iteration();
|
|
}
|
|
|
|
function finish() {
|
|
// Finished with all iterations
|
|
var total_time, end_time = (new Date()).getTime();
|
|
total_time = end_time - start_time;
|
|
|
|
iter_time = parseInt(total_time / iterations, 10);
|
|
message(iterations + " iterations took " + total_time + "ms, " +
|
|
iter_time + "ms per iteration");
|
|
// Shut-off event interception
|
|
rfb.get_mouse().ungrab();
|
|
rfb.get_keyboard().ungrab();
|
|
document.getElementById('startButton').disabled = false;
|
|
document.getElementById('startButton').value = "Start";
|
|
|
|
}
|
|
|
|
window.onscriptsload = function () {
|
|
iterations = WebUtil.getQueryVar('iterations', 3);
|
|
document.getElementById('iterations').value = iterations;
|
|
mode = WebUtil.getQueryVar('mode', 3);
|
|
if (mode === 'realtime') {
|
|
document.getElementById('mode2').checked = true;
|
|
} else {
|
|
document.getElementById('mode1').checked = true;
|
|
}
|
|
if (fname) {
|
|
message("VNC_frame_data.length: " + VNC_frame_data.length);
|
|
}
|
|
document.getElementById('startButton').disabled = false;
|
|
}
|
|
</script>
|
|
</html>
|