Commit 8759ea6f authored by Joel Martin's avatar Joel Martin

Status/error refactor. Fix firefox bugs.

- All state/status updates go through updateState routine which
  updates the status line also.

- Old firefox (and opera) don't support canvas createImageData, so use
  getImageData as replacement.

- Add console.warn and console.error stubs so that firefox without
  firebug doesn't crap out.

- If no WebSockets then error if no flash or if URL is location (flash
  will refuse to load the object for security reasons).
parent 07f6ca75
- Make packet sequence number optional based on WebSockets 'path'.
- Better status and error feedback.
- Add WSS/https/SSL support to page and wsproxy.py
- Make C version of wsproxy.py
......
......@@ -8,6 +8,11 @@
</canvas>
</body>
<!--
<script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
<script src="include/mootools.js"></script>
<script src="include/util.js"></script>
<script src="canvas.js"></script>
......
......@@ -121,7 +121,8 @@ draw: function () {
*/
/* Test array image data */
var img = Canvas.ctx.createImageData(50, 50);
//var img = Canvas.ctx.createImageData(50, 50);
var img = Canvas.ctx.getImageData(0, 0, 50, 50);
for (y=0; y< 50; y++) {
for (x=0; x< 50; x++) {
img.data[(y*50 + x)*4 + 0] = 255 - parseInt((255 / 50) * y);
......@@ -134,7 +135,8 @@ draw: function () {
},
rgbxImage: function(x, y, width, height, arr) {
var img = Canvas.ctx.createImageData(width, height);
/* Old firefox and Opera don't support createImageData */
var img = Canvas.ctx.getImageData(0, 0, width, height);
for (var i=0; i < (width * height); i++) {
img.data[i*4 + 0] = arr[i*4 + 0];
img.data[i*4 + 1] = arr[i*4 + 1];
......
......@@ -2,6 +2,8 @@ if ((!window.console) || (! /__debug__$/i.test(document.location.href))) {
// non-debug mode, an empty function
window.console = window.console || {};
window.console.log = function(message) {};
window.console.warn = function(message) {};
window.console.error = function(message) {};
}
function dirObj(obj, depth, parent) {
......
......@@ -7,11 +7,11 @@
Host: <input id='host' style='width:100'>&nbsp;
Port: <input id='port' style='width:50'>&nbsp;
Password: <input id='password' type='password' style='width:80'>&nbsp;
<input id='connectButton' type='button' value='Connect' style='width:100px'
onclick="RFB.connect();">&nbsp;
<input id='connectButton' type='button' value='Loading'
style='width:100px' disabled>&nbsp;
<br><br>
<div id='status'>Disconnected</div>
<div id='status'>Loading</div>
<canvas id="vnc" width="640" height="20"
style="border-style: dotted; border-width: 1px;">
Canvas not supported.
......@@ -27,6 +27,11 @@
onblur="RFB.clipboardFocus=false;"></textarea>
</body>
<!--
<script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
<script src="include/mootools.js"></script>
<script src="include/base64.js"></script>
<script src="include/des.js"></script>
......@@ -50,15 +55,26 @@
console.log("onload");
if (native_ws) {
console.log("Using native WebSockets");
RFB.updateState('disconnected', 'Disconnected');
} else {
console.log("Using web-socket-js flash bridge");
WebSocket.__swfLocation = "web-socket-js/WebSocketMain.swf";
RFB.force_copy = true;
if ((! Browser.Plugins.Flash) ||
(Browser.Plugins.Flash.version < 9)) {
RFB.updateState('failed', "WebSockets or Adobe Flash is required");
} else if (location.href.substr(0, 7) == "file://") {
RFB.updateState('failed', "'file://' URL is incompatible with Adobe Flash");
} else {
WebSocket.__swfLocation = "include/web-socket-js/WebSocketMain.swf";
RFB.force_copy = true;
RFB.updateState('disconnected', 'Disconnected');
}
}
if (RFB.state == 'disconnected') {
var url = document.location.href;
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
$('password').value = (url.match(/password=([^&#]*)/) || ['',''])[1];
}
var url = document.location.href;
$('host').value = (url.match(/host=([^&#]*)/) || ['',''])[1];
$('port').value = (url.match(/port=([^&#]*)/) || ['',''])[1];
$('password').value = (url.match(/password=([^&#]*)/) || ['',''])[1];
}
</script>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment