Example of changing the HTML DOM structure with Java Bytecode
This commit is contained in:
commit
34ce88ee62
BIN
runtime/bicavm/browser/Window.class
Normal file
BIN
runtime/bicavm/browser/Window.class
Normal file
Binary file not shown.
5
runtime/bicavm/browser/Window.java
Normal file
5
runtime/bicavm/browser/Window.java
Normal file
@ -0,0 +1,5 @@
|
||||
package bicavm.browser;
|
||||
|
||||
public class Window{
|
||||
public static native void setTitle(String title);
|
||||
}
|
Binary file not shown.
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user