2003/11/29 03:06:08
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:42:18 +0000 (07:42 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:42:18 +0000 (07:42 +0000)
darcs-hash:20040130074218-2ba56-4287acc3d049c2762eb4039b7326b4101ccb7506.gz

src/org/xwt/Box.java
src/org/xwt/Font.java
src/org/xwt/HTTP.java
src/org/xwt/Main.java

index ebd3d85..2adac17 100644 (file)
@@ -364,7 +364,7 @@ public final class Box extends JSScope {
     public Enumeration keys() { throw new Error("you cannot apply for..in to a " + this.getClass().getName()); }
 
     protected boolean isTrappable() { return true; }
-    public Object get(Object name) {
+    public Object get(Object name) throws JSExn {
         if (name instanceof Number)
             return redirect == null ? null : redirect == this ? getChild(toInt(name)) : redirect.get(name);
 
@@ -412,7 +412,7 @@ public final class Box extends JSScope {
         throw new Error("unreachable"); // unreachable
     }
 
-    public void put(Object name, Object value) {
+    public void put(Object name, Object value) throws JSExn {
         if (name instanceof Number) { put(toInt(name), value); return; }
         //#switch(name)
         case "text": CHECKSET_STRING(text); MARK_RESIZE; dirty();
@@ -670,7 +670,7 @@ public final class Box extends JSScope {
         putAndTriggerTraps("childremoved", b);
     }
     
-    public void put(int i, Object value) {
+    public void put(int i, Object value) throws JSExn {
         if (i < 0) return;
             
         if (value != null && !(value instanceof Box)) {
@@ -727,6 +727,25 @@ public final class Box extends JSScope {
         }
     }
 
+
+    public final void putAndTriggerTraps(Object key, Object value) {
+        try {
+            super.putAndTriggerTraps(key, value);
+        } catch (JSExn jse) {
+            Log.logJS("attempt to put value " + value + " to key " + key + " on a box triggered a trap which threw:");
+            Log.logJS(jse);
+        }
+    }
+
+    public final Object getAndTriggerTraps(Object key) {
+        try {
+            return super.getAndTriggerTraps(key);
+        } catch (JSExn jse) {
+            Log.logJS("attempt to get key " + key + " on a box triggered a trap which threw:");
+            Log.logJS(jse);
+            return null;
+        }
+    }
 }
 
 
index 0de8204..e14727f 100644 (file)
@@ -71,13 +71,14 @@ public class Font {
             }
         }
 
-        if (encounteredUnrenderedGlyph && callback != null) Scheduler.add(new Scheduler.Task() { public void perform() {
-            for(int i=0; i<text.length(); i++) {
-                Glyph g = glyphs[text.charAt(i)];
-                if (g == null || g.p == null) { Scheduler.add(this); return; }
-            }
-            callback.perform();
-        }});
+        if (encounteredUnrenderedGlyph && callback != null) Scheduler.add(new Scheduler.Task() {
+                public void perform() throws Exception{
+                    for(int i=0; i<text.length(); i++) {
+                        Glyph g = glyphs[text.charAt(i)];
+                        if (g == null || g.p == null) { Scheduler.add(this); return; }
+                    }
+                    callback.perform();
+                }});
         if (!latinCharsPreloaded) {
             for(int i=48; i<57; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
             for(int i=32; i<47; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
index 98f9397..e82e23c 100644 (file)
@@ -844,7 +844,7 @@ public class HTTP {
 
             public ProxyAutoConfigRootJSScope() { super(); }
         
-            public Object get(Object name) {
+            public Object get(Object name) throws JSExn {
                 if (name.equals("isPlainHostName")) return isPlainHostName;
                 else if (name.equals("dnsDomainIs")) return dnsDomainIs;
                 else if (name.equals("localHostOrDomainIs")) return localHostOrDomainIs;
index 09f1b31..939922c 100644 (file)
@@ -82,7 +82,7 @@ public class Main {
 
         scarHolder =
             Picture.fromRes((Res)Main.builtin.get("org/xwt/builtin/scar.png"),
-                        new Scheduler.Task() { public void perform() {
+                        new Scheduler.Task() { public void perform() throws JSExn {
                             scarImage = scarHolder.picture;
                             Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new Box(), xwt);
                         } });