You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2022/05/13 18:28:09 UTC

[netbeans-html4j] branch master updated (d9dd994e -> 013a1185)

This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-html4j.git


    from d9dd994e Copy all the annotation attributes when patching the class file
     new a39be9d0 Java callback can be executed immediatelly, just then has to be delayed
     new 013a1185 Search JavaScriptTCK via ServiceProvider

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/net/java/html/js/tests/AsyncJavaTest.java |  6 +----
 .../main/java/net/java/html/js/tests/JsUtils.java  | 27 ++++++++++++++++++----
 2 files changed, 23 insertions(+), 10 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[netbeans-html4j] 02/02: Search JavaScriptTCK via ServiceProvider

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-html4j.git

commit 013a118589c4cc708de48a4873e53953d0a32764
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Fri May 13 20:27:26 2022 +0200

    Search JavaScriptTCK via ServiceProvider
---
 .../main/java/net/java/html/js/tests/JsUtils.java  | 27 ++++++++++++++++++----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/json-tck/src/main/java/net/java/html/js/tests/JsUtils.java b/json-tck/src/main/java/net/java/html/js/tests/JsUtils.java
index 2a262480..a370f1bf 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/JsUtils.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/JsUtils.java
@@ -19,6 +19,8 @@
 package net.java.html.js.tests;
 
 import java.io.StringReader;
+import java.util.ServiceLoader;
+import net.java.html.json.Models;
 import org.netbeans.html.boot.spi.Fn;
 import org.netbeans.html.json.tck.JavaScriptTCK;
 
@@ -32,6 +34,20 @@ public class JsUtils {
         instantiatedJsTCK = tck;
     }
 
+    private static Iterable<JavaScriptTCK> tcks(Class<?> clazz) {
+        if (instantiatedJsTCK != null) {
+            return Models.asList(instantiatedJsTCK);
+        }
+        return ServiceLoader.load(JavaScriptTCK.class, cl(clazz));
+    }
+    private static ClassLoader cl(Class<?> c) {
+        try {
+            return c.getClassLoader();
+        } catch (SecurityException ex) {
+            return null;
+        }
+    }
+
     static void execute(Class<?> clazz, String script) throws Exception {
         Fn.Presenter p = Fn.activePresenter();
         p.loadScript(new StringReader(script));
@@ -39,12 +55,13 @@ public class JsUtils {
 
     static boolean executeNow(Class<?> clazz, String script) {
         try {
-            if (instantiatedJsTCK != null) {
-                return instantiatedJsTCK.executeNow(script);
-            } else {
-                execute(clazz, script);
-                return true;
+            for (JavaScriptTCK j : tcks(clazz)) {
+                if (j.executeNow(script)) {
+                    return true;
+                }
             }
+            execute(clazz, script);
+            return true;
         } catch (Exception ex) {
             throw raise(RuntimeException.class, ex);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[netbeans-html4j] 01/02: Java callback can be executed immediatelly, just then has to be delayed

Posted by jt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-html4j.git

commit a39be9d0bf05d57bcb04e61073ef3c8bd5c25db7
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Fri May 13 20:06:05 2022 +0200

    Java callback can be executed immediatelly, just then has to be delayed
---
 json-tck/src/main/java/net/java/html/js/tests/AsyncJavaTest.java | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaTest.java b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaTest.java
index e3c29776..3abe6797 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaTest.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaTest.java
@@ -18,9 +18,7 @@
  */
 package net.java.html.js.tests;
 
-import net.java.html.js.JavaScriptBody;
 import static net.java.html.js.tests.JavaScriptBodyTest.assertEquals;
-import static net.java.html.js.tests.JavaScriptBodyTest.assertFalse;
 import net.java.html.json.tests.PhaseExecutor;
 import org.netbeans.html.json.tck.KOTest;
 
@@ -32,12 +30,10 @@ public class AsyncJavaTest {
         PhaseExecutor.schedule(phases, () -> {
             boolean[] javaExecuted = { false };
             Object objWithX = AsyncJava.computeInAsyncJava(5, (n) -> {
-                javaExecuted[0] = true;
                 return new Factorial().factorial(n);
             }, () -> {});
             int initialValue = Bodies.readIntX(objWithX);
-            assertFalse(javaExecuted[0], "Java code shall only be called when the JavaScript ends");
-            assertEquals(-1, initialValue, "Promise shall only be resolved 1when the JavaScript ends");
+            assertEquals(-1, initialValue, "Promise.then shall only be called when the code ends");
             return objWithX;
         }).then((objWithX) -> {
             int result = Bodies.readIntX(objWithX);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists