Example of changing the HTML DOM structure with Java Bytecode

This commit is contained in:
Artur Ventura 2011-11-17 03:18:15 +00:00
commit 34ce88ee62
6 changed files with 11 additions and 7 deletions

Binary file not shown.

View File

@ -0,0 +1,5 @@
package bicavm.browser;
public class Window{
public static native void setTitle(String title);
}

Binary file not shown.

View File

@ -4,7 +4,7 @@ import bicavm.browser.Window;
public class foo{
public static void main(String[] args){
String hello = "bicavm";
String world = "changed this title";
String world = " changed this title";
Window.setTitle(hello + world);
}
}

View File

@ -940,9 +940,9 @@ DEFOP(INVOKESTATIC)
LOG("Calling " + className + " " + method.name_ref.str + method.descriptor_ref.str)
LOG("!! NATIVE !!")
if (xl.jvm.internalJNITable[className] && methodId in xl.jvm.internalJNITable[className]){
result = xl.jvm.internalJNITable[className][methodId].apply(cl,args);
result = {return_object: xl.jvm.internalJNITable[className][methodId].apply(cl,args)};
}else if (xl.jvm.JNITable[className] && methodId in xl.jvm.JNITable[className]){
result = xl.jvm.JNITable[className][methodId].apply(cl,args)
result = {return_object: xl.jvm.JNITable[className][methodId].apply(cl,args)};s
}else{
PANIC(methodId + " declared as native but not mapped");
}
@ -950,8 +950,8 @@ DEFOP(INVOKESTATIC)
}else{
result = method.invoke(args,cl);
}
if (result != undefined){
OPPUSH(result);
if (result != undefined && result.return_object!= undefined){
OPPUSH(result.return_object);
}
ENDDEF

View File

@ -51,7 +51,6 @@ function java_lang_Double_doubleToRawLongBits(d){
return new math.Long(y[0],y[1]);
}
function bicavm_browser_Window_setLocation(s){
function bicavm_browser_Window_setTitle(s){
window.document.title = javaString2JS(s);
}