mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Handle the case where f is null in "new f".
This commit is contained in:
parent
108be1837b
commit
36803eaab9
@ -1282,13 +1282,15 @@ public class ScriptRuntime {
|
||||
Function f;
|
||||
try {
|
||||
f = (Function) fun;
|
||||
if (f != null)
|
||||
return f.construct(cx, f.getParentScope(), args);
|
||||
// else fall through to error
|
||||
} catch (ClassCastException e) {
|
||||
Object[] errorArgs = { toString(fun) };
|
||||
throw Context.reportRuntimeError(cx.getMessage
|
||||
("msg.isnt.function", errorArgs));
|
||||
// fall through to error
|
||||
}
|
||||
// OPT: call construct directly?
|
||||
return f.construct(cx, f.getParentScope(), args);
|
||||
Object[] errorArgs = { toString(fun) };
|
||||
throw Context.reportRuntimeError(cx.getMessage
|
||||
("msg.isnt.function", errorArgs));
|
||||
}
|
||||
|
||||
public static Scriptable newObjectSpecial(Context cx, Object fun,
|
||||
|
@ -1282,13 +1282,15 @@ public class ScriptRuntime {
|
||||
Function f;
|
||||
try {
|
||||
f = (Function) fun;
|
||||
if (f != null)
|
||||
return f.construct(cx, f.getParentScope(), args);
|
||||
// else fall through to error
|
||||
} catch (ClassCastException e) {
|
||||
Object[] errorArgs = { toString(fun) };
|
||||
throw Context.reportRuntimeError(cx.getMessage
|
||||
("msg.isnt.function", errorArgs));
|
||||
// fall through to error
|
||||
}
|
||||
// OPT: call construct directly?
|
||||
return f.construct(cx, f.getParentScope(), args);
|
||||
Object[] errorArgs = { toString(fun) };
|
||||
throw Context.reportRuntimeError(cx.getMessage
|
||||
("msg.isnt.function", errorArgs));
|
||||
}
|
||||
|
||||
public static Scriptable newObjectSpecial(Context cx, Object fun,
|
||||
|
Loading…
Reference in New Issue
Block a user