Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/full-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
- name: Checkout GWT tools into a sibling directory
uses: actions/checkout@v4
with:
repository: 'gwtproject/tools'
repository: 'zbynek/tools'
ref: 'htmlunit-4'
path: 'tools'
- name: Set up JDK ${{ matrix.java-version }}
# GWT requires Java 11+ to build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/quick-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
- name: Checkout GWT tools into a sibling directory
uses: actions/checkout@v4
with:
repository: 'gwtproject/tools'
repository: 'zbynek/tools'
ref: 'htmlunit-4'
path: 'tools'
- name: Set up JDK ${{ matrix.java-version }}
# GWT presently requires Java 11+ to build
Expand Down
55 changes: 28 additions & 27 deletions dev/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,20 @@
<include name="tomcat/tomcat-annotations-api-8.0.28.jar"/>
<include name="apache/commons/commons-collections-3.2.2.jar"/>
<!-- htmlunit dependencies not already included: BEGIN -->
<include name="apache/http/httpclient-4.5.13.jar"/>
<include name="apache/http/httpcore-4.4.13.jar"/>
<include name="apache/http/httpmime-4.5.13.jar"/>
<include name="apache/james/apache-mime4j-0.6.jar"/>
<include name="apache/commons/commons-codec-1.10.jar"/>
<include name="apache/commons/commons-io-2.4.jar"/>
<include name="apache/commons/commons-lang3-3.4.jar"/>
<include name="apache/commons/commons-logging-1.2.jar"/>
<include name="htmlunit/htmlunit-2.55.0/htmlunit-cssparser-1.10.0.jar"/>
<include name="htmlunit/htmlunit-2.55.0/htmlunit-2.55.0.jar"/>
<include name="htmlunit/htmlunit-2.55.0/htmlunit-core-js-2.55.0.jar"/>
<include name="htmlunit/htmlunit-2.55.0/neko-htmlunit-2.55.0.jar"/>
<include name="htmlunit/htmlunit-2.55.0/salvation2-3.0.0.jar"/>
<include name="apache/http/httpclient-4.5.14.jar"/>
<include name="apache/http/httpcore-4.4.16.jar"/>
<include name="apache/http/httpmime-4.5.14.jar"/>
<include name="apache/commons/commons-codec-1.18.0.jar"/>
<include name="apache/commons/commons-io-2.19.0.jar"/>
<include name="apache/commons/commons-lang3-3.17.0.jar"/>
<include name="apache/commons/commons-logging-1.3.5.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-cssparser-4.11.0.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-4.11.1.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-core-js-4.11.0.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-csp-4.11.0.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-websocket-client-4.11.0.jar"/>
<include name="htmlunit/htmlunit-4.11.1/htmlunit-xpath-4.11.0.jar"/>
<include name="htmlunit/htmlunit-4.11.1/neko-htmlunit-4.11.0.jar"/>
<include name="cup/java-cup-11a.jar"/>
<include name="xalan/xalan-2.7.1-nocup.jar"/>
<include name="xerces/xerces-2_11_0/serializer-2.7.1.jar"/>
Expand Down Expand Up @@ -155,20 +156,20 @@
<zipfileset
src="${gwt.tools.lib}/apache/commons/commons-collections-3.2.2.jar"/>
<!-- htmlunit dependencies not already included: BEGIN -->
<zipfileset src="${gwt.tools.lib}/apache/http/httpclient-4.5.13.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/http/httpcore-4.4.13.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/http/httpmime-4.5.13.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/james/apache-mime4j-0.6.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-codec-1.10.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-io-2.4.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-lang3-3.4.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-logging-1.2.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-2.55.0/htmlunit-cssparser-1.10.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-2.55.0/htmlunit-2.55.0.jar"/>
<zipfileset
src="${gwt.tools.lib}/htmlunit/htmlunit-2.55.0/htmlunit-core-js-2.55.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-2.55.0/neko-htmlunit-2.55.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-2.55.0/salvation2-3.0.0.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/http/httpclient-4.5.14.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/http/httpcore-4.4.16.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/http/httpmime-4.5.14.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-codec-1.18.0.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-io-2.19.0.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-lang3-3.17.0.jar"/>
<zipfileset src="${gwt.tools.lib}/apache/commons/commons-logging-1.3.5.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-cssparser-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-4.11.1.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-core-js-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-csp-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-websocket-client-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/htmlunit-xpath-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/htmlunit/htmlunit-4.11.1/neko-htmlunit-4.11.0.jar"/>
<zipfileset src="${gwt.tools.lib}/cup/java-cup-11a.jar"/>
<zipfileset src="${gwt.tools.lib}/xalan/xalan-2.7.1-nocup.jar"/>
<zipfileset src="${gwt.tools.lib}/xerces/xerces-2_11_0/serializer-2.7.1.jar"/>
Expand Down
25 changes: 7 additions & 18 deletions dev/core/src/com/google/gwt/dev/shell/HostedModePluginObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@

import com.google.gwt.core.ext.TreeLogger;

import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.javascript.host.Window;

import net.sourceforge.htmlunit.corejs.javascript.Context;
import net.sourceforge.htmlunit.corejs.javascript.Function;
import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.WebClient;
import org.htmlunit.corejs.javascript.Context;
import org.htmlunit.corejs.javascript.Function;
import org.htmlunit.corejs.javascript.Scriptable;
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.javascript.JavaScriptEngine;
import org.htmlunit.javascript.host.Window;

import java.io.IOException;
import java.util.Collections;

