2002/08/16 23:40:42
[org.ibex.core.git] / src / org / xwt / XWT.java
index 33d7788..1d2326d 100644 (file)
@@ -65,6 +65,10 @@ public final class XWT extends JSObject {
         else if (name.equals("math")) return org.xwt.util.JSObject.defaultObjects.get("Math", null);
         else if (name.equals("loadArchive")) return loadArchive;
         else if (name.equals("prefetchImage")) return prefetchImage;
+        else if (name.equals("encodeURI")) return JSObject.defaultObjects.get("encodeURI", null);
+        else if (name.equals("encodeURIComponent")) return JSObject.defaultObjects.get("encodeURIComponent", null);
+        else if (name.equals("decodeURI")) return JSObject.defaultObjects.get("decodeURI", null);
+        else if (name.equals("decodeURIComponent")) return JSObject.defaultObjects.get("decodeURIComponent", null);
         else return super.get(name, start);
     }
 
@@ -74,11 +78,9 @@ public final class XWT extends JSObject {
         else if (name.equals("clipboard")) Platform.setClipBoard(value.toString());
 
         // FIXME: undocumented, possibly insecure
-        else if (name.equals("proxyAuthorization")) try {
-            HTTP.ProxyAuthorization.authorization = "Basic " + new String(Base64.encode(value.toString().getBytes("US-ASCII")));
-            HTTP.ProxyAuthorization.waitingForUser.release();
-        } catch (UnsupportedEncodingException e) {
-            if (Log.on) Log.log(this, e);
+        else if (name.equals("proxyAuthorization")) {
+            Proxy.Authorization.authorization = value.toString();
+            Proxy.Authorization.waitingForUser.release();
         }
 
         else super.put(name, start, value);
@@ -196,6 +198,10 @@ public final class XWT extends JSObject {
     private static final JSObject.JSFunction newBox = new JSObject.JSFunction() {
             public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException {
 
+                if (args.length > 0)
+                    if (Log.on) Log.log(XWT.class, "DEPRECATED: xwt.newBox() with multiple arguments is deprecated; use xwt.newBox().apply() " +
+                                        Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine);
+
                 Function callback = null;
                 for(int i=1; i<args.length; i++)
                     if (args[i] instanceof Function && callback == null)
@@ -374,8 +380,9 @@ public final class XWT extends JSObject {
                         } else {
                             Main.originAddr = InetAddress.getByName("0.0.0.0");
                         }
-                        Resources.loadArchive(http.getInputStream(), (int)http.getContentLength(), callback);
-                        
+                        HTTP.HTTPInputStream in = http.GET();
+                        Resources.loadArchive(in, in.getContentLength(), callback);
+
                     } else if (u.getProtocol().equals("file")) {
                         if (Main.originAddr != null) {
                             if (Log.on) Log.log(this, "scripts downloaded from the network may not load xwars from the local filesystem");