]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Catch exceptions in cursor detection.
authorJoel Martin <github@martintribe.org>
Mon, 2 Aug 2010 15:11:47 +0000 (10:11 -0500)
committerJoel Martin <github@martintribe.org>
Mon, 2 Aug 2010 15:11:47 +0000 (10:11 -0500)
If cursor Data URI scheme detection threw an exception, it would cause
canvas initialization to fail. cursor detection exceptions should just
disable local cursor change support, not cause canvas init to fail.

include/canvas.js

index 682055c4b7e3117bb0a69d4b303d2f4994b6922c..b0f7b6444d4ba23653a4eb812351e1cb56a4d2fa 100644 (file)
@@ -194,15 +194,20 @@ init: function (id) {
     for (i=0; i < 8 * 8 * 4; i++) {
         curDat.push(255);
     }
-    curSave = c.style.cursor;
-    Canvas.changeCursor(curDat, curDat, 2, 2, 8, 8);
-    if (c.style.cursor) {
-        Util.Info("Data URI scheme cursor supported");
-    } else {
-        Canvas.cursor_uri = false;
-        Util.Warn("Data URI scheme cursor not supported");
+    try {
+        curSave = c.style.cursor;
+        Canvas.changeCursor(curDat, curDat, 2, 2, 8, 8);
+        if (c.style.cursor) {
+            Util.Info("Data URI scheme cursor supported");
+        } else {
+            Canvas.cursor_uri = false;
+            Util.Warn("Data URI scheme cursor not supported");
+        }
+        c.style.cursor = curSave;
+    } catch (exc2) {
+        Util.Error("Data URI scheme cursor test exception: " + exc2);
+        conf.cursor_uri = false;
     }
-    c.style.cursor = curSave;
 
     Canvas.colourMap = [];
     Canvas.prevStyle = "";