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/27 20:04:51 UTC
[netbeans-html4j] branch master updated (d5c4ccf -> 23493b5)
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 d5c4ccf Close the browser window after running the browser tests
new ece738d Use -Dorg.netbeans.html.Generic.wait4js=true to always wait for JavaScript execution to finish
new 8dd6df5 Influence default render selection in the browser tests by a property
new 94cf2a6 Merge remote-tracking branch 'apache/master' into AsyncJavaScriptAction
new 23493b5 Avoid crashes by using firefox for browser tests
The 4 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:
.travis.yml | 8 ++--
browser/pom.xml | 7 +++-
.../netbeans/html/presenters/browser/Browser.java | 27 +-----------
.../html/presenters/browser/ServerTest.java | 22 +---------
generic/pom.xml | 11 +++++
.../org/netbeans/html/presenters/spi/Generic.java | 7 +++-
.../html/presenters/spi/ProtoPresenterBuilder.java | 3 ++
.../org/netbeans/html/presenters/render/Show.java | 48 ++++++++++++++++++----
8 files changed, 74 insertions(+), 59 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/04: Influence default render selection in the
browser tests by a property
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 8dd6df5d880336cdae7580524e603cc89b296efe
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Sun Dec 27 09:20:53 2020 +0100
Influence default render selection in the browser tests by a property
---
browser/pom.xml | 7 +++-
.../netbeans/html/presenters/browser/Browser.java | 27 +-----------
.../html/presenters/browser/ServerTest.java | 22 +---------
.../org/netbeans/html/presenters/render/Show.java | 48 ++++++++++++++++++----
4 files changed, 49 insertions(+), 55 deletions(-)
diff --git a/browser/pom.xml b/browser/pom.xml
index 4647ebd..0cf99e7 100644
--- a/browser/pom.xml
+++ b/browser/pom.xml
@@ -33,6 +33,7 @@
<main.dir>${project.parent.basedir}</main.dir>
<publicPackages>org.netbeans.html.presenters.browser</publicPackages>
<sigtestPackages/>
+ <com.dukescript.presenters.browser>default</com.dukescript.presenters.browser>
</properties>
<build>
<plugins>
@@ -58,7 +59,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.18.1</version>
+ <configuration>
+ <systemPropertyVariables>
+ <com.dukescript.presenters.browser>${com.dukescript.presenters.browser}</com.dukescript.presenters.browser>
+ </systemPropertyVariables>
+ </configuration>
</plugin>
<plugin>
<groupId>org.netbeans.html</groupId>
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 3f509d1..1892f9b 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
@@ -153,32 +153,7 @@ Executor, Closeable {
if ("none".equalsIgnoreCase(impl)) { // NOI18N
return;
}
- if (impl != null) {
- Show.show(impl, page);
- } else {
- IOException one, two;
- try {
- String ui = System.getProperty("os.name").contains("Mac") ?
- "Cocoa" : "GTK";
- Show.show(ui, page);
- return;
- } catch (IOException ex) {
- one = ex;
- }
- try {
- Show.show("AWT", page);
- return;
- } catch (IOException ex) {
- two = ex;
- }
- try {
- Show.show(impl, page);
- } catch (IOException ex) {
- two.initCause(one);
- ex.initCause(two);
- throw ex;
- }
- }
+ Show.show(impl, page);
}
@Override
diff --git a/browser/src/test/java/org/netbeans/html/presenters/browser/ServerTest.java b/browser/src/test/java/org/netbeans/html/presenters/browser/ServerTest.java
index 331c17c..6d61be3 100644
--- a/browser/src/test/java/org/netbeans/html/presenters/browser/ServerTest.java
+++ b/browser/src/test/java/org/netbeans/html/presenters/browser/ServerTest.java
@@ -114,27 +114,7 @@ public class ServerTest {
ExecutorService background = Executors.newSingleThreadExecutor();
Future<Void> future = background.submit((Callable<Void>) () -> {
IOException one, two;
- try {
- String ui = System.getProperty("os.name").contains("Mac")
- ? "Cocoa" : "GTK";
- Show.show(ui, page);
- return null;
- } catch (IOException ex) {
- one = ex;
- }
- try {
- Show.show("AWT", page);
- return null;
- } catch (IOException ex) {
- two = ex;
- }
- try {
- Show.show(null, page);
- } catch (IOException ex) {
- two.initCause(one);
- ex.initCause(two);
- throw ex;
- }
+ Show.show(System.getProperty("com.dukescript.presenters.browser"), page);
return null;
});
diff --git a/renderer/src/main/java/org/netbeans/html/presenters/render/Show.java b/renderer/src/main/java/org/netbeans/html/presenters/render/Show.java
index 1a77f9e..d5c5041 100644
--- a/renderer/src/main/java/org/netbeans/html/presenters/render/Show.java
+++ b/renderer/src/main/java/org/netbeans/html/presenters/render/Show.java
@@ -35,23 +35,53 @@ public abstract class Show {
Show() {
}
- /** Shows a page in a browser.
+ /** Shows a page in a browser. Select default implementation
+ * suitable for current system if {@code "default"} or {@code null}.
*
* @param impl the name of implementation to use, can be <code>null</code>
* @param page the page URL
* @throws IOException if something goes wrong
*/
public static void show(String impl, URI page) throws IOException {
+ if (impl == null || "default".equals(impl)) { // NOI18N
+ showOneByOne(page);
+ return;
+ }
+ showOne(impl, page);
+ }
+
+ private static void showOneByOne(URI page) throws IOException {
+ IOException one, two;
+ try {
+ String ui = System.getProperty("os.name").contains("Mac")
+ ? "Cocoa" : "GTK";
+ Show.show(ui, page);
+ return;
+ } catch (IOException ex) {
+ one = ex;
+ }
+ try {
+ Show.show("AWT", page);
+ return;
+ } catch (IOException ex) {
+ two = ex;
+ }
+ try {
+ Show.show("xdg-open", page);
+ } catch (IOException ex) {
+ two.initCause(one);
+ ex.initCause(two);
+ throw ex;
+ }
+ }
+
+ private static void showOne(String impl, URI page) throws IOException {
+ impl.getClass(); // NPE check
try {
Class<?> c = Class.forName(Show.class.getPackage().getName() + '.' + impl);
Show show = (Show) c.newInstance();
show.show(page);
- } catch (IOException ex) {
- throw ex;
- } catch (LinkageError | Exception ex) {
- if (impl == null) {
- impl = "xdg-open";
- }
+ } catch (ClassNotFoundException ex) {
LOG.log(Level.INFO, "Trying command line execution of {0}", impl);
String[] cmdArr = {
impl, page.toString()
@@ -63,6 +93,10 @@ public abstract class Show {
} catch (InterruptedException ex1) {
throw (InterruptedIOException) new InterruptedIOException().initCause(ex1);
}
+ } catch (IOException ex) {
+ throw ex;
+ } catch (LinkageError | Exception ex) {
+ throw new IOException(ex);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[netbeans-html4j] 01/04: Use
-Dorg.netbeans.html.Generic.wait4js=true to always wait for JavaScript
execution to finish
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 ece738df357347cf9087d4538861ba6a47f837e9
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Sun Dec 27 07:40:57 2020 +0100
Use -Dorg.netbeans.html.Generic.wait4js=true to always wait for JavaScript execution to finish
---
.travis.yml | 2 +-
generic/pom.xml | 11 +++++++++++
.../main/java/org/netbeans/html/presenters/spi/Generic.java | 7 ++++++-
.../netbeans/html/presenters/spi/ProtoPresenterBuilder.java | 3 +++
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 99f3300..cfa050e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ before_script:
script:
- $JAVA_HOME/bin/java -version
- mvn install -DskipTests $ARGS
- - mvn -q verify $ARGS
+ - mvn -q verify $ARGS -Dorg.netbeans.html.Generic.wait4js=true
- if [ -n "$JAVADOC" ]; then mvn javadoc:aggregate; fi
matrix:
diff --git a/generic/pom.xml b/generic/pom.xml
index 09b34a5..6500712 100644
--- a/generic/pom.xml
+++ b/generic/pom.xml
@@ -36,6 +36,7 @@
<publicPackages>org.netbeans.html.presenters.spi</publicPackages>
<publicMetaInf/>
<sigtestPackages/>
+ <wait4js>false</wait4js>
</properties>
<dependencies>
@@ -95,6 +96,16 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <org.netbeans.html.Generic.wait4js>${wait4js}</org.netbeans.html.Generic.wait4js>
+ </systemPropertyVariables>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.netbeans.html</groupId>
<artifactId>html4j-maven-plugin</artifactId>
<executions>
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 3a6a331..473749c 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
@@ -67,6 +67,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
this.evalJS = evalJS;
this.type = type;
this.app = app;
+ this.resetDeferredDisabled();
}
final Object lock() {
@@ -764,11 +765,15 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
exec(id, Strings.flushExec(key, id).toString());
}
if (topMostCall() == null) {
- deferredDisabled = false;
+ resetDeferredDisabled();
}
}
}
+ private void resetDeferredDisabled() {
+ deferredDisabled = Boolean.getBoolean("org.netbeans.html.Generic.wait4js");
+ }
+
final Object exec(int id, String fn) {
assert Thread.holdsLock(lock());
boolean first;
diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/ProtoPresenterBuilder.java b/generic/src/main/java/org/netbeans/html/presenters/spi/ProtoPresenterBuilder.java
index f56b56b..cc79a20 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/ProtoPresenterBuilder.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/ProtoPresenterBuilder.java
@@ -26,6 +26,9 @@ import org.netbeans.html.boot.spi.Fn.Presenter;
/** The <em>prototypical</em> presenter builder. Builds a {@link Presenter} based on
* top of textual protocol transferred between JVM and JavaScript engines.
+ * Supports one additional configuration property; by setting
+ * {@code org.netbeans.html.Generic.wait4js}
+ * to {@code true} one enables, more reliable, yet possibly slower, mode.
*/
public final class ProtoPresenterBuilder {
private Evaluator loadScript;
---------------------------------------------------------------------
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/04: Merge remote-tracking branch
'apache/master' into AsyncJavaScriptAction
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 94cf2a68531bedbcb6c6bb457de6c556f2b2a245
Merge: 8dd6df5 d5c4ccf
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Sun Dec 27 09:21:04 2020 +0100
Merge remote-tracking branch 'apache/master' into AsyncJavaScriptAction
.../src/test/java/org/netbeans/html/presenters/browser/KOClose.java | 4 ++--
.../src/test/java/org/netbeans/html/presenters/browser/KOScript.java | 2 +-
2 files changed, 3 insertions(+), 3 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] 04/04: Avoid crashes by using firefox for browser
tests
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 23493b5811c207f9c72281baadde1d613a6f423f
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Sun Dec 27 09:36:57 2020 +0100
Avoid crashes by using firefox for browser tests
---
.travis.yml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index cfa050e..2839167 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,6 +22,7 @@ services:
before_install:
- sudo apt-get -qq update || echo no sudo apt-get
- sudo apt-get install -y libwebkitgtk-3.0-0 || echo no sudo apt-get
+ - sudo apt-get install -y firefox || echo no sudo apt-get
- if [ -n "$URL" ]; then pushd /tmp; curl $URL -o jdk.tgz; tar fxz jdk.tgz; JAVA_HOME=`pwd`/$DIR; popd; export JAVA_HOME; fi
- echo Java is $JAVA_HOME
- ls -l $JAVA_HOME
@@ -31,6 +32,7 @@ before_script:
- sleep 3
script:
- $JAVA_HOME/bin/java -version
+ - if type firefox; then (firefox&); fi
- mvn install -DskipTests $ARGS
- mvn -q verify $ARGS -Dorg.netbeans.html.Generic.wait4js=true
- if [ -n "$JAVADOC" ]; then mvn javadoc:aggregate; fi
@@ -42,7 +44,7 @@ matrix:
dist: trusty
jdk: openjdk8
env:
- - ARGS=-Dnone
+ - ARGS=-Dcom.dukescript.presenters.browser=firefox
- DIR=zulu8.40.0.25-ca-fx-jdk8.0.222-linux_x64
- URL=https://cdn.azul.com/zulu/bin/$DIR.tar.gz
- os: linux
@@ -56,7 +58,7 @@ matrix:
dist: trusty
jdk: openjdk15
env:
- - ARGS=-Dnone
+ - ARGS=-Dcom.dukescript.presenters.browser=firefox
- JAVADOC=yes
- os: osx
name: Mac JDK8
---------------------------------------------------------------------
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