|
5 | 5 |
|
6 | 6 | import com.stardust.autojs.BuildConfig;
|
7 | 7 | import com.stardust.autojs.core.ui.ViewExtras;
|
| 8 | +import com.stardust.autojs.rhino.NativeArrayLikeJavaObject; |
8 | 9 | import com.stardust.autojs.rhino.RhinoAndroidHelper;
|
9 | 10 | import com.stardust.autojs.rhino.TopLevelScope;
|
10 |
| -import com.stardust.autojs.runtime.ScriptRuntime; |
11 | 11 | import com.stardust.autojs.script.JavaScriptSource;
|
12 | 12 | import com.stardust.autojs.script.StringScriptSource;
|
13 | 13 | import com.stardust.automator.UiObject;
|
|
17 | 17 |
|
18 | 18 | import org.mozilla.javascript.Context;
|
19 | 19 | import org.mozilla.javascript.NativeArray;
|
20 |
| -import org.mozilla.javascript.NativeJavaObject; |
21 | 20 | import org.mozilla.javascript.Scriptable;
|
22 | 21 | import org.mozilla.javascript.ScriptableObject;
|
| 22 | +import org.mozilla.javascript.TopLevel; |
23 | 23 | import org.mozilla.javascript.commonjs.module.RequireBuilder;
|
24 | 24 | import org.mozilla.javascript.commonjs.module.provider.SoftCachingModuleScriptProvider;
|
25 | 25 |
|
26 | 26 | import java.io.File;
|
27 | 27 | import java.io.IOException;
|
28 | 28 | import java.io.Reader;
|
29 |
| -import java.util.Collection; |
30 | 29 | import java.util.Collections;
|
31 |
| -import java.util.Iterator; |
32 | 30 | import java.util.Locale;
|
33 | 31 | import java.util.concurrent.ConcurrentHashMap;
|
34 | 32 |
|
@@ -177,8 +175,8 @@ public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType
|
177 | 175 | array[i] = wrapAsJavaObject(cx, scope, collection.get(i), UiObject.class);
|
178 | 176 | }
|
179 | 177 | NativeArray nativeArray = new NativeArray(array);
|
180 |
| - nativeArray.setPrototype(new NativeJavaObject(scope, collection, staticType)); |
181 |
| - result = nativeArray; |
| 178 | + nativeArray.setPrototype(TopLevel.getBuiltinPrototype(scope, TopLevel.Builtins.Array)); |
| 179 | + result = new NativeArrayLikeJavaObject(scope, collection, staticType, nativeArray); |
182 | 180 | } else {
|
183 | 181 | result = super.wrap(cx, scope, obj, staticType);
|
184 | 182 | }
|
|
0 commit comments