зеркало из https://github.com/mozilla/pjs.git
Handle the case where f is null in "new f".
This commit is contained in:
Родитель
c425481936
Коммит
3bc469d6ab
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче