final Object[] args,
Function funObj)
throws JavaScriptException {
int len = args.length;
WindowWrapper ww = (WindowWrapper)thisObj;
final Window window = ww.window;
if (len < 2) {
throw Context.reportRuntimeError("invalid argument count");
}
RhinoInterpreter interp =
(RhinoInterpreter)window.getInterpreter();
final String uri = (String)NativeJavaObject.coerceType(String.class, args[0]);
Window.GetURLHandler urlHandler = null;
if (args[1] instanceof Function) {
urlHandler = new GetURLFunctionWrapper(interp, (Function)args[1], ww);
} else {
urlHandler = new GetURLObjectWrapper(interp, (NativeObject)args[1], ww);
}
final Window.GetURLHandler fw = urlHandler;
AccessControlContext acc =
((RhinoInterpreter)window.getInterpreter()).getAccessControlContext();
if (len == 2) {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run(){
window.getURL(uri, fw);
return null;
}
}, acc);
} else {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
window.getURL
(uri, fw,
(String)NativeJavaObject.coerceType(String.class, args[2]));
return null;
}
}, acc);