1.1 --- a/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java Wed Dec 17 07:19:50 2014 +0100
1.2 +++ b/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java Wed Dec 17 16:24:00 2014 +0100
1.3 @@ -343,7 +343,7 @@
1.4 conv = ((AbstractFXPresenter)presenter()).convertArrays(arr);
1.5 }
1.6 if (conv != null && keepAlive != null &&
1.7 - !keepAlive[i] && !(conv instanceof JSObject) &&
1.8 + !keepAlive[i] && !isJSReady(conv) &&
1.9 !conv.getClass().getSimpleName().equals("$JsCallbacks$") // NOI18N
1.10 ) {
1.11 conv = new Weak(conv);
1.12 @@ -372,6 +372,25 @@
1.13 }
1.14 }
1.15
1.16 + private static boolean isJSReady(Object obj) {
1.17 + if (obj == null) {
1.18 + return true;
1.19 + }
1.20 + if (obj instanceof String) {
1.21 + return true;
1.22 + }
1.23 + if (obj instanceof Number) {
1.24 + return true;
1.25 + }
1.26 + if (obj instanceof JSObject) {
1.27 + return true;
1.28 + }
1.29 + if (obj instanceof Character) {
1.30 + return true;
1.31 + }
1.32 + return false;
1.33 + }
1.34 +
1.35 private static final class Weak extends WeakReference<Object> {
1.36 public Weak(Object referent) {
1.37 super(referent);
2.1 --- a/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Wed Dec 17 07:19:50 2014 +0100
2.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/Bodies.java Wed Dec 17 16:24:00 2014 +0100
2.3 @@ -91,10 +91,10 @@
2.4 @JavaScriptBody(args = { "o", "x" }, keepAlive = false, body = "o.x = x;")
2.5 public static native Object setX(Object o, Object x);
2.6
2.7 - @JavaScriptBody(args = { "c" }, keepAlive = false, javacall = true, body =
2.8 - "return c.@net.java.html.js.tests.Sum::sum(II)(40, 2);"
2.9 + @JavaScriptBody(args = { "c", "a", "b" }, keepAlive = false, javacall = true, body =
2.10 + "return c.@net.java.html.js.tests.Sum::sum(II)(a, b);"
2.11 )
2.12 - public static native int sumIndirect(Sum c);
2.13 + public static native int sumIndirect(Sum c, int a, int b);
2.14
2.15 @JavaScriptBody(args = { "arr", "index" }, body = "return arr[index];")
2.16 public static native Object select(Object[] arr, int index);
3.1 --- a/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java Wed Dec 17 07:19:50 2014 +0100
3.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java Wed Dec 17 16:24:00 2014 +0100
3.3 @@ -60,7 +60,7 @@
3.4 return;
3.5 }
3.6 Sum s = new Sum();
3.7 - int res = Bodies.sumIndirect(s);
3.8 + int res = Bodies.sumIndirect(s, 22, 20);
3.9 assert res == 42 : "Expecting 42";
3.10 Reference<?> ref = new WeakReference<Object>(s);
3.11 s = null;
4.1 --- a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Wed Dec 17 07:19:50 2014 +0100
4.2 +++ b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java Wed Dec 17 16:24:00 2014 +0100
4.3 @@ -213,7 +213,7 @@
4.4
4.5 @KOTest public void callbackWithParameters() throws InterruptedException {
4.6 Sum s = new Sum();
4.7 - int res = Bodies.sumIndirect(s);
4.8 + int res = Bodies.sumIndirect(s, 40, 2);
4.9 assert res == 42 : "Expecting 42";
4.10 }
4.11