From b2eb085f8bd0b0fd07e8482e3ec782d68aaf3bac Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 11 Dec 2011 12:21:34 -0800 Subject: [PATCH] Fixes ticket #61 - adds catches where necessary to handle errors thrown only by IE. --- src/main/resources/tunnel.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/resources/tunnel.js b/src/main/resources/tunnel.js index 6003ac3..618734e 100644 --- a/src/main/resources/tunnel.js +++ b/src/main/resources/tunnel.js @@ -223,8 +223,15 @@ Guacamole.HTTPTunnel = function(tunnelURL) { return; } + // Attempt to read status + var status; + try { status = xmlhttprequest.status; } + + // If status could not be read, assume successful. + catch (e) { status = 200; } + // Start next request as soon as possible IF request was successful - if (xmlhttprequest.readyState >= 2 && nextRequest == null && xmlhttprequest.status == 200) + if (xmlhttprequest.readyState >= 2 && nextRequest == null && status == 200) nextRequest = makeRequest(); // Parse stream when data is received and when complete. @@ -261,7 +268,12 @@ Guacamole.HTTPTunnel = function(tunnelURL) { return; } - var current = xmlhttprequest.responseText; + // Attempt to read in-progress data + var current; + try { current = xmlhttprequest.responseText; } + + // Do not attempt to parse if data could not be read + catch (e) { return; } // While search is within currently received data while (elementEnd < current.length) { -- 1.7.10.4