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 2020/12/26 14:39:55 UTC

[netbeans-html4j] branch master updated (073558a -> df94a42)

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 073558a  Improving readability by using text blocks
     new d4fe0e9  Improving readability by using text blocks
     new b7bbe85  Trigger asynchronous action in JavaScript in middle of a computation
     new 698659d  Run the asynch JavaScript action test with and without JavaScript callback
     new 6e6cca8  Separating generic TCK into its own class
     new 0ee7eb3  Flush pending JavaScript executions before checking results
     new 77213bb  Exclude nbactions.xml from license checks
     new ec3e1f3  Resolve deferred, then dispatch, then resolve deferred
     new c22532a  Iterate just 30 times to prevent overflow
     new a356785  Try harder to executeNow in asynchronous processors
     new 372b448  Process pending Java callback first
     new 5b0a977  No need to obtain for locking in exec
     new 519e4d5  Encapsulate access to deffered field
     new ae7d00a  Allow only one deferred processing before flush
     new 627e73b  Don't hold a reference to item when scheduling pending check
     new efb47ac  Close the browser window when the suite execution is over
     new ddf5059  Remove done javascript items from the stack
     new f0fe2b5  Testing on JDK15 which no longer provides Nashorn
     new e6b099d  Include graal-js as a subsitute for missing Nashorn on JDK15
     new 328c6fa  codesnippet4javadoc 0.60 works on JDK15
     new 3a4ca18  Less verbose build
     new f72cb97  Only attempt to mangle the encoding on pre-JDK11 virtual machines
     new ca2ca15  Merging with changes in master
     new 29d747d  Running on JDK15 with the help of Graal.js
     new 74c908b  Only generate Javadoc on JDK15
     new df94a42  Generate all groups in aggregate Javadoc again

The 25 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:
 .gitignore                                         |   3 +-
 .travis.yml                                        |   9 +-
 boot-script/pom.xml                                |   8 +
 .../java/net/java/html/boot/script/KOCase.java     |   2 +-
 .../java/html/boot/script/KnockoutEnvJSTest.java   |   4 +-
 .../java/html/boot/script/ScriptEngineTest.java    |   1 +
 boot/pom.xml                                       |   8 +
 .../netbeans/html/presenters/browser/Browser.java  |   2 -
 .../netbeans/html/presenters/browser/KOClose.java  |  42 +++--
 .../netbeans/html/presenters/browser/KOScript.java |   5 +-
 .../html/presenters/browser/ServerFactories.java   |   5 +-
 generic/pom.xml                                    |  10 +-
 .../org/netbeans/html/presenters/spi/Generic.java  | 198 ++++++++++++---------
 .../netbeans/html/presenters/spi/test/Case.java    |   6 +-
 .../html/presenters/spi/test/GenericTCK.java       |  77 ++++++++
 .../html/presenters/spi/test/GenericTest.java      |  25 ++-
 .../html/presenters/spi/test/SynchronizedTest.java |  36 +++-
 .../netbeans/html/presenters/spi/test/Testing.java |  34 +---
 .../java/html/js/tests/AsyncJavaScriptAction.java  |  98 ++++++++++
 .../java/net/java/html/js/tests/GCBodyTest.java    |   4 +-
 .../net/java/html/js/tests/JavaScriptBodyTest.java |  81 +++++----
 .../main/java/net/java/html/js/tests/JsUtils.java  |  56 ++++++
 .../java/net/java/html/json/tests/JSONTest.java    |  18 +-
 .../main/java/net/java/html/json/tests/Utils.java  |  51 +++---
 .../org/netbeans/html/json/tck/JavaScriptTCK.java  |  24 +++
 json/pom.xml                                       |   8 +
 .../test/java/net/java/html/json/TypesTest.java    |   1 +
 pom.xml                                            |  20 ++-
 sound/pom.xml                                      |   8 +
 29 files changed, 612 insertions(+), 232 deletions(-)
 copy webkit/src/test/java/org/netbeans/html/presenters/webkit/Skip.java => browser/src/test/java/org/netbeans/html/presenters/browser/KOClose.java (52%)
 create mode 100644 generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
 create mode 100644 json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
 create mode 100644 json-tck/src/main/java/net/java/html/js/tests/JsUtils.java


---------------------------------------------------------------------
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] 20/25: Close the browser window when the suite execution is over

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 efb47ac07a1474c4a07de3eb047e0915fe4f13d8
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 08:28:12 2020 +0100

    Close the browser window when the suite execution is over
---
 .../netbeans/html/presenters/browser/Browser.java  |  2 -
 .../netbeans/html/presenters/browser/KOClose.java  | 53 ++++++++++++++++++++++
 .../netbeans/html/presenters/browser/KOScript.java |  5 +-
 .../html/presenters/browser/ServerFactories.java   |  5 +-
 4 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/browser/src/main/java/org/netbeans/html/presenters/browser/Browser.java b/browser/src/main/java/org/netbeans/html/presenters/browser/Browser.java
index d433644..3f509d1 100644
--- a/browser/src/main/java/org/netbeans/html/presenters/browser/Browser.java
+++ b/browser/src/main/java/org/netbeans/html/presenters/browser/Browser.java
@@ -43,8 +43,6 @@ import java.util.Map;
 import java.util.Queue;
 import java.util.UUID;
 import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
 import java.util.function.Supplier;
 import java.util.logging.Level;
 import java.util.logging.Logger;
diff --git a/browser/src/test/java/org/netbeans/html/presenters/browser/KOClose.java b/browser/src/test/java/org/netbeans/html/presenters/browser/KOClose.java
new file mode 100644
index 0000000..a90d513
--- /dev/null
+++ b/browser/src/test/java/org/netbeans/html/presenters/browser/KOClose.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.html.presenters.browser;
+
+import java.util.concurrent.Executor;
+import org.netbeans.html.boot.spi.Fn;
+import org.testng.ITest;
+import org.testng.annotations.AfterSuite;
+
+public class KOClose implements ITest {
+
+    private final Fn.Presenter presenter;
+    private final String prefix;
+    private final Fn updateName;
+
+    public KOClose(Fn updateName, String prefix, Fn.Presenter presenter) {
+        this.updateName = updateName;
+        this.prefix = prefix;
+        this.presenter = presenter;
+    }
+
+    @AfterSuite
+    public void closeWindow() {
+        ((Executor)this.presenter).execute(() -> {
+            try {
+                updateName.invoke(null, getTestName(), "5s");
+            } catch (Exception ex) {
+            }
+            JavaScriptUtilities.closeSoon(5000);
+        });
+    }
+
+    @Override
+    public String getTestName() {
+        return prefix + ": Closing window";
+    }
+}
diff --git a/browser/src/test/java/org/netbeans/html/presenters/browser/KOScript.java b/browser/src/test/java/org/netbeans/html/presenters/browser/KOScript.java
index e2f5217..1f975b7 100644
--- a/browser/src/test/java/org/netbeans/html/presenters/browser/KOScript.java
+++ b/browser/src/test/java/org/netbeans/html/presenters/browser/KOScript.java
@@ -82,7 +82,7 @@ public final class KOScript implements ITest, IHookable, Runnable {
         Closeable c = Fn.activate(p);
         try {
             if (updateName != null) {
-                updateName.invoke(null, getTestName());
+                updateName.invoke(null, getTestName(), cnt);
             }
             if (inst == null) {
                 inst = m.getDeclaringClass().newInstance();
@@ -91,6 +91,9 @@ public final class KOScript implements ITest, IHookable, Runnable {
             if (result == null) {
                 result = this;
             }
+            if (updateName != null) {
+                updateName.invoke(null, getTestName(), "Done");
+            }
         } catch (InvocationTargetException ex) {
             Throwable r = ex.getTargetException();
             result = r;
diff --git a/browser/src/test/java/org/netbeans/html/presenters/browser/ServerFactories.java b/browser/src/test/java/org/netbeans/html/presenters/browser/ServerFactories.java
index 4b38321..c9233cd 100644
--- a/browser/src/test/java/org/netbeans/html/presenters/browser/ServerFactories.java
+++ b/browser/src/test/java/org/netbeans/html/presenters/browser/ServerFactories.java
@@ -70,8 +70,8 @@ public final class ServerFactories {
             loadFinished(() -> {
                 browserPresenter[0] = Fn.activePresenter();
                 updateName[0] = Fn.define(KOScript.class,
-                    "document.getElementsByTagName('h1')[0].innerHTML='" + browserName + "@' + t;",
-                    "t"
+                    "document.getElementsByTagName('h1')[0].innerHTML='" + browserName + "@' + t + '[' + s + ']';",
+                    "t", "s"
                 );
                 cdl.countDown();
             });
@@ -85,6 +85,7 @@ public final class ServerFactories {
                 }
             }
         }
+        res.add(new KOClose(updateName[0], prefix, browserPresenter[0]));
         return browserPresenter[0];
     }
 


---------------------------------------------------------------------
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] 22/25: Merging with changes in master

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 ca2ca1534e4d17fc2fb16606aa69b1fa9995c11b
Merge: f72cb97 073558a
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 10:56:13 2020 +0100

    Merging with changes in master

 Jenkinsfile.groovy                                 |   2 +-
 .../netbeans/html/boot/fx/AbstractFXPresenter.java |  21 +-
 .../java/org/netbeans/html/boot/fx/FXConsole.java  |  11 +-
 .../net/java/html/boot/script/DynamicHTTP.java     |   2 +-
 .../java/html/boot/script/KnockoutEnvJSTest.java   |   9 +-
 .../{SingleCase.java => ScriptEngineCase.java}     |  57 +-
 ...riptTst.java => ScriptEngineJavaScriptTCK.java} |  18 +-
 ...23JavaScriptTest.java => ScriptEngineTest.java} |  48 +-
 .../net/java/html/boot/script/ScriptsTest.java     |   2 +-
 .../org/netbeans/html/boot/impl/JsCallback.java    |  15 +-
 .../main/java/org/netbeans/html/boot/spi/Fn.java   |   5 +
 .../html/boot/impl/JavaScriptProcesorTest.java     | 187 +++---
 .../netbeans/html/boot/impl/JsCallbackTest.java    |   8 +-
 .../org/netbeans/html/boot/impl/JsMethods.java     |  28 +-
 .../java/org/netbeans/html/boot/impl/JsUtils.java  |  27 +-
 .../html/presenters/browser/DynamicHTTP.java       |   2 +-
 .../presenters/browser/JavaScriptUtilities.java    |  11 +-
 .../org/netbeans/html/presenters/spi/Generic.java  | 213 ++++---
 .../org/netbeans/html/geo/impl/JsGLProvider.java   |  36 +-
 .../netbeans/html/geo/impl/GeoProcessorTest.java   |  69 +-
 json-tck/pom.xml                                   |   8 -
 .../main/java/net/java/html/js/tests/Bodies.java   | 151 +++--
 .../java/net/java/html/js/tests/Factorial.java     |   7 +-
 .../main/java/net/java/html/js/tests/Receiver.java |   8 +-
 .../src/main/java/net/java/html/js/tests/Sum.java  |  20 +-
 .../net/java/html/json/tests/GCKnockoutTest.java   |  36 +-
 .../net/java/html/json/tests/KnockoutTest.java     | 306 ++++-----
 .../java/net/java/html/json/tests/MinesTest.java   |  49 +-
 .../java/html/json/tests/ObtainAndComputeTest.java | 136 ++++
 .../main/java/net/java/html/json/tests/Utils.java  |  92 +--
 .../org/netbeans/html/json/tck/JavaScriptTCK.java  |  44 +-
 .../java/org/netbeans/html/json/tck/KOTest.java    |  10 +-
 .../org/netbeans/html/json/tck/KnockoutTCK.java    |  53 +-
 .../netbeans/html/json/impl/ModelProcessor.java    |  70 +-
 .../net/java/html/json/ModelProcessorTest.java     | 710 +++++++++++----------
 .../html/ko/felix/test/KnockoutFelixTCKImpl.java   |  11 +-
 .../netbeans/html/ko/felix/test/DynamicHTTP.java   |   2 +-
 .../html/ko/osgi/test/KnockoutEquinoxTCKImpl.java  |  11 +-
 .../netbeans/html/ko/osgi/test/DynamicHTTP.java    |   2 +-
 .../java/org/netbeans/html/wstyrus/LoadJSON.java   |  11 +-
 .../netbeans/html/wstyrus/TyrusDynamicHTTP.java    |   2 +-
 .../netbeans/html/wstyrus/TyrusKnockoutTest.java   |  11 +-
 .../main/java/org/netbeans/html/ko4j/Knockout.java | 234 +++----
 .../main/java/org/netbeans/html/ko4j/LoadJSON.java |  88 +--
 .../main/java/org/netbeans/html/ko4j/LoadWS.java   |  59 +-
 .../java/org/netbeans/html/ko4j/DynamicHTTP.java   |   2 +-
 .../src/test/java/org/netbeans/html/ko4j/KOFx.java |   2 +
 .../org/netbeans/html/ko4j/KnockoutFXTest.java     |  16 +-
 pom.xml                                            |   8 +-
 .../org/netbeans/html/presenters/render/Show.java  |   2 +-
 .../html/presenters/webkit/UnJarResources.java     |   4 +-
 .../org/netbeans/html/presenters/webkit/Case.java  |  10 +-
 .../html/presenters/webkit/DynamicHTTP.java        |   2 +-
 .../html/presenters/webkit/GtkJavaScriptTest.java  |  37 +-
 .../html/presenters/webkit/GtkKnockoutTest.java    |  69 +-
 .../java/org/netbeans/html/xhr4j/LoadJSON.java     |  24 +-
 .../org/netbeans/html/xhr4j/JsonDynamicHTTP.java   |   2 +-
 .../org/netbeans/html/xhr4j/JsonKnockoutTest.java  |  11 +-
 58 files changed, 1702 insertions(+), 1389 deletions(-)

diff --cc pom.xml
index 0ac2c4b,bbd2559..9097ebf
--- a/pom.xml
+++ b/pom.xml
@@@ -33,8 -33,7 +33,8 @@@
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-       <netbeans.version>RELEASE121</netbeans.version>
+       <netbeans.version>RELEASE122</netbeans.version>
 +      <graalvm.version>20.3.0</graalvm.version>
        <grizzly.version>2.3.8</grizzly.version>
        <license>COPYING</license>
        <publicPackages />


---------------------------------------------------------------------
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] 13/25: Iterate just 30 times to prevent overflow

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 c22532aa3b40adfff98da495b741e396f854e86a
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 23 06:23:07 2020 +0100

    Iterate just 30 times to prevent overflow
---
 json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java b/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java
index c092a4a..6083cd5 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/GCBodyTest.java
@@ -151,10 +151,10 @@ public class GCBodyTest {
     }
     
     private static void assertGC(Reference<?> ref, String msg) throws InterruptedException {
-        for (int i = 0; i < 100; i++) {
+        for (int i = 0; i < 30; i++) {
             if (isGone(ref)) return;
             long then = System.currentTimeMillis();
-            int size = Bodies.gc(Math.pow(2.0, i));
+            int size = Bodies.gc(1 << i);
             long took = System.currentTimeMillis() - then;
             if (took > 3000) {
                 throw new InterruptedException(msg + " - giving up after " + took + " ms at size of " + size);


---------------------------------------------------------------------
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] 07/25: Trigger asynchronous action in JavaScript in middle of a computation

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 b7bbe85ec63333990ff50d0a59912ea18b562e28
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Mon Dec 21 20:17:30 2020 +0100

    Trigger asynchronous action in JavaScript in middle of a computation
---
 .../java/html/boot/script/ScriptEngineTest.java    |  1 +
 generic/pom.xml                                    |  2 +-
 .../html/presenters/spi/test/CallbackTest.java     |  7 +-
 .../netbeans/html/presenters/spi/test/Case.java    |  6 +-
 .../html/presenters/spi/test/GenericTest.java      | 30 ++++++--
 .../netbeans/html/presenters/spi/test/Testing.java | 17 ++++-
 .../java/html/js/tests/AsyncJavaScriptAction.java  | 79 ++++++++++++++++++++++
 .../net/java/html/js/tests/JavaScriptBodyTest.java | 75 ++++++++++----------
 .../main/java/net/java/html/js/tests/JsUtils.java  | 46 +++++++++++++
 .../main/java/net/java/html/json/tests/Utils.java  | 32 ++++-----
 .../org/netbeans/html/json/tck/JavaScriptTCK.java  | 20 ++++++
 11 files changed, 249 insertions(+), 66 deletions(-)

diff --git a/boot-script/src/test/java/net/java/html/boot/script/ScriptEngineTest.java b/boot-script/src/test/java/net/java/html/boot/script/ScriptEngineTest.java
index 94eec03..9c2912d 100644
--- a/boot-script/src/test/java/net/java/html/boot/script/ScriptEngineTest.java
+++ b/boot-script/src/test/java/net/java/html/boot/script/ScriptEngineTest.java
@@ -89,6 +89,7 @@ public class ScriptEngineTest {
                 if (n === 'Number') continue;
                 if (n === 'Boolean') continue;
                 if (n === 'Array') continue;
+                if (n === 'eval') continue;
                 delete this[n];
               }
               return Object.getOwnPropertyNames(this).toString();
diff --git a/generic/pom.xml b/generic/pom.xml
index 0008110..78b52d2 100644
--- a/generic/pom.xml
+++ b/generic/pom.xml
@@ -75,7 +75,7 @@
                     <compilerArguments>
                         <Aversion>${project.version}</Aversion>
                     </compilerArguments>
-                    <testSource>1.8</testSource>
+                    <testSource>15</testSource>
                     <testTarget>1.8</testTarget>
                 </configuration>
             </plugin>
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
index cdf0341..9aa2aeb 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
@@ -19,6 +19,7 @@
 package org.netbeans.html.presenters.spi.test;
 
 import java.lang.reflect.Method;
+import java.util.concurrent.CountDownLatch;
 import java.util.logging.Level;
 import javax.script.ScriptException;
 import static org.testng.Assert.assertEquals;
@@ -38,7 +39,7 @@ public class CallbackTest {
     private static final class CBP extends Testing {
 
         @Override
-        protected void loadJS(String js) {
+        protected void loadJS(String js, CountDownLatch notify) {
             dispatch(new Runnable () {
                 @Override
                 public void run() {
@@ -47,10 +48,12 @@ public class CallbackTest {
                         LOG.log(Level.FINE, "counter res: {0}", res);
                     } catch (ScriptException ex) {
                         LOG.log(Level.SEVERE, null, ex);
+                    } finally {
+                        notify.countDown();
                     }
                 }
             });
-            super.loadJS(js);
+            super.loadJS(js, notify);
         }
 
         @Override void beforeTest(Class<?> testClass) throws Exception {
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Case.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Case.java
index c3bc60d..8f4b94f 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Case.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Case.java
@@ -33,14 +33,16 @@ import org.testng.annotations.Test;
 
 public final class Case implements ITest, IHookable, Runnable {
     private final Fn.Presenter p;
+    private final Testing t;
     private CountDownLatch finished;
     private final Method m;
     private Object result;
     private Object inst;
     private int cnt;
 
-    Case(Fn.Presenter p, Method m) {
-        this.p = p;
+    Case(Testing t, Method m) {
+        this.t = t;
+        this.p = t.presenter;
         this.m = m;
     }
 
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
index 9df6444..9999365 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
@@ -22,11 +22,14 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 import net.java.html.boot.BrowserBuilder;
 import org.netbeans.html.boot.spi.Fn;
 import org.netbeans.html.json.tck.JavaScriptTCK;
 import org.netbeans.html.json.tck.KOTest;
+import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.Factory;
 
 public class GenericTest extends JavaScriptTCK {
@@ -39,8 +42,8 @@ public class GenericTest extends JavaScriptTCK {
         return createTests(new Testing());
     }
     
-    static Object[] createTests(Testing p) throws Exception {
-        Fn.Presenter presenter = p.presenter;
+    static Object[] createTests(Testing t) throws Exception {
+        Fn.Presenter presenter = t.presenter;
 
         final BrowserBuilder bb = BrowserBuilder.newBrowser(presenter).loadClass(GenericTest.class).
             loadPage("empty.html").
@@ -60,14 +63,27 @@ public class GenericTest extends JavaScriptTCK {
 
         Class[] arr = (Class[]) loadClass().getDeclaredMethod("tests").invoke(null);
         for (Class c : arr) {
-            for (Method m : c.getMethods()) {
-                if (m.getAnnotation(test) != null) {
-                    res.add(new Case(presenter, m));
-                }
-            }
+            addTestMethods(c, test, res, t);
         }
         return res.toArray();
     }
+
+    private static void addTestMethods(Class c, Class<? extends Annotation> test, List<Object> res, Testing t) throws SecurityException {
+        for (Method m : c.getMethods()) {
+            if (m.getAnnotation(test) != null) {
+                res.add(new Case(t, m));
+            }
+        }
+    }
+
+    @Override
+    public void executeNow(String script) throws Exception {
+        Testing t = Testing.MAP.get(Fn.activePresenter());
+        assertNotNull(t, "Testing framework found");
+        CountDownLatch cdl = new CountDownLatch(1);
+        t.loadJS(script, cdl);
+        cdl.await(5, TimeUnit.SECONDS);
+    }
     
     public static Class[] tests() {
         return testClasses();
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
index 4adc485..ccab68a 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
@@ -19,6 +19,9 @@
 package org.netbeans.html.presenters.spi.test;
 
 import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import java.util.logging.Level;
@@ -36,6 +39,7 @@ class Testing {
     final ScriptEngine eng;
     final boolean sync;
     final ProtoPresenter presenter;
+    static final Map<ProtoPresenter, Testing> MAP = new HashMap<>();
 
     public Testing() {
         this(false);
@@ -51,11 +55,14 @@ class Testing {
             .app("Testing")
             .type("test")
             .dispatcher(QUEUE, false)
-            .loadJavaScript(this::loadJS, sync)
+            .loadJavaScript((s) -> {
+                loadJS(s, new java.util.concurrent.CountDownLatch(1));
+            }, sync)
             .displayer(this::displayPage)
             .preparator(this::callbackFn, true)
             .logger(this::log)
             .build();
+        MAP.put(this.presenter, this);
 
         ScriptEngineManager sem = new ScriptEngineManager();
         eng = sem.getEngineByMimeType("text/javascript");
@@ -120,7 +127,7 @@ class Testing {
         ready.callbackIsPrepared("testingCB");
     }
 
-    protected void loadJS(final String js) {
+    protected void loadJS(final String js, CountDownLatch notify) {
         QUEUE.execute(new Runnable() {
             public void run() {
                 try {
@@ -128,6 +135,8 @@ class Testing {
                     LOG.log(Level.FINE, "Result: {0}", res);
                 } catch (Throwable ex) {
                     LOG.log(Level.SEVERE, "Can't process " + js, ex);
+                } finally {
+                    notify.countDown();
                 }
             }
         });
@@ -150,12 +159,14 @@ class Testing {
         }
 
         @Override
-        protected void loadJS(final String js) {
+        protected void loadJS(final String js, CountDownLatch notify) {
             try {
                 Object res = eng.eval(js);
                 LOG.log(Level.FINE, "Result: {0}", res);
             } catch (Throwable ex) {
                 LOG.log(Level.SEVERE, "Can't process " + js, ex);
+            } finally {
+                notify.countDown();
             }
         }
 
diff --git a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
new file mode 100644
index 0000000..a9f20af
--- /dev/null
+++ b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.java.html.js.tests;
+
+import java.util.List;
+import net.java.html.js.JavaScriptBody;
+import static net.java.html.js.tests.JavaScriptBodyTest.assertEquals;
+
+final class AsyncJavaScriptAction {
+    List<Integer> collected = new java.util.ArrayList<>();
+
+    @JavaScriptBody(args = { "n" }, javacall = true, body = """
+        return this.@net.java.html.js.tests.AsyncJavaScriptAction::performTheTest(I)(n);
+    """)
+    private native int r(int n);
+
+    @JavaScriptBody(args = {}, javacall = true, body = """
+        var self = this;
+        var global = (0 || eval)("this");
+        global.storeLater = function(s) {
+            self.@net.java.html.js.tests.AsyncJavaScriptAction::storeLater(I)(s);
+        };
+    """)
+    private native void defineStore();
+
+    @JavaScriptBody(args = { "store" }, javacall = true, wait4js = false, body = """
+        storeLater(store);
+    """)
+    private static native void jsStore(int store);
+
+    void storeLater(int value) {
+        collected.add(value);
+    }
+
+    int performTheTest(int from) throws Exception {
+        for (int i = 0; i < 5; i++) {
+            jsStore(from++);
+        }
+        final String n = "" + from++;
+        JsUtils.executeNow(AsyncJavaScriptAction.class, """
+            storeLater({n});
+        """.replace("{n}", n));
+        for (int i = 6; i < 11; i++) {
+            jsStore(from++);
+        }
+        return from;
+    }
+
+    public void runTheWholeTest() {
+        defineStore();
+        assertEquals(r(0), 11);
+        assertEquals(collected.size(), 11, "11 items: " + collected);
+        for (int i = 0; i < 11; i++) {
+            assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);
+        }
+        assertEquals(r(11), 22);
+
+        assertEquals(collected.size(), 22, "22 items: " + collected);
+        for (int i = 0; i < 22; i++) {
+            assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);
+        }
+    }
+}
diff --git a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
index b3c3f21..3a0e8cf 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
@@ -18,7 +18,6 @@
  */
 package net.java.html.js.tests;
 
-import java.io.StringReader;
 import java.util.concurrent.Callable;
 import net.java.html.json.Models;
 import org.netbeans.html.boot.spi.Fn;
@@ -38,7 +37,7 @@ public class JavaScriptBodyTest {
         int res = Bodies.sumJS(5, 3);
         assertEquals(res, 8, "Expecting 8: " + res);
     }
-    
+
     @KOTest public void accessJsObject() {
         Object o = Bodies.instance(10);
         int ten = Bodies.readIntX(o);
@@ -51,13 +50,13 @@ public class JavaScriptBodyTest {
         int ten = Bodies.readIntX(o);
         assertEquals(ten, 11, "Expecting eleven: " + ten);
     }
-    
+
     @KOTest public void callbackToRunnable() {
         R run = new R();
         Bodies.callback(run);
         assertEquals(run.cnt, 1, "Can call even private implementation classes: " + run.cnt);
     }
-    
+
     private R asyncRun;
     @KOTest public void asyncCallbackToRunnable() throws InterruptedException {
         if (asyncRun == null) {
@@ -79,7 +78,7 @@ public class JavaScriptBodyTest {
         assertEquals(r.cnt, 10, "Ten calls: " + r.cnt);
         assertEquals(fourtyTwo, 42, "Meaning of the world expected: " + fourtyTwo);
     }
-    
+
     @KOTest public void typeOfCharacter() {
         String charType = Bodies.typeof('a', false);
         assertEquals("number", charType, "Expecting number type: " + charType);
@@ -91,7 +90,7 @@ public class JavaScriptBodyTest {
 
     @KOTest public void typeOfPrimitiveBoolean() {
         String booleanType = Bodies.typeof(true);
-        assertTrue("boolean".equals(booleanType) || "number".equals(booleanType), 
+        assertTrue("boolean".equals(booleanType) || "number".equals(booleanType),
             "Expecting boolean or at least number type: " + booleanType);
     }
 
@@ -109,7 +108,7 @@ public class JavaScriptBodyTest {
         String doubleType = Bodies.typeof(0.33, false);
         assertEquals("number", doubleType, "Expecting number type: " + doubleType);
     }
-    
+
     @KOTest public void typeOfBooleanValueOf() {
         String booleanType = Bodies.typeof(true, true);
         assertEquals("boolean", booleanType, "Expecting boolean type: " + booleanType);
@@ -151,7 +150,7 @@ public class JavaScriptBodyTest {
         assertEquals(sum[0], 42, "Computed OK " + sum[0]);
         assertEquals(sum[1], 42, "Computed OK too: " + sum[1]);
     }
-    
+
     @KOTest public void doubleCallbackToRunnable() {
         final R run = new R();
         final R r2 = new R();
@@ -165,7 +164,7 @@ public class JavaScriptBodyTest {
         assertEquals(run.cnt, 1, "Can call even private implementation classes: " + run.cnt);
         assertEquals(r2.cnt, 1, "Can call even private implementation classes: " + r2.cnt);
     }
-    
+
     @KOTest public void identity() {
         Object p = new Object();
         Object r = Bodies.id(p);
@@ -189,7 +188,7 @@ public class JavaScriptBodyTest {
         Object r = Bodies.id(p);
         assertEquals(r, p, "The null is the same");
     }
-    
+
     @KOTest public void callbackWithTrueResult() {
         Callable<Boolean> c = new C(true);
         String b = Bodies.yesNo(c);
@@ -201,13 +200,13 @@ public class JavaScriptBodyTest {
         String b = Bodies.yesNo(c);
         assertEquals(b, "no", "Should return false");
     }
-    
+
     @KOTest public void callbackWithParameters() throws InterruptedException {
         Sum s = new Sum();
         int res = Bodies.sumIndirect(s, 40, 2);
         assertEquals(res, 42, "Expecting 42");
     }
-    
+
     @KOTest public void selectFromStringJavaArray() {
         String[] arr = { "Ahoj", "Wo\nrld" };
         Object res = Bodies.select(arr, 1);
@@ -238,7 +237,7 @@ public class JavaScriptBodyTest {
         assertNotNull(res, "Non-null is returned");
         assertTrue(res instanceof Object[], "Returned an array: " + res);
         assertFalse(res instanceof String[], "Not returned a string array: " + res);
-        
+
         Object[] ret = (Object[]) res;
         assertEquals(arr.length, ret.length, "Same length: " + ret.length);
         assertEquals(arr[0], ret[0], "Same first elem");
@@ -269,7 +268,7 @@ public class JavaScriptBodyTest {
         assertEquals("He\nllo", arr[0], "Hello expected: " + arr[0]);
         assertEquals("Worl\nd!", arr[1], "World! expected: " + arr[1]);
     }
-    
+
     @KOTest public void sumVector() {
         double[] arr = { 1.0, 2.0, 3.0 };
         double res = Bodies.sumVector(arr);
@@ -285,32 +284,32 @@ public class JavaScriptBodyTest {
     @KOTest public void truth() {
         assertTrue(Bodies.truth(), "True is true");
     }
-    
+
     @KOTest public void factorial2() {
         assertEquals(new Factorial().factorial(2), 2);
     }
-    
+
     @KOTest public void factorial3() {
         assertEquals(new Factorial().factorial(3), 6);
     }
-    
+
     @KOTest public void factorial4() {
         assertEquals(new Factorial().factorial(4), 24);
     }
-    
+
     @KOTest public void factorial5() {
         assertEquals(new Factorial().factorial(5), 120);
     }
-    
+
     @KOTest public void factorial6() {
         assertEquals(new Factorial().factorial(6), 720);
     }
-    
+
     @KOTest public void sumArray() {
         int r = Bodies.sumArr(new Sum());
         assertEquals(r, 6, "Sum is six: " + r);
     }
-    
+
     @KOTest public void staticCallback() {
         int r = Bodies.staticCallback();
         assertEquals(r, 42, "Expecting 42: " + r);
@@ -323,12 +322,12 @@ public class JavaScriptBodyTest {
         assertTrue(r instanceof Number, "Is number " + r);
         assertEquals(((Number)r).intValue(), 42, "Expecting 42: " + r);
     }
-    
+
     @KOTest public void asyncCallFromAJSCallbackNeedToFinishBeforeReturnToJS() {
         int r = Bodies.incAsync();
         assertEquals(r, 42, "Expecting 42: " + r);
     }
-    
+
     @KOTest public void iterateArray() {
         String[] arr = { "Ahoj", "Hi", "Ciao" };
         Object[] ret = Bodies.forIn(arr);
@@ -338,7 +337,7 @@ public class JavaScriptBodyTest {
         assertEquals(ret[3], "Hi", "Expecting Hi: " + ret[1]);
         assertEquals(ret[5], "Ciao", "Expecting Ciao: " + ret[2]);
     }
-    
+
     @KOTest public void primitiveTypes() {
         String all = Bodies.primitiveTypes(new Sum());
         assertEquals("Ahojfalse12356.07.0 TheEND", all, "Valid return type: " + all);
@@ -366,7 +365,7 @@ public class JavaScriptBodyTest {
         boolean nonNull = Bodies.nonNull(s, "x");
         assertTrue(nonNull, "x property exists");
     }
-    
+
     @KOTest public void callbackUnknown() {
         Sum s = new Sum();
         boolean nonNull = Bodies.nonNull(s, "y");
@@ -388,7 +387,7 @@ public class JavaScriptBodyTest {
         int len = Math.min(orig.length(), js.length());
         for (int i = 0; i < len; i++) {
             if (orig.charAt(i) != js.charAt(i)) {
-                fail("Difference at position " + i + 
+                fail("Difference at position " + i +
                     "\norig: " +
                     orig.substring(i - 5, Math.min(i + 10, orig.length())) +
                     "\n  js: " +
@@ -404,7 +403,7 @@ public class JavaScriptBodyTest {
         boolean res = Bodies.isInArray(new Object[] { val }, val);
         assertTrue(res, "Should be in the array");
     }
-    
+
     Later l;
     @KOTest public void callLater() throws Exception{
         final Fn.Presenter p = Fn.activePresenter();
@@ -412,14 +411,14 @@ public class JavaScriptBodyTest {
             return;
         }
         if (l == null) {
-            p.loadScript(new StringReader(
+            JsUtils.executeNow(JavaScriptBodyTest.class,
                 "if (typeof window === 'undefined') window = {};"
-            ));
+            );
             l = new Later();
             l.register();
-            p.loadScript(new StringReader(
+            JsUtils.executeNow(JavaScriptBodyTest.class,
                 "window.later();"
-            ));
+            );
         }
         if (l.call != 42) {
             throw new InterruptedException();
@@ -428,6 +427,12 @@ public class JavaScriptBodyTest {
     }
 
     @KOTest
+    public void asynchCallFromJavaScriptInMiddleOfDefferedProcessing() {
+        AsyncJavaScriptAction t = new AsyncJavaScriptAction();
+        t.runTheWholeTest();
+    }
+
+    @KOTest
     public void globalStringAvailable() throws Exception {
         assertEquals("HTML/Java", GlobalString.init());
         assertEquals("HTML/Java", Bodies.readGlobalString());
@@ -451,11 +456,11 @@ public class JavaScriptBodyTest {
         assertEquals(value[0], "NetBeans", "As a returned value from defining method");
         assertEquals(value[1], "NetBeans", "As read later by different method");
     }
-    
+
     private static class R implements Runnable {
         int cnt;
         private final Thread initThread;
-        
+
         public R() {
             initThread = Thread.currentThread();
         }
@@ -466,14 +471,14 @@ public class JavaScriptBodyTest {
             cnt++;
         }
     }
-    
+
     private static class C implements Callable<Boolean> {
         private final boolean ret;
 
         public C(boolean ret) {
             this.ret = ret;
         }
-        
+
         @Override
         public Boolean call() throws Exception {
             return ret;
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
new file mode 100644
index 0000000..de99cca
--- /dev/null
+++ b/json-tck/src/main/java/net/java/html/js/tests/JsUtils.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package net.java.html.js.tests;
+
+import java.io.StringReader;
+import org.netbeans.html.boot.spi.Fn;
+import org.netbeans.html.json.tck.JavaScriptTCK;
+
+public class JsUtils {
+    private JsUtils() {
+    }
+
+    private static JavaScriptTCK instantiatedJsTCK;
+
+    public static void registerTCK(JavaScriptTCK tck) {
+        instantiatedJsTCK = tck;
+    }
+
+    static void executeNow(Class<?> clazz, String script) throws Exception {
+        if (instantiatedJsTCK != null) {
+            instantiatedJsTCK.executeNow(script);
+        } else {
+            Fn.Presenter p = Fn.activePresenter();
+            if (p != null) {
+                p.loadScript(new StringReader(script));
+            }
+        }
+    }
+
+}
diff --git a/json-tck/src/main/java/net/java/html/json/tests/Utils.java b/json-tck/src/main/java/net/java/html/json/tests/Utils.java
index 3a7aca6..afcf9fe 100644
--- a/json-tck/src/main/java/net/java/html/json/tests/Utils.java
+++ b/json-tck/src/main/java/net/java/html/json/tests/Utils.java
@@ -66,7 +66,7 @@ public final class Utils {
 
     private Utils() {
     }
-    
+
     public static void registerTCK(KnockoutTCK tck) {
         instantiatedTCK = tck;
     }
@@ -89,7 +89,7 @@ public final class Utils {
         }
         throw new AssertionError("Can't find appropriate Context in ServiceLoader!");
     }
-    static Object executeScript(Class<?> clazz, 
+    static Object executeScript(Class<?> clazz,
         String script, Object... arguments
     ) throws Exception {
         for (KnockoutTCK tck : tcks(clazz)) {
@@ -116,17 +116,17 @@ public final class Utils {
           """;
         executeScript(clazz, s);
     }
-    
+
     static Object exposeHTML(Class<?> clazz, String html) throws Exception {
         String s = """
-          var n = window.document.getElementById('ko.test.div'); 
-           if (!n) { 
-            n = window.document.createElement('div'); 
-             n.id = 'ko.test.div'; 
+          var n = window.document.getElementById('ko.test.div');
+           if (!n) {
+            n = window.document.createElement('div');
+             n.id = 'ko.test.div';
              var body = window.document.getElementsByTagName('body')[0];
             body.appendChild(n);
           }
-          n.innerHTML = arguments[0]; 
+          n.innerHTML = arguments[0];
            """;
         return executeScript(clazz, s, html);
     }
@@ -160,7 +160,7 @@ public final class Utils {
             """, id, field, value
         );
     }
-    
+
     static void scheduleClick(Class<?> clazz, String id, int delay) throws Exception {
         String s = """
             var id = arguments[0];
@@ -175,8 +175,8 @@ public final class Utils {
             """;
         Utils.executeScript(clazz, s, id, delay);
     }
-    
-    
+
+
     static String prepareURL(
         Class<?> clazz, String content, String mimeType, String... parameters) {
         for (KnockoutTCK tck : tcks(clazz)) {
@@ -197,7 +197,7 @@ public final class Utils {
         }
         return false;
     }
-    
+
     private static ClassLoader cl(Class<?> c) {
         try {
             return c.getClassLoader();
@@ -205,11 +205,11 @@ public final class Utils {
             return null;
         }
     }
-    
+
     static void fail(String msg) {
         throw new AssertionError(msg);
     }
-    
+
     static void assertTrue(boolean c, String msg) {
         if (!c) {
             throw new AssertionError(msg);
@@ -221,7 +221,7 @@ public final class Utils {
             throw new AssertionError(msg);
         }
     }
-    
+
     static void assertNull(Object o, String msg) {
         if (o != null) {
             throw new AssertionError(msg + " but was: " + o);
@@ -233,7 +233,7 @@ public final class Utils {
             throw new AssertionError(msg);
         }
     }
-    
+
     static void assertEquals(Object a, Object b, String msg) {
         if (a == b) {
             return;
diff --git a/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java b/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
index 5d39f9a..13c5350 100644
--- a/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
+++ b/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
@@ -18,9 +18,11 @@
  */
 package org.netbeans.html.json.tck;
 
+import java.io.StringReader;
 import net.java.html.js.tests.GCBodyTest;
 import net.java.html.js.tests.JavaScriptBodyTest;
 import net.java.html.js.tests.ExposedPropertiesTest;
+import net.java.html.js.tests.JsUtils;
 import org.netbeans.html.boot.spi.Fn;
 import org.netbeans.html.boot.spi.Fn.Presenter;
 
@@ -63,6 +65,11 @@ import org.netbeans.html.boot.spi.Fn.Presenter;
  * @since 0.7
  */
 public abstract class JavaScriptTCK {
+    /** Creates and registers instance of the TCK. */
+    public JavaScriptTCK() {
+        JsUtils.registerTCK(this);
+    }
+
     /** Gives you list of classes included in the TCK. Their test methods
      * are annotated by {@link KOTest} annotation. The methods are public
      * instance methods that take no arguments. The method should be
@@ -75,4 +82,17 @@ public abstract class JavaScriptTCK {
             JavaScriptBodyTest.class, GCBodyTest.class, ExposedPropertiesTest.class
         };
     }
+
+    /** Executes JavaScript now. Simulates that something suddenly happens
+     * in the JavaScript while Java code may already be doing something
+     * different.
+     *
+     * @param script the script to execute in the JavaScript
+     * @throws Exception if something goes wrong
+     * @since 1.7.1
+     */
+    public void executeNow(String script) throws Exception {
+        Presenter p = Fn.activePresenter();
+        p.loadScript(new StringReader(script));
+    }
 }


---------------------------------------------------------------------
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] 23/25: Running on JDK15 with the help of Graal.js

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 29d747d091e7d3954e3ec9f1952dc7636c2bbac4
Merge: ddf5059 ca2ca15
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 10:56:49 2020 +0100

    Running on JDK15 with the help of Graal.js

 .travis.yml                                            | 10 ++++++++--
 boot-script/pom.xml                                    |  8 ++++++++
 .../test/java/net/java/html/boot/script/KOCase.java    |  2 +-
 .../net/java/html/boot/script/KnockoutEnvJSTest.java   |  4 +++-
 boot/pom.xml                                           |  8 ++++++++
 generic/pom.xml                                        |  8 ++++++++
 .../main/java/net/java/html/json/tests/JSONTest.java   | 18 ++++++++++--------
 json/pom.xml                                           |  8 ++++++++
 json/src/test/java/net/java/html/json/TypesTest.java   |  1 +
 pom.xml                                                | 17 +++++++++++++++++
 sound/pom.xml                                          |  8 ++++++++
 11 files changed, 80 insertions(+), 12 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/25: Include graal-js as a subsitute for missing Nashorn on JDK15

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 e6b099d099537e378156d1e1e4a131758b814f08
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Mon Dec 7 07:49:38 2020 +0100

    Include graal-js as a subsitute for missing Nashorn on JDK15
---
 boot-script/pom.xml                                   |  8 ++++++++
 .../test/java/net/java/html/boot/script/KOCase.java   |  2 +-
 .../net/java/html/boot/script/KnockoutEnvJSTest.java  |  4 +++-
 boot/pom.xml                                          |  8 ++++++++
 generic/pom.xml                                       |  8 ++++++++
 json/pom.xml                                          |  8 ++++++++
 json/src/test/java/net/java/html/json/TypesTest.java  |  1 +
 pom.xml                                               | 19 +++++++++++++++++--
 sound/pom.xml                                         |  8 ++++++++
 9 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/boot-script/pom.xml b/boot-script/pom.xml
index 40378ca..91f62fc 100644
--- a/boot-script/pom.xml
+++ b/boot-script/pom.xml
@@ -122,5 +122,13 @@
             <scope>test</scope>
             <type>jar</type>
         </dependency>
+        <dependency>
+          <groupId>org.graalvm.js</groupId>
+          <artifactId>js</artifactId>
+        </dependency>
+        <dependency>
+          <groupId>org.graalvm.js</groupId>
+          <artifactId>js-scriptengine</artifactId>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/boot-script/src/test/java/net/java/html/boot/script/KOCase.java b/boot-script/src/test/java/net/java/html/boot/script/KOCase.java
index c565de9..7a74fc9 100644
--- a/boot-script/src/test/java/net/java/html/boot/script/KOCase.java
+++ b/boot-script/src/test/java/net/java/html/boot/script/KOCase.java
@@ -50,7 +50,7 @@ public final class KOCase implements ITest, Runnable {
 
     @Override
     public String getTestName() {
-        return m.getName();
+        return m != null ? m.getName() : skipMsg;
     }
 
     @Test
diff --git a/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java b/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
index 6316f10..92b7088 100644
--- a/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
+++ b/boot-script/src/test/java/net/java/html/boot/script/KnockoutEnvJSTest.java
@@ -70,7 +70,9 @@ public final class KnockoutEnvJSTest extends KnockoutTCK {
     @Factory public static Object[] compatibilityTests() throws Exception {
         ScriptEngine eng = new ScriptEngineManager().getEngineByName("nashorn");
         if (eng == null) {
-            throw new SkipException("Nashorn engine not found. Skipping!");
+            return new Object[] {
+                new KOCase(null, null, "Nashorn engine not found. Skipping!")
+            };
         }
 
         Class[] arr = testClasses();
diff --git a/boot/pom.xml b/boot/pom.xml
index 59fc227..19968a5 100644
--- a/boot/pom.xml
+++ b/boot/pom.xml
@@ -84,6 +84,14 @@
       <scope>test</scope>
       <type>jar</type>
     </dependency>
+    <dependency>
+        <groupId>org.graalvm.js</groupId>
+        <artifactId>js</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.graalvm.js</groupId>
+        <artifactId>js-scriptengine</artifactId>
+    </dependency>
   </dependencies>
     <description>Builder to launch your Java/HTML based application.</description>
 </project>
diff --git a/generic/pom.xml b/generic/pom.xml
index 0008110..1669f11 100644
--- a/generic/pom.xml
+++ b/generic/pom.xml
@@ -61,6 +61,14 @@
             <groupId>com.dukescript.api</groupId>
             <artifactId>strings</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js-scriptengine</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
diff --git a/json/pom.xml b/json/pom.xml
index 0c84eac..31c5a96 100644
--- a/json/pom.xml
+++ b/json/pom.xml
@@ -82,6 +82,14 @@
       <artifactId>net.java.html</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.graalvm.js</groupId>
+      <artifactId>js</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.graalvm.js</groupId>
+      <artifactId>js-scriptengine</artifactId>
+    </dependency>
   </dependencies>
     <description>API for smooth representation of JSON objects in Java. Write your
 application in Java and
diff --git a/json/src/test/java/net/java/html/json/TypesTest.java b/json/src/test/java/net/java/html/json/TypesTest.java
index 465c752..2185bd3 100644
--- a/json/src/test/java/net/java/html/json/TypesTest.java
+++ b/json/src/test/java/net/java/html/json/TypesTest.java
@@ -111,6 +111,7 @@ public class TypesTest {
     private static void assertValidJSON(String text) {
         ScriptEngineManager sem = new ScriptEngineManager();
         ScriptEngine eng = sem.getEngineByMimeType("text/javascript");
+        assertNotNull(eng, "JavaScript engine found");
         try {
             eng.eval("var obj = " + text + ";");
         } catch (ScriptException ex) {
diff --git a/pom.xml b/pom.xml
index ed859f3..6e875e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,8 @@
   </parent>
   <properties>
       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-      <netbeans.version>RELEASE110</netbeans.version>
+      <netbeans.version>RELEASE121</netbeans.version>
+      <graalvm.version>20.3.0</graalvm.version>
       <grizzly.version>2.3.8</grizzly.version>
       <license>COPYING</license>
       <publicPackages />
@@ -280,7 +281,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                     <dependency>
                         <artifactId>compiler-maven-plugin</artifactId>
                         <groupId>org.frgaal</groupId>
-                        <version>14.0.1</version>
+                        <version>15.0.0</version>
                     </dependency>
                 </dependencies>
                 <configuration>
@@ -535,6 +536,20 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
             <type>jar</type>
             <version>${netbeans.version}</version>
         </dependency>
+        <dependency>
+            <artifactId>js</artifactId>
+            <groupId>org.graalvm.js</groupId>
+            <type>jar</type>
+            <scope>test</scope>
+            <version>${graalvm.version}</version>
+        </dependency>
+        <dependency>
+            <artifactId>js-scriptengine</artifactId>
+            <groupId>org.graalvm.js</groupId>
+            <type>jar</type>
+            <scope>test</scope>
+            <version>${graalvm.version}</version>
+        </dependency>
       </dependencies>
   </dependencyManagement>
   <profiles>
diff --git a/sound/pom.xml b/sound/pom.xml
index f8a8637..e6ce1ad 100644
--- a/sound/pom.xml
+++ b/sound/pom.xml
@@ -97,5 +97,13 @@
           <artifactId>org-openide-util-lookup</artifactId>
           <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.graalvm.js</groupId>
+            <artifactId>js-scriptengine</artifactId>
+        </dependency>
     </dependencies>
 </project>


---------------------------------------------------------------------
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] 18/25: Allow only one deferred processing before flush

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 ae7d00a2693e25492a16eae3cd96c2da6bb9b8a1
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 07:17:34 2020 +0100

    Allow only one deferred processing before flush
---
 .../main/java/org/netbeans/html/presenters/spi/Generic.java  | 12 ++++++++++--
 .../org/netbeans/html/presenters/spi/test/GenericTCK.java    |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index 723a3c9..3204355 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -706,6 +706,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
     }
 
     private StringBuilder deferred;
+    private boolean deferredDisabled;
     private Collection<Object> arguments = new LinkedList<Object>();
 
     private StringBuilder getDeferred(boolean clear) {
@@ -713,6 +714,9 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         StringBuilder sb = deferred;
         if (clear) {
             deferred = null;
+            if (sb != null) {
+                deferredDisabled = true;
+            }
         }
         return sb;
     }
@@ -753,6 +757,9 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                 log(Level.FINE, "flush#{1}: {0}", def, id);
                 exec(id, Strings.flushExec(key, id).toString());
             }
+            if (topMostCall() == null) {
+                deferredDisabled = false;
+            }
         }
     }
 
@@ -931,9 +938,10 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
             arguments.add(args);
 
             synchronized (lock()) {
+                boolean synchronizedExecution = wait4js || deferredDisabled;
                 int callId = nextCallId();
-                sb.insert(0, Strings.invokeImplFn(id, wait4js, key, callId));
-                if (wait4js) {
+                sb.insert(0, Strings.invokeImplFn(id, synchronizedExecution, key, callId));
+                if (synchronizedExecution) {
                     return exec(callId, sb.toString());
                 } else {
                     deferExec(sb);
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
index 872ad98..8c0ba9a 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
@@ -58,7 +58,7 @@ final class GenericTCK extends JavaScriptTCK {
                     }
                 }
             });
-            cdl.await(3, TimeUnit.SECONDS);
+            cdl.await(1, TimeUnit.SECONDS);
             if (error[0] != null) {
                 throw error[0];
             }


---------------------------------------------------------------------
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] 10/25: Flush pending JavaScript executions before checking results

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 0ee7eb332242c87e4410152a041fd53ed551b1ac
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Dec 22 13:58:10 2020 +0100

    Flush pending JavaScript executions before checking results
---
 .../src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
index b885f75..98e650f 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
@@ -50,6 +50,9 @@ final class AsyncJavaScriptAction {
         collected.add(value);
     }
 
+    @JavaScriptBody(args = {}, body = "")
+    native void flushPendingJavaScripts();
+
     int performIteration(int from) {
         for (int i = 0; i < 5; i++) {
             jsStore(from++);
@@ -68,6 +71,7 @@ final class AsyncJavaScriptAction {
         if (!successStoringLater) {
             return;
         }
+        flushPendingJavaScripts();
         assertEquals(collected.size(), 11, "11 items: " + collected);
         for (int i = 0; i < 11; i++) {
             assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);
@@ -76,6 +80,7 @@ final class AsyncJavaScriptAction {
         if (!successStoringLater) {
             return;
         }
+        flushPendingJavaScripts();
         assertEquals(collected.size(), 22, "22 items: " + collected);
         for (int i = 0; i < 22; i++) {
             assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);


---------------------------------------------------------------------
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] 12/25: Resolve deferred, then dispatch, then resolve deferred

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 ec3e1f39c352eef73a896c28fafc77cf5608570c
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Dec 22 15:09:25 2020 +0100

    Resolve deferred, then dispatch, then resolve deferred
---
 .../org/netbeans/html/presenters/spi/Generic.java  | 33 ++++++++++++----------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index b6d5b38..e452569 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -345,18 +345,16 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         "fnClose=) {\n",
         "fnBegin=  var encParams = ds(@1).toJava(null, -1, [",
         "fnPPar=@2 p@1", """
-                         fnBody=]);
-                           var v = ds(@3).toVM('c', '@1', '@2', thiz ? thiz.id : null, encParams);
-                           while (v !== null && v.indexOf && v.indexOf('javascript:') === 0) {
-                             var script = v.substring(11);
-                             try {
-                               var r = eval.call(null, script);
-                             } catch (e) {  console.warn('error: ' + e + ' executing: ' + script + ' at:\\n' + e.stack); }
-                             v = ds(@3).toVM('jr', null, null, null, null);  }
-                           return @4 ? eval('(' + v + ')') : v;
-                         };
-                         """,
-        
+        fnBody=]);
+          var v = ds(@3).toVM('c', '@1', '@2', thiz ? thiz.id : null, encParams);
+          while (v !== null && v.indexOf && v.indexOf('javascript:') === 0) {
+            var script = v.substring(11);
+            try {
+              var r = eval.call(null, script);
+            } catch (e) {  console.warn('error: ' + e + ' executing: ' + script + ' at:\\n' + e.stack); }
+            v = ds(@3).toVM('jr', null, null, null, null);  }
+          return @4 ? eval('(' + v + ')') : v;
+        };""",
         "fnFoot=ds(@2).rg(@1, jsvm);\n"
     })
     final Integer exportVm(Object vm) {
@@ -671,9 +669,6 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
             boolean first = top == null || Boolean.TRUE.equals(top.done);
             log(Level.FINE, "jc: {0}@{1}args: {2} is first: {3}, now: {4}", new Object[]{method.getName(), vm, params, first, topMostCall()});
             Item newItem = registerCall(new Item(nextCallId(), top, method, vm, converted));
-            if (first || synchronous) {
-                dispatch(newItem);
-            }
             return javaresult();
         }
     }
@@ -690,6 +685,14 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                 }
                 finished[0] = false;
                 final Item top = topMostCall();
+                if (top.method != null) {
+                    if (top.done == null) {
+                        dispatch(top);
+                        if (deferred != null) {
+                            continue;
+                        }
+                    }
+                }
                 String jsToExec = top.inJavaScript(finished);
                 log(Level.FINE, "jr: {0} jsToExec: {1} finished: {2}", new Object[]{topMostCall(), jsToExec, finished[0]});
                 if (jsToExec != null) {


---------------------------------------------------------------------
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] 17/25: Encapsulate access to deffered field

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 519e4d5c7f28b35f31429aefb9c58f9d966c8bf6
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 06:35:00 2020 +0100

    Encapsulate access to deffered field
---
 .../org/netbeans/html/presenters/spi/Generic.java  | 60 ++++++++++++----------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index fd06b6d..723a3c9 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -677,18 +677,17 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         synchronized (lock()) {
             boolean[] finished = {false};
             for (;;) {
-                if (deferred != null) {
-                    deferred.insert(0, "javascript:");
-                    String ret = deferred.toString();
-                    deferred = null;
-                    return ret;
+                StringBuilder def = getDeferred(true);
+                if (def != null) {
+                    def.insert(0, "javascript:");
+                    return def.toString();
                 }
                 finished[0] = false;
                 final Item top = topMostCall();
                 if (top.method != null) {
                     if (top.done == null) {
                         dispatch(top);
-                        if (deferred != null) {
+                        if (getDeferred(false) != null) {
                             continue;
                         }
                     }
@@ -709,20 +708,15 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
     private StringBuilder deferred;
     private Collection<Object> arguments = new LinkedList<Object>();
 
-    public final void loadScript(final Reader reader) throws Exception {
-        StringBuilder sb = new StringBuilder();
-        char[] arr = new char[4092];
-        for (;;) {
-            int len = reader.read(arr);
-            if (len == -1) {
-                break;
-            }
-            sb.append(arr, 0, len);
+    private StringBuilder getDeferred(boolean clear) {
+        assert Thread.holdsLock(lock());
+        StringBuilder sb = deferred;
+        if (clear) {
+            deferred = null;
         }
-        deferExec(sb);
+        return sb;
     }
 
-
     final void deferExec(StringBuilder sb) {
         synchronized (lock()) {
             log(Level.FINE, "deferExec: {0} empty: {1}, call: {2}", new Object[]{sb, deferred == null, topMostCall()});
@@ -734,14 +728,29 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         }
     }
 
+    public final void loadScript(final Reader reader) throws Exception {
+        StringBuilder sb = new StringBuilder();
+        char[] arr = new char[4092];
+        for (;;) {
+            int len = reader.read(arr);
+            if (len == -1) {
+                break;
+            }
+            sb.append(arr, 0, len);
+        }
+        deferExec(sb);
+    }
+
+
     @Texts({
         "flushExec=\n\nds(@1).toJava('r', '@2', null);\n"
     })
     void flushImpl() {
         synchronized (lock()) {
-            if (deferred != null) {
+            StringBuilder def = getDeferred(false);
+            if (def != null) {
                 final int id = nextCallId();
-                log(Level.FINE, "flush#{1}: {0}", deferred, id);
+                log(Level.FINE, "flush#{1}: {0}", def, id);
                 exec(id, Strings.flushExec(key, id).toString());
             }
         }
@@ -750,14 +759,13 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
     final Object exec(int id, String fn) {
         assert Thread.holdsLock(lock());
         boolean first;
-        if (deferred != null) {
-            deferred.append(fn);
-            fn = deferred.toString();
-            deferred = null;
-            log(Level.FINE, "Flushing {0}", fn);
-        }
-
         {
+            StringBuilder def = getDeferred(true);
+            if (def != null) {
+                def.append(fn);
+                fn = def.toString();
+                log(Level.FINE, "Flushing {0}", fn);
+            }
             Item c = topMostCall();
             if (c != null && c.method != null) {
                 c.inJava();


---------------------------------------------------------------------
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] 25/25: Generate all groups in aggregate Javadoc again

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 df94a42c771f1db6bf86ad40ca3a6215692ef46e
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Fri Dec 25 17:18:13 2020 +0100

    Generate all groups in aggregate Javadoc again
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 9f5b9c0..533a7da 100644
--- a/pom.xml
+++ b/pom.xml
@@ -153,7 +153,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                 <docletArtifact>
                     <groupId>org.apidesign.javadoc</groupId>
                     <artifactId>codesnippet-doclet</artifactId>
-                    <version>0.60</version>
+                    <version>0.61</version>
                 </docletArtifact>
                 <additionalOptions>
                     -snippetpath boot-fx/src/test


---------------------------------------------------------------------
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] 04/25: Less verbose build

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 3a4ca18f326a01900acd12ff3ccd926857cdd429
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 9 05:57:23 2020 +0100

    Less verbose build
---
 .travis.yml | 2 +-
 pom.xml     | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 6de3070..d760a9d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ before_script:
 script:
   - $JAVA_HOME/bin/java -version
   - mvn install -DskipTests $ARGS
-  - mvn verify $ARGS
+  - mvn -q verify $ARGS
   - mvn javadoc:aggregate
 
 matrix:
diff --git a/pom.xml b/pom.xml
index 6c540d1..0ac2c4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -197,6 +197,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
             <plugin>
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
+                <version>0.13</version>
                 <executions>
                     <execution>
                         <phase>prepare-package</phase>
@@ -207,6 +208,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                     </execution>
                 </executions>
                 <configuration>
+                    <parseSCMIgnoresAsExcludes>false</parseSCMIgnoresAsExcludes>
                     <excludes>
                         <exclude>release.properties</exclude>
                         <exclude>**/target/**</exclude>


---------------------------------------------------------------------
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] 15/25: Process pending Java callback first

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 372b448aa279480f83cea5af18564eec1ceb2d4e
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 23 06:53:19 2020 +0100

    Process pending Java callback first
---
 .../src/main/java/org/netbeans/html/presenters/spi/Generic.java   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index e452569..83e5398 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -758,6 +758,14 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                 log(Level.FINE, "Flushing {0}", fn);
             }
 
+            {
+                Item c = topMostCall();
+                if (c != null && c.method != null) {
+                    c.inJava();
+                    lock().notifyAll();
+                }
+            }
+
             Item myCall;
             boolean load;
             final Item top = topMostCall();


---------------------------------------------------------------------
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] 05/25: Only attempt to mangle the encoding on pre-JDK11 virtual machines

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 f72cb974515ed9115722f0452f44bfa3a5628519
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 9 05:59:06 2020 +0100

    Only attempt to mangle the encoding on pre-JDK11 virtual machines
---
 .../main/java/net/java/html/json/tests/JSONTest.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java b/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
index 6aaf236..f88a201 100644
--- a/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
+++ b/json-tck/src/main/java/net/java/html/json/tests/JSONTest.java
@@ -51,14 +51,16 @@ public final class JSONTest {
     private String url;
 
     static {
-        try {
-            System.setProperty("file.encoding", "windows-1251");
-            Field f = Charset.class.getDeclaredField("defaultCharset");
-            f.setAccessible(true);
-            f.set(null, null);
-            assertEquals(Charset.defaultCharset().toString(), "windows-1251", "Encoding has been changed");
-        } catch (Throwable t) {
-            t.printStackTrace();
+        if (System.getProperty("java.version").startsWith("1.")) {
+            try {
+                System.setProperty("file.encoding", "windows-1251");
+                Field f = Charset.class.getDeclaredField("defaultCharset");
+                f.setAccessible(true);
+                f.set(null, null);
+                assertEquals(Charset.defaultCharset().toString(), "windows-1251", "Encoding has been changed");
+            } catch (Throwable t) {
+                t.printStackTrace();
+            }
         }
     }
 


---------------------------------------------------------------------
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] 24/25: Only generate Javadoc on JDK15

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 74c908bdeeddf1efb9c42b3561c3bb82fb2fc355
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 11:14:54 2020 +0100

    Only generate Javadoc on JDK15
---
 .travis.yml | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d760a9d..99f3300 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,7 +33,7 @@ script:
   - $JAVA_HOME/bin/java -version
   - mvn install -DskipTests $ARGS
   - mvn -q verify $ARGS
-  - mvn javadoc:aggregate
+  - if [ -n "$JAVADOC" ]; then mvn javadoc:aggregate; fi
 
 matrix:
   include:
@@ -52,17 +52,12 @@ matrix:
       env:
         - ARGS=-Dnone
     - os: linux
-      name: Linux JDK14
-      dist: trusty
-      jdk: openjdk14
-      env:
-        - ARGS=-Dnone
-    - os: linux
       name: Linux JDK15 (latest)
       dist: trusty
       jdk: openjdk15
       env:
         - ARGS=-Dnone
+        - JAVADOC=yes
     - os: osx
       name: Mac JDK8
       osx_image: xcode9.3


---------------------------------------------------------------------
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] 08/25: Run the asynch JavaScript action test with and without JavaScript callback

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 698659d9501e5bc7da247e3cf9fac4927b616701
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Dec 22 06:52:16 2020 +0100

    Run the asynch JavaScript action test with and without JavaScript callback
---
 .../java/html/js/tests/AsyncJavaScriptAction.java  | 36 +++++++++++++++-------
 .../net/java/html/js/tests/JavaScriptBodyTest.java | 12 ++++++--
 .../main/java/net/java/html/js/tests/JsUtils.java  | 24 ++++++++++-----
 .../org/netbeans/html/json/tck/JavaScriptTCK.java  | 10 ++++--
 4 files changed, 58 insertions(+), 24 deletions(-)

diff --git a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
index a9f20af..b885f75 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/AsyncJavaScriptAction.java
@@ -19,16 +19,18 @@
 package net.java.html.js.tests;
 
 import java.util.List;
+import java.util.function.Function;
 import net.java.html.js.JavaScriptBody;
 import static net.java.html.js.tests.JavaScriptBodyTest.assertEquals;
 
 final class AsyncJavaScriptAction {
-    List<Integer> collected = new java.util.ArrayList<>();
+    private List<Integer> collected = new java.util.ArrayList<>();
+    private boolean successStoringLater;
 
     @JavaScriptBody(args = { "n" }, javacall = true, body = """
-        return this.@net.java.html.js.tests.AsyncJavaScriptAction::performTheTest(I)(n);
+        return this.@net.java.html.js.tests.AsyncJavaScriptAction::performIteration(I)(n);
     """)
-    private native int r(int n);
+    private native int enterJavaScriptAndPerformIteration(int n);
 
     @JavaScriptBody(args = {}, javacall = true, body = """
         var self = this;
@@ -48,32 +50,44 @@ final class AsyncJavaScriptAction {
         collected.add(value);
     }
 
-    int performTheTest(int from) throws Exception {
+    int performIteration(int from) {
         for (int i = 0; i < 5; i++) {
             jsStore(from++);
         }
         final String n = "" + from++;
-        JsUtils.executeNow(AsyncJavaScriptAction.class, """
-            storeLater({n});
-        """.replace("{n}", n));
+        successStoringLater = JsUtils.executeNow(AsyncJavaScriptAction.class, "storeLater(" + n + ");");
         for (int i = 6; i < 11; i++) {
             jsStore(from++);
         }
         return from;
     }
 
-    public void runTheWholeTest() {
+    private void performTheTest(Function<Integer,Integer> iteration) {
         defineStore();
-        assertEquals(r(0), 11);
+        assertEquals(iteration.apply(0), 11);
+        if (!successStoringLater) {
+            return;
+        }
         assertEquals(collected.size(), 11, "11 items: " + collected);
         for (int i = 0; i < 11; i++) {
             assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);
         }
-        assertEquals(r(11), 22);
-
+        assertEquals(iteration.apply(11), 22);
+        if (!successStoringLater) {
+            return;
+        }
         assertEquals(collected.size(), 22, "22 items: " + collected);
         for (int i = 0; i < 22; i++) {
             assertEquals(collected.get(i).intValue(), i, i + "th out of order: " + collected);
         }
     }
+
+    public void testWithCallback() {
+        performTheTest(this::enterJavaScriptAndPerformIteration);
+    }
+
+    public void testWithoutCallback() {
+        performTheTest(this::performIteration);
+    }
+
 }
diff --git a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
index 3a0e8cf..c2f8eef 100644
--- a/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
+++ b/json-tck/src/main/java/net/java/html/js/tests/JavaScriptBodyTest.java
@@ -411,12 +411,12 @@ public class JavaScriptBodyTest {
             return;
         }
         if (l == null) {
-            JsUtils.executeNow(JavaScriptBodyTest.class,
+            JsUtils.execute(JavaScriptBodyTest.class,
                 "if (typeof window === 'undefined') window = {};"
             );
             l = new Later();
             l.register();
-            JsUtils.executeNow(JavaScriptBodyTest.class,
+            JsUtils.execute(JavaScriptBodyTest.class,
                 "window.later();"
             );
         }
@@ -429,7 +429,13 @@ public class JavaScriptBodyTest {
     @KOTest
     public void asynchCallFromJavaScriptInMiddleOfDefferedProcessing() {
         AsyncJavaScriptAction t = new AsyncJavaScriptAction();
-        t.runTheWholeTest();
+        t.testWithoutCallback();
+    }
+
+    @KOTest
+    public void asynchCallFromJavaScriptInMiddleOfDefferedProcessingFromCallback() {
+        AsyncJavaScriptAction t = new AsyncJavaScriptAction();
+        t.testWithCallback();
     }
 
     @KOTest
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 de99cca..2a26248 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
@@ -32,15 +32,25 @@ public class JsUtils {
         instantiatedJsTCK = tck;
     }
 
-    static void executeNow(Class<?> clazz, String script) throws Exception {
-        if (instantiatedJsTCK != null) {
-            instantiatedJsTCK.executeNow(script);
-        } else {
-            Fn.Presenter p = Fn.activePresenter();
-            if (p != null) {
-                p.loadScript(new StringReader(script));
+    static void execute(Class<?> clazz, String script) throws Exception {
+        Fn.Presenter p = Fn.activePresenter();
+        p.loadScript(new StringReader(script));
+    }
+
+    static boolean executeNow(Class<?> clazz, String script) {
+        try {
+            if (instantiatedJsTCK != null) {
+                return instantiatedJsTCK.executeNow(script);
+            } else {
+                execute(clazz, script);
+                return true;
             }
+        } catch (Exception ex) {
+            throw raise(RuntimeException.class, ex);
         }
     }
 
+    private static <E extends Throwable> E raise(Class<E> e, Throwable t) throws E {
+        throw (E)t;
+    }
 }
diff --git a/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java b/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
index 13c5350..0b2f543 100644
--- a/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
+++ b/json-tck/src/main/java/org/netbeans/html/json/tck/JavaScriptTCK.java
@@ -85,14 +85,18 @@ public abstract class JavaScriptTCK {
 
     /** Executes JavaScript now. Simulates that something suddenly happens
      * in the JavaScript while Java code may already be doing something
-     * different.
+     * different. If it is not possible to execute the JavaScript - for
+     * example the JavaScript engine is blocked by currently running request,
+     * then return {@code false} and let the TCK test terminate gracefully.
      *
      * @param script the script to execute in the JavaScript
-     * @throws Exception if something goes wrong
+     * @return {@code true} if the script was executed, {@code false} if it couldn't be
+     * @throws Exception if the script contains an error
      * @since 1.7.1
      */
-    public void executeNow(String script) throws Exception {
+    public boolean executeNow(String script) throws Exception {
         Presenter p = Fn.activePresenter();
         p.loadScript(new StringReader(script));
+        return true;
     }
 }


---------------------------------------------------------------------
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] 19/25: Don't hold a reference to item when scheduling pending check

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 627e73b93a71b01848f0f9c1b69793c99d9e7a79
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 08:13:28 2020 +0100

    Don't hold a reference to item when scheduling pending check
---
 .../org/netbeans/html/presenters/spi/Generic.java  | 41 ++++++++++++----------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index 3204355..1da8eb7 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -509,7 +509,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         void callbackReady(String name);
     }
     
-    private class Item implements Runnable {
+    private class Item {
         final int id;
         final Item prev;
         Boolean done;
@@ -554,15 +554,6 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
             }
         }
         
-        @Override public void run() {
-            synchronized (lock()) {
-                log(Level.FINE, "run: {0}", this);
-                inJava();
-                lock().notifyAll();
-            }
-        }
-        
-
         protected String js(boolean[] finished) {
             if (Boolean.TRUE.equals(done)) {
                 StringBuilder sb = new StringBuilder();
@@ -683,14 +674,9 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                     return def.toString();
                 }
                 finished[0] = false;
-                final Item top = topMostCall();
-                if (top.method != null) {
-                    if (top.done == null) {
-                        dispatch(top);
-                        if (getDeferred(false) != null) {
-                            continue;
-                        }
-                    }
+                final Item top = dispatchPendingItem();
+                if (top == null) {
+                    continue;
                 }
                 String jsToExec = top.inJavaScript(finished);
                 log(Level.FINE, "jr: {0} jsToExec: {1} finished: {2}", new Object[]{topMostCall(), jsToExec, finished[0]});
@@ -705,6 +691,25 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
         }
     }
 
+    private Item dispatchPendingItem() {
+        final Item top = topMostCall();
+        if (top.method != null && top.done == null) {
+            dispatch(() -> {
+                synchronized (lock()) {
+                    Item pending = topMostCall();
+                    if (pending != null) {
+                        pending.inJava();
+                        lock().notifyAll();
+                    }
+                }
+            });
+            if (getDeferred(false) != null) {
+                return null;
+            }
+        }
+        return top;
+    }
+
     private StringBuilder deferred;
     private boolean deferredDisabled;
     private Collection<Object> arguments = new LinkedList<Object>();


---------------------------------------------------------------------
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] 21/25: Remove done javascript items from the stack

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 ddf50597f17c0dc730765da7c6abb6d091e23936
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 09:31:31 2020 +0100

    Remove done javascript items from the stack
---
 .../main/java/org/netbeans/html/presenters/spi/Generic.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index 1da8eb7..3a6a331 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -579,10 +579,10 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
 
         protected String sj(boolean[] finished) {
             finished[0] = false;
-            if (Boolean.TRUE.equals(done)) {
+            if (done != null) {
                 return null;
             }
-            done = true;
+            done = false;
             return "javascript:" + toExec;
         }
 
@@ -592,6 +592,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
             }
             this.typeof = typeof;
             this.result = result;
+            this.done = true;
             log(Level.FINE, "result ({0}): {1} for {2}", typeof, result, toExec);
         }
     } // end of Item
@@ -618,7 +619,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                 return;
             }
             Item it = top;
-            while (it != null) {
+            while (it.prev != null) {
                 Item process = it.prev;
                 if (process.id == id) {
                     process.result(typeof, res);
@@ -1027,6 +1028,9 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
 
     private Item registerCall(Item call) {
         assert Thread.holdsLock(lock());
+        while (call != null && call.method == null && Boolean.TRUE.equals(call.done)) {
+            call = call.prev;
+        }
         this.call = call;
         lock().notifyAll();
         return call;


---------------------------------------------------------------------
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] 11/25: Exclude nbactions.xml from license checks

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 77213bb00003225a814d7c911b464dfded9deeb4
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Dec 22 14:05:18 2020 +0100

    Exclude nbactions.xml from license checks
---
 .gitignore                                             |  3 ++-
 .../netbeans/html/presenters/spi/test/GenericTCK.java  | 18 ++++++++++++++++++
 pom.xml                                                |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 2987134..8971744 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
 /target/
 *.orig
 */nb-configuration.xml
+*/nbactions.xml
 /html4j-maven-plugin/src/test/resources/org/netbeans/html/mojo/gradle*/build/*
 /html4j-maven-plugin/src/test/resources/org/netbeans/html/mojo/gradle*/.gradle/*
-/html4j-maven-plugin/src/test/resources/org/netbeans/html/mojo/gradle*/.nb*gradle/*
\ No newline at end of file
+/html4j-maven-plugin/src/test/resources/org/netbeans/html/mojo/gradle*/.nb*gradle/*
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
index cd8a87e..dedbc70 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
@@ -1,3 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.netbeans.html.presenters.spi.test;
 
 import java.util.HashMap;
diff --git a/pom.xml b/pom.xml
index bbd2559..791fc9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -219,6 +219,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                         <exclude>**/.maven/**</exclude>
                         <exclude>**/*.sigtest</exclude>
                         <exclude>**/nb-configuration.xml</exclude>
+                        <exclude>**/nbactions.xml</exclude>
                         <exclude>README.md</exclude>
                         <exclude>DEPENDENCIES</exclude>
                         <exclude>**/main/resources/org/netbeans/html/ko4j/knockout-3.5.0.js</exclude>


---------------------------------------------------------------------
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] 09/25: Separating generic TCK into its own class

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 6e6cca878662de0f5dfa2c54a097b67232a09c13
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Tue Dec 22 07:25:25 2020 +0100

    Separating generic TCK into its own class
---
 .../html/presenters/spi/test/CallbackTest.java     |  7 +---
 .../html/presenters/spi/test/GenericTCK.java       | 32 ++++++++++++++
 .../html/presenters/spi/test/GenericTest.java      | 21 +---------
 .../html/presenters/spi/test/SynchronizedTest.java | 36 +++++++++++++++-
 .../netbeans/html/presenters/spi/test/Testing.java | 49 +++-------------------
 5 files changed, 75 insertions(+), 70 deletions(-)

diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
index 9aa2aeb..cdf0341 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/CallbackTest.java
@@ -19,7 +19,6 @@
 package org.netbeans.html.presenters.spi.test;
 
 import java.lang.reflect.Method;
-import java.util.concurrent.CountDownLatch;
 import java.util.logging.Level;
 import javax.script.ScriptException;
 import static org.testng.Assert.assertEquals;
@@ -39,7 +38,7 @@ public class CallbackTest {
     private static final class CBP extends Testing {
 
         @Override
-        protected void loadJS(String js, CountDownLatch notify) {
+        protected void loadJS(String js) {
             dispatch(new Runnable () {
                 @Override
                 public void run() {
@@ -48,12 +47,10 @@ public class CallbackTest {
                         LOG.log(Level.FINE, "counter res: {0}", res);
                     } catch (ScriptException ex) {
                         LOG.log(Level.SEVERE, null, ex);
-                    } finally {
-                        notify.countDown();
                     }
                 }
             });
-            super.loadJS(js, notify);
+            super.loadJS(js);
         }
 
         @Override void beforeTest(Class<?> testClass) throws Exception {
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
new file mode 100644
index 0000000..cd8a87e
--- /dev/null
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
@@ -0,0 +1,32 @@
+package org.netbeans.html.presenters.spi.test;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.html.boot.spi.Fn;
+import org.netbeans.html.json.tck.JavaScriptTCK;
+import org.netbeans.html.presenters.spi.ProtoPresenter;
+import static org.testng.Assert.assertNotNull;
+
+final class GenericTCK extends JavaScriptTCK {
+    static final GenericTCK INSTANCE = new GenericTCK();
+
+    private final Map<ProtoPresenter, Testing> MAP = new HashMap<>();
+    private GenericTCK() {
+    }
+
+    @Override
+    public boolean executeNow(String script) throws Exception {
+        Testing t = MAP.get(Fn.activePresenter());
+        assertNotNull(t, "Testing framework found");
+        return t.sync ? t.eng.eval(script) != this : false;
+    }
+
+    public static Class[] tests() {
+        return testClasses();
+    }
+
+    void register(ProtoPresenter presenter, Testing testing) {
+        MAP.put(presenter, testing);
+    }
+
+}
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
index 9999365..668d127 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTest.java
@@ -22,17 +22,13 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
 import net.java.html.boot.BrowserBuilder;
 import org.netbeans.html.boot.spi.Fn;
-import org.netbeans.html.json.tck.JavaScriptTCK;
 import org.netbeans.html.json.tck.KOTest;
-import static org.testng.Assert.assertNotNull;
 import org.testng.annotations.Factory;
 
-public class GenericTest extends JavaScriptTCK {
+public class GenericTest {
     private static Class<?> browserClass;
     
     public GenericTest() {
@@ -76,19 +72,6 @@ public class GenericTest extends JavaScriptTCK {
         }
     }
 
-    @Override
-    public void executeNow(String script) throws Exception {
-        Testing t = Testing.MAP.get(Fn.activePresenter());
-        assertNotNull(t, "Testing framework found");
-        CountDownLatch cdl = new CountDownLatch(1);
-        t.loadJS(script, cdl);
-        cdl.await(5, TimeUnit.SECONDS);
-    }
-    
-    public static Class[] tests() {
-        return testClasses();
-    }
-
     static synchronized Class<?> loadClass() throws InterruptedException {
         while (browserClass == null) {
             GenericTest.class.wait();
@@ -104,6 +87,6 @@ public class GenericTest extends JavaScriptTCK {
     public static void initialized() throws Exception {
         Class<?> classpathClass = ClassLoader.getSystemClassLoader().loadClass(GenericTest.class.getName());
         Method m = classpathClass.getMethod("ready", Class.class);
-        m.invoke(null, GenericTest.class);
+        m.invoke(null, GenericTCK.class);
     }
 }
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/SynchronizedTest.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/SynchronizedTest.java
index fe7b3cb..cf20bad 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/SynchronizedTest.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/SynchronizedTest.java
@@ -18,12 +18,44 @@
  */
 package org.netbeans.html.presenters.spi.test;
 
+import java.net.URL;
+import java.util.logging.Level;
 import static org.netbeans.html.presenters.spi.test.GenericTest.createTests;
+import static org.netbeans.html.presenters.spi.test.Testing.LOG;
 import org.testng.annotations.Factory;
 
 public class SynchronizedTest {
     @Factory public static Object[] compatibilityTests() throws Exception {
-        return createTests(new Testing.Synchronized());
+        return createTests(new Synchronized());
     }
-    
+
+    private static class Synchronized extends Testing {
+        public Synchronized() {
+            super(true, (r) -> r.run());
+        }
+
+        @Override
+        protected void loadJS(final String js) {
+            try {
+                Object res = eng.eval(js);
+                LOG.log(Level.FINE, "Result: {0}", res);
+            } catch (Throwable ex) {
+                LOG.log(Level.SEVERE, "Can't process " + js, ex);
+            }
+        }
+
+        @Override
+        public void displayPage(URL url, Runnable r) {
+            r.run();
+        }
+
+        @Override
+        public void dispatch(Runnable r) {
+            r.run();
+        }
+
+        @Override
+        void beforeTest(Class<?> declaringClass) throws Exception {
+        }
+    } // end of Synchronized
 }
diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
index ccab68a..da3bb7b 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/Testing.java
@@ -19,9 +19,6 @@
 package org.netbeans.html.presenters.spi.test;
 
 import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import java.util.logging.Level;
@@ -39,7 +36,6 @@ class Testing {
     final ScriptEngine eng;
     final boolean sync;
     final ProtoPresenter presenter;
-    static final Map<ProtoPresenter, Testing> MAP = new HashMap<>();
 
     public Testing() {
         this(false);
@@ -55,14 +51,12 @@ class Testing {
             .app("Testing")
             .type("test")
             .dispatcher(QUEUE, false)
-            .loadJavaScript((s) -> {
-                loadJS(s, new java.util.concurrent.CountDownLatch(1));
-            }, sync)
+            .loadJavaScript(this::loadJS, sync)
             .displayer(this::displayPage)
             .preparator(this::callbackFn, true)
             .logger(this::log)
             .build();
-        MAP.put(this.presenter, this);
+        GenericTCK.INSTANCE.register(this.presenter, this);
 
         ScriptEngineManager sem = new ScriptEngineManager();
         eng = sem.getEngineByMimeType("text/javascript");
@@ -71,7 +65,8 @@ class Testing {
             eng.eval("function alert(m) { Packages.java.lang.System.out.println(m); };");
         } catch (ScriptException ex) {
             throw new IllegalStateException(ex);
-        }        
+        }
+
     }
 
     protected void log(int priority, String msg, Object... args) {
@@ -127,7 +122,7 @@ class Testing {
         ready.callbackIsPrepared("testingCB");
     }
 
-    protected void loadJS(final String js, CountDownLatch notify) {
+    protected void loadJS(final String js) {
         QUEUE.execute(new Runnable() {
             public void run() {
                 try {
@@ -135,8 +130,6 @@ class Testing {
                     LOG.log(Level.FINE, "Result: {0}", res);
                 } catch (Throwable ex) {
                     LOG.log(Level.SEVERE, "Can't process " + js, ex);
-                } finally {
-                    notify.countDown();
                 }
             }
         });
@@ -152,36 +145,4 @@ class Testing {
 
     void beforeTest(Class<?> declaringClass) throws Exception {
     }
-    
-    static class Synchronized extends Testing {
-        public Synchronized() {
-            super(true, (r) -> r.run());
-        }
-
-        @Override
-        protected void loadJS(final String js, CountDownLatch notify) {
-            try {
-                Object res = eng.eval(js);
-                LOG.log(Level.FINE, "Result: {0}", res);
-            } catch (Throwable ex) {
-                LOG.log(Level.SEVERE, "Can't process " + js, ex);
-            } finally {
-                notify.countDown();
-            }
-        }
-
-        @Override
-        public void displayPage(URL url, Runnable r) {
-            r.run();
-        }
-
-        @Override
-        public void dispatch(Runnable r) {
-            r.run();
-        }
-
-        @Override
-        void beforeTest(Class<?> declaringClass) throws Exception {
-        }
-    } // end of Synchronized
 }


---------------------------------------------------------------------
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] 16/25: No need to obtain for locking in exec

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 5b0a977698930c7fc400355bc29f27a1a1146e39
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 23 14:24:24 2020 +0100

    No need to obtain for locking in exec
---
 .../org/netbeans/html/presenters/spi/Generic.java  | 82 +++++++++++-----------
 1 file changed, 40 insertions(+), 42 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index 83e5398..fd06b6d 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -748,56 +748,54 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
     }
 
     final Object exec(int id, String fn) {
-        Object ret;
+        assert Thread.holdsLock(lock());
         boolean first;
-        synchronized (lock()) {
-            if (deferred != null) {
-                deferred.append(fn);
-                fn = deferred.toString();
-                deferred = null;
-                log(Level.FINE, "Flushing {0}", fn);
-            }
+        if (deferred != null) {
+            deferred.append(fn);
+            fn = deferred.toString();
+            deferred = null;
+            log(Level.FINE, "Flushing {0}", fn);
+        }
 
-            {
-                Item c = topMostCall();
-                if (c != null && c.method != null) {
-                    c.inJava();
-                    lock().notifyAll();
-                }
+        {
+            Item c = topMostCall();
+            if (c != null && c.method != null) {
+                c.inJava();
+                lock().notifyAll();
             }
+        }
 
-            Item myCall;
-            boolean load;
-            final Item top = topMostCall();
-            if (top != null) {
-                myCall = registerCall(new Item(id, top, fn));
-                load = synchronous;
-                first = false;
-            } else {
-                myCall = registerCall(new Item(id, null, null));
-                load = true;
-                first = true;
+        Item myCall;
+        boolean load;
+        final Item top = topMostCall();
+        if (top != null) {
+            myCall = registerCall(new Item(id, top, fn));
+            load = synchronous;
+            first = false;
+        } else {
+            myCall = registerCall(new Item(id, null, null));
+            load = true;
+            first = true;
+        }
+        if (load) {
+            loadJS(fn);
+        }
+        for (;;) {
+            if (myCall.typeof != null) {
+                break;
             }
-            if (load) {
-                loadJS(fn);
+            try {
+                lock().wait();
+            } catch (InterruptedException ex) {
+                log(Level.SEVERE, null, ex);
             }
-            for (;;) {
-                if (myCall.typeof != null) {
-                    break;
-                }
-                try {
-                    lock().wait();
-                } catch (InterruptedException ex) {
-                    log(Level.SEVERE, null, ex);
-                }
-                Item c = topMostCall();
-                if (c != null) {
-                    c.inJava();
-                }
-                lock().notifyAll();
+            Item c = topMostCall();
+            if (c != null) {
+                c.inJava();
             }
-            ret = valueOf(myCall.typeof, (String) myCall.result);
+            lock().notifyAll();
         }
+        Object ret = valueOf(myCall.typeof, (String) myCall.result);
         if (first) {
             arguments.clear();
         }


---------------------------------------------------------------------
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] 03/25: codesnippet4javadoc 0.60 works on JDK15

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 328c6fa6a24bc31fa767c5c05600bfe656e27100
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 9 04:41:58 2020 +0100

    codesnippet4javadoc 0.60 works on JDK15
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 6e875e2..6c540d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -152,7 +152,7 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
                 <docletArtifact>
                     <groupId>org.apidesign.javadoc</groupId>
                     <artifactId>codesnippet-doclet</artifactId>
-                    <version>0.54</version>
+                    <version>0.60</version>
                 </docletArtifact>
                 <additionalOptions>
                     -snippetpath boot-fx/src/test


---------------------------------------------------------------------
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] 06/25: Improving readability by using text blocks

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 d4fe0e95c0801b34359206cbb80dceb2b01cc431
Merge: 1e383e4 784196d
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Mon Dec 21 14:12:03 2020 +0100

    Improving readability by using text blocks

 .../netbeans/html/boot/fx/AbstractFXPresenter.java |  21 +-
 .../java/org/netbeans/html/boot/fx/FXConsole.java  |  11 +-
 .../java/html/boot/script/KnockoutEnvJSTest.java   |   7 +-
 .../java/html/boot/script/ScriptEngineTest.java    |  28 +-
 .../org/netbeans/html/boot/impl/JsCallback.java    |  15 +-
 .../html/boot/impl/JavaScriptProcesorTest.java     | 187 +++---
 .../netbeans/html/boot/impl/JsCallbackTest.java    |   8 +-
 .../org/netbeans/html/boot/impl/JsMethods.java     |  28 +-
 .../java/org/netbeans/html/boot/impl/JsUtils.java  |  27 +-
 .../presenters/browser/JavaScriptUtilities.java    |  11 +-
 .../org/netbeans/html/presenters/spi/Generic.java  | 211 +++---
 .../org/netbeans/html/geo/impl/JsGLProvider.java   |  36 +-
 .../netbeans/html/geo/impl/GeoProcessorTest.java   |  69 +-
 json-tck/pom.xml                                   |   8 -
 .../main/java/net/java/html/js/tests/Bodies.java   | 151 +++--
 .../java/net/java/html/js/tests/Factorial.java     |   7 +-
 .../main/java/net/java/html/js/tests/Receiver.java |   8 +-
 .../src/main/java/net/java/html/js/tests/Sum.java  |  20 +-
 .../net/java/html/json/tests/GCKnockoutTest.java   |  36 +-
 .../net/java/html/json/tests/KnockoutTest.java     | 306 ++++-----
 .../java/net/java/html/json/tests/MinesTest.java   |  33 +-
 .../main/java/net/java/html/json/tests/Utils.java  |  98 +--
 .../netbeans/html/json/impl/ModelProcessor.java    |  68 +-
 .../net/java/html/json/ModelProcessorTest.java     | 710 +++++++++++----------
 .../html/ko/felix/test/KnockoutFelixTCKImpl.java   |  11 +-
 .../html/ko/osgi/test/KnockoutEquinoxTCKImpl.java  |  11 +-
 .../java/org/netbeans/html/wstyrus/LoadJSON.java   |  11 +-
 .../netbeans/html/wstyrus/TyrusKnockoutTest.java   |  11 +-
 .../main/java/org/netbeans/html/ko4j/Knockout.java | 234 +++----
 .../main/java/org/netbeans/html/ko4j/LoadJSON.java |  88 +--
 .../main/java/org/netbeans/html/ko4j/LoadWS.java   |  59 +-
 .../org/netbeans/html/ko4j/KnockoutFXTest.java     |  11 +-
 pom.xml                                            |   7 +-
 .../html/presenters/webkit/GtkKnockoutTest.java    |  17 +-
 .../java/org/netbeans/html/xhr4j/LoadJSON.java     |  24 +-
 .../org/netbeans/html/xhr4j/JsonKnockoutTest.java  |  11 +-
 36 files changed, 1366 insertions(+), 1233 deletions(-)

diff --cc json-tck/src/main/java/net/java/html/json/tests/MinesTest.java
index e436bd8,f33e557..2fac125
--- a/json-tck/src/main/java/net/java/html/json/tests/MinesTest.java
+++ b/json-tck/src/main/java/net/java/html/json/tests/MinesTest.java
@@@ -40,23 -40,22 +40,22 @@@ public final class MinesTest 
      @KOTest public void paintTheGridOnClick() throws Throwable {
          if (m == null) {
              BrwsrCtx ctx = Utils.newContext(MinesTest.class);
-             Object exp = Utils.exposeHTML(MinesTest.class,
-     "            <button id='init' data-bind='click: normalSize'></button>\n" +
-     "            <table>\n" +
-     "                <tbody id='table'>\n" +
-     "                    <!-- ko foreach: rows -->\n" +
-     "                    <tr>\n" +
-     "                        <!-- ko foreach: columns -->\n" +
-     "                        <td data-bind='css: style' >\n" +
-     "                            <div data-bind='text: html'></div>\n" +
-     "                        </td>\n" +
-     "                        <!-- /ko -->\n" +
-     "                    </tr>\n" +
-     "                    <!-- /ko -->\n" +
-     "                </tbody>\n" +
-     "            </table>\n" +
-     ""
-             );
+             Object exp = Utils.exposeHTML(MinesTest.class, """
 -                                                                       <button id='init' data-bind='click: normalSize'></button>
 -                                                                       <table>
 -                                                                           <tbody id='table'>
 -                                                                               <!-- ko foreach: rows -->
 -                                                                               <tr>
 -                                                                                   <!-- ko foreach: columns -->
 -                                                                                   <td data-bind='css: style' >
 -                                                                                       <div data-bind='text: html'></div>
 -                                                                                   </td>
 -                                                                                   <!-- /ko -->
 -                                                                               </tr>
 -                                                                               <!-- /ko -->
 -                                                                           </tbody>
 -                                                                       </table>
 -                                                           """);
++                <button id='init' data-bind='click: normalSize'></button>
++                <table>
++                    <tbody id='table'>
++                        <!-- ko foreach: rows -->
++                        <tr>
++                            <!-- ko foreach: columns -->
++                            <td data-bind='css: style' >
++                                <div data-bind='text: html'></div>
++                            </td>
++                            <!-- /ko -->
++                        </tr>
++                        <!-- /ko -->
++                    </tbody>
++                </table>
++            """);
              m = Models.bind(new Mines(), ctx);
              m.applyBindings();
              int cnt = Utils.countChildren(MinesTest.class, "table");
diff --cc json-tck/src/main/java/net/java/html/json/tests/Utils.java
index 94a2e3a,7eb8ffd..3a7aca6
--- a/json-tck/src/main/java/net/java/html/json/tests/Utils.java
+++ b/json-tck/src/main/java/net/java/html/json/tests/Utils.java
@@@ -160,19 -161,6 +161,22 @@@ public final class Utils 
          );
      }
      
 +    static void scheduleClick(Class<?> clazz, String id, int delay) throws Exception {
-         String s = "var id = arguments[0]; var delay = arguments[1];"
-             + "var e = window.document.getElementById(id);\n "
-             + "var f = function() {;\n "
-             + "  var ev = window.document.createEvent('MouseEvents');\n "
-             + "  ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n "
-             + "  e.dispatchEvent(ev);\n"
-             + "};\n"
-             + "window.setTimeout(f, delay);";
++        String s = """
++            var id = arguments[0];
++            var delay = arguments[1];
++            var e = window.document.getElementById(id);
++            var f = function() {;
++                var ev = window.document.createEvent('MouseEvents');
++                ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
++                e.dispatchEvent(ev);
++            };
++            window.setTimeout(f, delay);
++            """;
 +        Utils.executeScript(clazz, s, id, delay);
 +    }
 +    
 +    
      static String prepareURL(
          Class<?> clazz, String content, String mimeType, String... parameters) {
          for (KnockoutTCK tck : tcks(clazz)) {
diff --cc webkit/src/test/java/org/netbeans/html/presenters/webkit/GtkKnockoutTest.java
index 0318685,860c72e..bdf851e
--- a/webkit/src/test/java/org/netbeans/html/presenters/webkit/GtkKnockoutTest.java
+++ b/webkit/src/test/java/org/netbeans/html/presenters/webkit/GtkKnockoutTest.java
@@@ -187,16 -179,15 +187,19 @@@ public final class GtkKnockoutTest exte
      )
      public native Object executeScript(String script, Object[] arguments);
  
-     @JavaScriptBody(args = {  }, body =
-           "var h;"
-         + "if (!!window && !!window.location && !!window.location.href)\n"
-         + "  h = window.location.href;\n"
-         + "else "
-         + "  h = null;"
-         + "return h;\n"
+     @JavaScriptBody(args = {  }, body = 
+           """
 -          var h;if (!!window && !!window.location && !!window.location.href)
++          var h;
++          if (!!window && !!window.location && !!window.location.href) {
+             h = window.location.href;
 -          else   h = null;return h;
++          } else {
++            h = null;
++          }
++          return h;
+           """
      )
      private static native String findBaseURL();
 -    
 +
      @Override
      public URI prepareURL(String content, String mimeType, String[] parameters) {
          try {


---------------------------------------------------------------------
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] 14/25: Try harder to executeNow in asynchronous processors

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 a3567854ae6b24a9ab1509c99b71f799f5ceaa3d
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Wed Dec 23 06:24:11 2020 +0100

    Try harder to executeNow in asynchronous processors
---
 .../html/presenters/spi/test/GenericTCK.java       | 29 +++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
index dedbc70..872ad98 100644
--- a/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
+++ b/generic/src/test/java/org/netbeans/html/presenters/spi/test/GenericTCK.java
@@ -20,6 +20,9 @@ package org.netbeans.html.presenters.spi.test;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.script.ScriptException;
 import org.netbeans.html.boot.spi.Fn;
 import org.netbeans.html.json.tck.JavaScriptTCK;
 import org.netbeans.html.presenters.spi.ProtoPresenter;
@@ -36,7 +39,31 @@ final class GenericTCK extends JavaScriptTCK {
     public boolean executeNow(String script) throws Exception {
         Testing t = MAP.get(Fn.activePresenter());
         assertNotNull(t, "Testing framework found");
-        return t.sync ? t.eng.eval(script) != this : false;
+        if (t.sync) {
+            t.eng.eval(script);
+            return true;
+        } else {
+            CountDownLatch cdl = new CountDownLatch(1);
+            Exception[] error = { null };
+            boolean[] queueEntered = { false };
+            t.QUEUE.execute(() -> {
+                if (cdl.getCount() == 1) {
+                    try {
+                        queueEntered[0] = true;
+                        t.eng.eval(script);
+                    } catch (ScriptException ex) {
+                        error[0] = ex;
+                    } finally {
+                        cdl.countDown();
+                    }
+                }
+            });
+            cdl.await(3, TimeUnit.SECONDS);
+            if (error[0] != null) {
+                throw error[0];
+            }
+            return queueEntered[0];
+        }
     }
 
     public static Class[] tests() {


---------------------------------------------------------------------
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/25: Testing on JDK15 which no longer provides Nashorn

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 f0fe2b5dd32afbdf5ec46883c5ffed4ace5d4dd9
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Mon Dec 7 07:33:49 2020 +0100

    Testing on JDK15 which no longer provides Nashorn
---
 .travis.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index b220c39..6de3070 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -52,11 +52,17 @@ matrix:
       env:
         - ARGS=-Dnone
     - os: linux
-      name: Linux JDK14 (latest)
+      name: Linux JDK14
       dist: trusty
       jdk: openjdk14
       env:
         - ARGS=-Dnone
+    - os: linux
+      name: Linux JDK15 (latest)
+      dist: trusty
+      jdk: openjdk15
+      env:
+        - ARGS=-Dnone
     - os: osx
       name: Mac JDK8
       osx_image: xcode9.3


---------------------------------------------------------------------
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