2003/07/28 23:17:00
[org.ibex.core.git] / src / org / xwt / XWT.java
index 8c9debb..6055a2d 100644 (file)
@@ -31,10 +31,6 @@ public final class XWT extends JS.Obj {
             else if (!Surface.button1 && !Surface.button2 && Surface.button3) return new Integer(1);
             else return new Integer(0);
         }
-        else if (name.equals("encodeURI")) throw new Error("not implemented");
-        else if (name.equals("encodeURIComponent")) throw new Error("not implemented");
-        else if (name.equals("decodeURI")) throw new Error("not implemented");
-        else if (name.equals("decodeURIComponent")) throw new Error("not implemented");
         else return super.get(name);
     }
 
@@ -66,16 +62,9 @@ public final class XWT extends JS.Obj {
             return null;
         }});
 
-        super.put("parseFloat", new JS.Callable() { public Object call(JS.Array args) throws JS.Exn {
-            if (args.length() != 1 || args.elementAt(0) == null) return null;
-            return new Float(args.elementAt(0).toString());
-        }});
-
-        super.put("parseInt", new JS.Callable() { public Object call(JS.Array args) throws JS.Exn {
-            if (args.length() != 1 || args.elementAt(0) == null) return null;
-            return new Float(args.elementAt(0).toString());
-        }});
-
+        super.put("parseInt",xwtString.get("parseInt"));
+        super.put("parseFloat",xwtString.get("parseFloat"));
+        
         super.put("yield", new JS.Callable() { public Object call(JS.Array args) throws JS.Exn {
             sleep(0);
             return null;
@@ -270,7 +259,8 @@ public final class XWT extends JS.Obj {
                 HTTP http = new HTTP(u.toString());
                 if (Main.originAddr == null) {
                     try {
-                        Main.originAddr = InetAddress.getByName(u.getHost());
+                        Main.originHost = u.getHost();
+                        Main.originAddr = InetAddress.getByName(Main.originHost);
                     } catch (UnknownHostException e) {
                         if (Log.on) Log.log(this, "couldn't resolve " + u.getHost() + "; proceeding without permissions");
                         Main.originAddr = InetAddress.getByName("0.0.0.0");
@@ -383,6 +373,9 @@ public final class XWT extends JS.Obj {
             put("decodeURIComponent",gs.get("decodeURIComponent"));
             put("encodeURI",gs.get("encodeURI"));
             put("encodeURIComponent",gs.get("encodeURIComponent"));
+            put("escape",gs.get("escape"));
+            put("unescape",gs.get("unescape"));
+            put("fromCharCode",gs.get("stringFromCharCode"));
             setSeal(true);
         }
     }