mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8186807: JSObject gets ScriptFunction when ScriptObjectMirror is expected
Reviewed-by: sundar, hannesw
This commit is contained in:
parent
25032bad54
commit
018138a79c
2 changed files with 83 additions and 1 deletions
|
@ -35,6 +35,7 @@ import java.lang.invoke.MethodHandles;
|
|||
import java.util.List;
|
||||
import jdk.dynalink.linker.support.Lookup;
|
||||
import jdk.nashorn.api.scripting.JSObject;
|
||||
import jdk.nashorn.api.scripting.ScriptObjectMirror;
|
||||
import jdk.nashorn.internal.objects.annotations.Attribute;
|
||||
import jdk.nashorn.internal.objects.annotations.Constructor;
|
||||
import jdk.nashorn.internal.objects.annotations.Function;
|
||||
|
@ -101,8 +102,13 @@ public final class NativeFunction {
|
|||
|
||||
if (self instanceof ScriptFunction) {
|
||||
return ScriptRuntime.apply((ScriptFunction)self, thiz, args);
|
||||
} else if (self instanceof JSObject) {
|
||||
} else if (self instanceof ScriptObjectMirror) {
|
||||
return ((JSObject)self).call(thiz, args);
|
||||
} else if (self instanceof JSObject) {
|
||||
final Global global = Global.instance();
|
||||
final Object result = ((JSObject) self).call(ScriptObjectMirror.wrap(thiz, global),
|
||||
ScriptObjectMirror.wrapArray(args, global));
|
||||
return ScriptObjectMirror.unwrap(result, global);
|
||||
}
|
||||
throw new AssertionError("Should not reach here");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue