* change rhino to 1.7.7.2
* fix: wrap java.lang.String to native string
This commit is contained in:
2
.idea/modules.xml
generated
2
.idea/modules.xml
generated
@@ -2,8 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/Auto.js.iml" filepath="$PROJECT_DIR$/Auto.js.iml" />
|
|
||||||
<module fileurl="file://E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" filepath="E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" />
|
<module fileurl="file://E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" filepath="E:\YiBin\AndroidStudioProjects\NoRootScriptDroid\Auto.js.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/NoRootScriptDroid.iml" filepath="$PROJECT_DIR$/NoRootScriptDroid.iml" />
|
||||||
<module fileurl="file://C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" filepath="C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" />
|
<module fileurl="file://C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" filepath="C:\Users\Stardust\Documents\AndroidProjects\Auto.js\NoRootScriptDroid.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/autojs/autojs.iml" filepath="$PROJECT_DIR$/autojs/autojs.iml" />
|
<module fileurl="file://$PROJECT_DIR$/autojs/autojs.iml" filepath="$PROJECT_DIR$/autojs/autojs.iml" />
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ dependencies {
|
|||||||
compile(name: 'libtermexec-release', ext: 'aar')
|
compile(name: 'libtermexec-release', ext: 'aar')
|
||||||
compile(name: 'emulatorview-release', ext: 'aar')
|
compile(name: 'emulatorview-release', ext: 'aar')
|
||||||
compile(name: 'term-debug', ext: 'aar')
|
compile(name: 'term-debug', ext: 'aar')
|
||||||
|
compile files('libs/rhino-1.7.7.2.jar')
|
||||||
compile project(path: ':common')
|
compile project(path: ':common')
|
||||||
compile project(path: ':automator')
|
compile project(path: ':automator')
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -39,6 +39,9 @@ __runtime__.bridges.setBridges({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
},
|
||||||
|
toString: function(o){
|
||||||
|
return String(o);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -67,3 +70,4 @@ require("__general__")(__runtime__, this);
|
|||||||
|
|
||||||
__importClass__(android.view.KeyEvent);
|
__importClass__(android.view.KeyEvent);
|
||||||
__importClass__(com.stardust.autojs.core.util.Shell);
|
__importClass__(com.stardust.autojs.core.util.Shell);
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
|
|||||||
@Override
|
@Override
|
||||||
public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) {
|
public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) {
|
||||||
if (staticType == String.class) {
|
if (staticType == String.class) {
|
||||||
return createNativeString(obj);
|
return getRuntime().bridges.toString(obj);
|
||||||
}
|
}
|
||||||
if (staticType == UiObjectCollection.class ) {
|
if (staticType == UiObjectCollection.class ) {
|
||||||
return getRuntime().bridges.toArray(obj);
|
return getRuntime().bridges.toArray(obj);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.stardust.autojs.core.accessibility.UiCollection;
|
|||||||
|
|
||||||
public class ScriptBridges {
|
public class ScriptBridges {
|
||||||
|
|
||||||
|
|
||||||
public interface Bridges {
|
public interface Bridges {
|
||||||
|
|
||||||
Object[] NO_ARGUMENTS = new Object[0];
|
Object[] NO_ARGUMENTS = new Object[0];
|
||||||
@@ -15,6 +16,8 @@ public class ScriptBridges {
|
|||||||
Object call(Object func, Object target, Object[] arg);
|
Object call(Object func, Object target, Object[] arg);
|
||||||
|
|
||||||
Object toArray(Object o);
|
Object toArray(Object o);
|
||||||
|
|
||||||
|
Object toString(Object obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bridges mBridges;
|
private Bridges mBridges;
|
||||||
@@ -38,4 +41,10 @@ public class ScriptBridges {
|
|||||||
checkBridges();
|
checkBridges();
|
||||||
return mBridges.toArray(c);
|
return mBridges.toArray(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Object toString(Object obj) {
|
||||||
|
checkBridges();
|
||||||
|
return mBridges.toString(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user