/**
* HTMLUnit object that represents the hosted-mode plugin.
Expand Down Expand Up @@ -187,15 +185,6 @@ public boolean connect(String url, String sessionKey, String address,
return false;
}
// TODO: add whitelist and default-port support?

// We know that legacy dev mode is running, we need to tell HtmlUnit that it is safe
// to permit plain Java objects to leak into JS - the JavaObject type will return a
// Object[] with a success boolean and a value, and HtmlUnit will guard against this.
// The simplest way to do that here is to mark java.lang.Object as the java equivalent
// of some JS type - the name of the type doesn't matter.
webClient.setActiveXObjectMap(Collections.singletonMap(
"GwtLegacyDevModeExceptionOrReturnValue", "java.lang.Object"));

try {
HtmlUnitSessionHandler htmlUnitSessionHandler = new HtmlUnitSessionHandler(
window, jsEngine, webClient);
Expand Down
43 changes: 21 additions & 22 deletions dev/core/src/com/google/gwt/dev/shell/HtmlUnitSessionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@
import com.google.gwt.dev.shell.BrowserChannelClient.SessionHandlerClient;
import com.google.gwt.dev.util.log.PrintWriterTreeLogger;

import com.gargoylesoftware.htmlunit.ScriptException;
import com.gargoylesoftware.htmlunit.ScriptResult;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.SimpleScriptableProxy;
import com.gargoylesoftware.htmlunit.javascript.host.Window;

import net.sourceforge.htmlunit.corejs.javascript.ConsString;
import net.sourceforge.htmlunit.corejs.javascript.Context;
import net.sourceforge.htmlunit.corejs.javascript.Function;
import net.sourceforge.htmlunit.corejs.javascript.JavaScriptException;
import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
import net.sourceforge.htmlunit.corejs.javascript.Undefined;
import org.htmlunit.ScriptException;
import org.htmlunit.ScriptResult;
import org.htmlunit.WebClient;
import org.htmlunit.WebWindow;
import org.htmlunit.corejs.javascript.ConsString;
import org.htmlunit.corejs.javascript.Context;
import org.htmlunit.corejs.javascript.Function;
import org.htmlunit.corejs.javascript.JavaScriptException;
import org.htmlunit.corejs.javascript.Scriptable;
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.corejs.javascript.Undefined;
import org.htmlunit.html.HtmlPage;
import org.htmlunit.javascript.HtmlUnitScriptableProxy;
import org.htmlunit.javascript.JavaScriptEngine;
import org.htmlunit.javascript.host.Window;

import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -185,13 +183,14 @@ public ExceptionOrReturnValue invoke(BrowserChannelClient channel, Value thisObj
jsThis = window;
} else {
Object obj = makeJsvalFromValue(jsContext, thisObj);
if (obj instanceof HtmlUnitScriptableProxy) {
obj = ((HtmlUnitScriptableProxy<?>) obj).getDelegee();
}
if (obj instanceof ScriptableObject) {
jsThis = (ScriptableObject) obj;
} else if (obj instanceof SimpleScriptableProxy<?>) {
jsThis = ((SimpleScriptableProxy<SimpleScriptable>) obj).getDelegee();
} else {
logger.log(TreeLogger.ERROR, "Unable to convert " + obj + " to either "
+ " ScriptableObject or SimpleScriptableProxy");
+ " ScriptableObject or HtmlUnitScriptableProxy");
return new ExceptionOrReturnValue(true, new Value(null));
}
}
Expand Down Expand Up @@ -289,14 +288,14 @@ public Value makeValueFromJsval(Context jsContext, Object value) {
return returnVal;
}
if (value instanceof Scriptable) {
if (value instanceof SimpleScriptableProxy) {
if (value instanceof HtmlUnitScriptableProxy) {
// HtmlUnit will return proxies to java for the window/document objects,
// so that those objects can work after navigating away from the page.
// However, GWTTestCase operates inside a single page session, so we
// can unwrap these proxies to get the real instance. Without doing
// this, the refToJsObject mapping would indicate that an object might
// not equal itself
value = ((SimpleScriptableProxy<?>) value).getDelegee();
value = ((HtmlUnitScriptableProxy<?>) value).getDelegee();
}
if (value instanceof ScriptableObject) {
/*
Expand Down
10 changes: 5 additions & 5 deletions dev/core/src/com/google/gwt/dev/shell/JavaObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import com.google.gwt.dev.shell.BrowserChannel.SessionHandler.ExceptionOrReturnValue;
import com.google.gwt.dev.shell.BrowserChannel.Value;

import net.sourceforge.htmlunit.corejs.javascript.Context;
import net.sourceforge.htmlunit.corejs.javascript.Function;
import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
import net.sourceforge.htmlunit.corejs.javascript.Undefined;
import org.htmlunit.corejs.javascript.Context;
import org.htmlunit.corejs.javascript.Function;
import org.htmlunit.corejs.javascript.Scriptable;
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.corejs.javascript.Undefined;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

import com.google.gwt.core.ext.linker.LinkerUtils;

import com.gargoylesoftware.htmlunit.AlertHandler;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.MockWebConnection;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;

import junit.framework.TestCase;

import org.htmlunit.AlertHandler;
import org.htmlunit.FailingHttpStatusCodeException;
import org.htmlunit.MockWebConnection;
import org.htmlunit.Page;
import org.htmlunit.WebClient;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down
2 changes: 1 addition & 1 deletion maven/poms/gwt/gwt-dev/pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
</exclusions>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions maven/poms/gwt/pom-template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@
<version>63.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.55.0</version>
<version>4.11.1</version>
</dependency>
<dependency>
<groupId>org.w3c.css</groupId>
Expand Down
Loading