* change rhino to 1.7.7.2
* fix: wrap java.lang.String to native string
This commit is contained in:
@@ -39,6 +39,9 @@ __runtime__.bridges.setBridges({
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
toString: function(o){
|
||||
return String(o);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,3 +70,4 @@ require("__general__")(__runtime__, this);
|
||||
|
||||
__importClass__(android.view.KeyEvent);
|
||||
__importClass__(com.stardust.autojs.core.util.Shell);
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
|
||||
@Override
|
||||
public Object wrap(Context cx, Scriptable scope, Object obj, Class<?> staticType) {
|
||||
if (staticType == String.class) {
|
||||
return createNativeString(obj);
|
||||
return getRuntime().bridges.toString(obj);
|
||||
}
|
||||
if (staticType == UiObjectCollection.class ) {
|
||||
return getRuntime().bridges.toArray(obj);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.stardust.autojs.core.accessibility.UiCollection;
|
||||
|
||||
public class ScriptBridges {
|
||||
|
||||
|
||||
public interface Bridges {
|
||||
|
||||
Object[] NO_ARGUMENTS = new Object[0];
|
||||
@@ -15,6 +16,8 @@ public class ScriptBridges {
|
||||
Object call(Object func, Object target, Object[] arg);
|
||||
|
||||
Object toArray(Object o);
|
||||
|
||||
Object toString(Object obj);
|
||||
}
|
||||
|
||||
private Bridges mBridges;
|
||||
@@ -38,4 +41,10 @@ public class ScriptBridges {
|
||||
checkBridges();
|
||||
return mBridges.toArray(c);
|
||||
}
|
||||
|
||||
|
||||
public Object toString(Object obj) {
|
||||
checkBridges();
|
||||
return mBridges.toString(obj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user