瀏覽代碼

Catch exceptions in cursor detection.

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.
Joel Martin 15 年之前
父節點
當前提交
8171f4d818
共有 1 個文件被更改,包括 13 次插入8 次删除
  1. 13 8
      include/canvas.js

+ 13 - 8
include/canvas.js

@@ -194,15 +194,20 @@ init: function (id) {
     for (i=0; i < 8 * 8 * 4; i++) {
     for (i=0; i < 8 * 8 * 4; i++) {
         curDat.push(255);
         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.colourMap = [];
     Canvas.prevStyle = "";
     Canvas.prevStyle = "";