guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [1/2] incubator-guacamole-client git commit: GUACAMOLE-250: Unblock image rendering tasks if image decode fails.
Date Fri, 14 Apr 2017 21:13:25 GMT
Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 95968016c -> 8c7942c01


GUACAMOLE-250: Unblock image rendering tasks if image decode fails.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/e33408cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/e33408cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/e33408cb

Branch: refs/heads/master
Commit: e33408cbe31ee5720e15e7ee2cdc00d6c3e17937
Parents: 9596801
Author: Michael Jumper <mjumper@apache.org>
Authored: Thu Apr 13 21:58:03 2017 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Fri Apr 14 10:33:27 2017 -0700

----------------------------------------------------------------------
 .../src/main/webapp/modules/Display.js              | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/e33408cb/guacamole-common-js/src/main/webapp/modules/Display.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/Display.js b/guacamole-common-js/src/main/webapp/modules/Display.js
index 2c9ede6..be5bf6c 100644
--- a/guacamole-common-js/src/main/webapp/modules/Display.js
+++ b/guacamole-common-js/src/main/webapp/modules/Display.js
@@ -548,13 +548,20 @@ Guacamole.Display = function() {
 
         // Draw and free blob URL when ready
         var task = scheduleTask(function __display_drawBlob() {
-            layer.drawImage(x, y, image);
+
+            // Draw the image only if it loaded without errors
+            if (image.width && image.height)
+                layer.drawImage(x, y, image);
+
+            // Blob URL no longer needed
             URL.revokeObjectURL(url);
+
         }, true);
 
         // Load image from URL
         var image = new Image();
         image.onload = task.unblock;
+        image.onerror = task.unblock;
         image.src = url;
 
     };
@@ -572,11 +579,16 @@ Guacamole.Display = function() {
     this.draw = function(layer, x, y, url) {
 
         var task = scheduleTask(function __display_draw() {
-            layer.drawImage(x, y, image);
+
+            // Draw the image only if it loaded without errors
+            if (image.width && image.height)
+                layer.drawImage(x, y, image);
+
         }, true);
 
         var image = new Image();
         image.onload = task.unblock;
+        image.onerror = task.unblock;
         image.src = url;
 
     };


Mime
View raw message