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);
}
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);
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 && args[0] != null && !args[0].equals("box") && !(Thread.currentThread() instanceof ThreadMessage))
+ if (Log.on) Log.log(XWT.class, "DEPRECATED: you should not call xwt.newBox() from the foreground thread at " +
+ Context.enter().interpreterSourceFile + ":" + Context.enter().interpreterLine);
+
Function callback = null;
for(int i=1; i<args.length; i++)
if (args[i] instanceof Function && callback == null)
} 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");