Files
dotcom-arcade/streaming/streamer/jsobject/netscape/javascript/JSObject.java
T
branderson dca48bce51 Run applets that use LiveConnect or load images through the proxy
appletviewer has no netscape.javascript.JSObject, so applets that touch
JavaScript fail to load, and Java 8 denies applets the URLPermission they
need to fetch through an HTTP proxy. Add a JSObject stand-in with a working
document.cookie and a policy granting HTTP URL access.
2026-10-11 00:07:06 -07:00

54 lines
1.3 KiB
Java

package netscape.javascript;
import java.applet.Applet;
import java.util.HashMap;
import java.util.Map;
/**
* Stand-in for the browser's LiveConnect bridge, which appletviewer lacks. The
* window holds a document with a working cookie; calls into JavaScript do nothing.
*/
public class JSObject {
private static JSObject window;
private final Map<String, Object> members = new HashMap<String, Object>();
protected JSObject() {
}
public static synchronized JSObject getWindow(Applet applet) throws JSException {
if (window == null) {
window = new JSObject();
window.setMember("document", new Document());
}
return window;
}
public Object call(String methodName, Object[] args) throws JSException {
return null;
}
public Object eval(String s) throws JSException {
return null;
}
public Object getMember(String name) throws JSException {
return members.get(name);
}
public void setMember(String name, Object value) throws JSException {
members.put(name, value);
}
public void removeMember(String name) throws JSException {
members.remove(name);
}
public Object getSlot(int index) throws JSException {
return null;
}
public void setSlot(int index, Object value) throws JSException {
}
}