зеркало из https://github.com/mozilla/pluotsorbet.git
Use the new override feature instead of making Connection::decode a native commenting out its body
This commit is contained in:
Родитель
ec7a97bc7a
Коммит
9021d47867
|
@ -781,8 +781,7 @@ public static String encode(String s) {
|
|||
* @return java.lang.String
|
||||
* The decoded version.
|
||||
*/
|
||||
/* This function has been replaced by a JS native */
|
||||
public native static String decode(String s); /*{
|
||||
public static String decode(String s) {
|
||||
StringBuffer result = new StringBuffer(s.length());
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < s.length();) {
|
||||
|
@ -805,7 +804,7 @@ public native static String decode(String s); /*{
|
|||
i++;
|
||||
}
|
||||
return result.toString();
|
||||
}*/
|
||||
}
|
||||
|
||||
private native boolean isAbsoluteImpl(byte[] path);
|
||||
|
||||
|
|
|
@ -700,11 +700,6 @@ Native["com/ibm/oti/connection/file/FCOutputStream.writeImpl.([BIII)V"] = functi
|
|||
fs.write(fd, byteArray.subarray(offset, offset+count));
|
||||
}
|
||||
|
||||
Native["com/ibm/oti/connection/file/Connection.decode.(Ljava/lang/String;)Ljava/lang/String;"] = function(ctx, stack) {
|
||||
var string = util.fromJavaString(stack.pop());
|
||||
stack.push(ctx.newString(decodeURIComponent(string)));
|
||||
}
|
||||
|
||||
Native["com/sun/midp/io/j2me/storage/RandomAccessStream.open.(Ljava/lang/String;I)I"] = function(ctx, stack) {
|
||||
var mode = stack.pop(), fileName = util.fromJavaString(stack.pop()), _this = stack.pop();
|
||||
|
||||
|
|
|
@ -24,3 +24,8 @@ Override.invoke = function(ctx, methodInfo) {
|
|||
}
|
||||
methodInfo.override.call(null, ctx, ctx.current().stack);
|
||||
}
|
||||
|
||||
Override["com/ibm/oti/connection/file/Connection.decode.(Ljava/lang/String;)Ljava/lang/String;"] = function(ctx, stack) {
|
||||
var string = util.fromJavaString(stack.pop());
|
||||
stack.push(ctx.newString(decodeURIComponent(string)));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче