You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(30) |
Sep
(15) |
Oct
(26) |
Nov
(12) |
Dec
(17) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(7) |
Feb
(27) |
Mar
(73) |
Apr
(17) |
May
(17) |
Jun
(78) |
Jul
(67) |
Aug
(60) |
Sep
(89) |
Oct
(140) |
Nov
(173) |
Dec
(46) |
2004 |
Jan
(39) |
Feb
(7) |
Mar
(21) |
Apr
(31) |
May
(13) |
Jun
(86) |
Jul
(14) |
Aug
(14) |
Sep
(53) |
Oct
(184) |
Nov
(186) |
Dec
(319) |
2005 |
Jan
(336) |
Feb
(274) |
Mar
(226) |
Apr
(102) |
May
(196) |
Jun
(130) |
Jul
(119) |
Aug
(143) |
Sep
(76) |
Oct
(85) |
Nov
(70) |
Dec
(159) |
2006 |
Jan
(125) |
Feb
(100) |
Mar
(80) |
Apr
(39) |
May
(55) |
Jun
(58) |
Jul
(50) |
Aug
(76) |
Sep
(55) |
Oct
(101) |
Nov
(163) |
Dec
(85) |
2007 |
Jan
(56) |
Feb
(53) |
Mar
(180) |
Apr
(221) |
May
(290) |
Jun
(199) |
Jul
(322) |
Aug
(515) |
Sep
(121) |
Oct
(297) |
Nov
(177) |
Dec
(103) |
2008 |
Jan
(516) |
Feb
(315) |
Mar
(586) |
Apr
(615) |
May
(197) |
Jun
(381) |
Jul
(390) |
Aug
(195) |
Sep
(603) |
Oct
(499) |
Nov
(622) |
Dec
(350) |
2009 |
Jan
(313) |
Feb
(338) |
Mar
(507) |
Apr
(317) |
May
(197) |
Jun
(375) |
Jul
(235) |
Aug
(424) |
Sep
(410) |
Oct
(338) |
Nov
(286) |
Dec
(306) |
2010 |
Jan
(367) |
Feb
(339) |
Mar
(371) |
Apr
(172) |
May
(233) |
Jun
(264) |
Jul
(421) |
Aug
(110) |
Sep
(218) |
Oct
(189) |
Nov
(185) |
Dec
(168) |
2011 |
Jan
(145) |
Feb
(213) |
Mar
(205) |
Apr
(64) |
May
(159) |
Jun
(67) |
Jul
(104) |
Aug
(126) |
Sep
(144) |
Oct
(106) |
Nov
(154) |
Dec
(225) |
2012 |
Jan
(111) |
Feb
(87) |
Mar
(131) |
Apr
(102) |
May
(180) |
Jun
(160) |
Jul
(412) |
Aug
(315) |
Sep
(311) |
Oct
(369) |
Nov
(464) |
Dec
(284) |
2013 |
Jan
(343) |
Feb
(165) |
Mar
(174) |
Apr
(120) |
May
(153) |
Jun
(134) |
Jul
(202) |
Aug
(105) |
Sep
(228) |
Oct
(332) |
Nov
(192) |
Dec
(219) |
2014 |
Jan
(348) |
Feb
(194) |
Mar
(189) |
Apr
(188) |
May
(297) |
Jun
(206) |
Jul
(79) |
Aug
(279) |
Sep
(111) |
Oct
(159) |
Nov
(61) |
Dec
(78) |
2015 |
Jan
(152) |
Feb
(145) |
Mar
(239) |
Apr
(223) |
May
(248) |
Jun
(296) |
Jul
(172) |
Aug
(189) |
Sep
(338) |
Oct
(217) |
Nov
(131) |
Dec
(184) |
2016 |
Jan
(118) |
Feb
(221) |
Mar
(414) |
Apr
(412) |
May
(303) |
Jun
(133) |
Jul
(129) |
Aug
(121) |
Sep
(136) |
Oct
(67) |
Nov
(89) |
Dec
(245) |
2017 |
Jan
(349) |
Feb
(90) |
Mar
(328) |
Apr
(430) |
May
(284) |
Jun
(199) |
Jul
(164) |
Aug
(120) |
Sep
(57) |
Oct
(105) |
Nov
(108) |
Dec
(146) |
2018 |
Jan
(85) |
Feb
(48) |
Mar
(97) |
Apr
(62) |
May
(64) |
Jun
(136) |
Jul
(123) |
Aug
(87) |
Sep
(17) |
Oct
(27) |
Nov
(9) |
Dec
(16) |
2019 |
Jan
(9) |
Feb
(17) |
Mar
(18) |
Apr
(14) |
May
(8) |
Jun
|
Jul
(6) |
Aug
(12) |
Sep
(5) |
Oct
|
Nov
(2) |
Dec
|
2020 |
Jan
(8) |
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
(1) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2023 |
Jan
|
Feb
(6) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rb...@us...> - 2018-07-15 15:06:51
|
Revision: 15464 http://sourceforge.net/p/htmlunit/code/15464 Author: rbri Date: 2018-07-15 15:06:46 +0000 (Sun, 15 Jul 2018) Log Message: ----------- set default charset for the parser if not specified Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2018-07-15 10:53:41 UTC (rev 15463) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2018-07-15 15:06:46 UTC (rev 15464) @@ -28,6 +28,7 @@ import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; @@ -219,9 +220,12 @@ final URL url = webResponse.getWebRequest().getUrl(); final HtmlUnitDOMBuilder domBuilder = new HtmlUnitDOMBuilder(page, url, null); - final Charset charset = webResponse.getContentCharsetOrNull(); + Charset charset = webResponse.getContentCharsetOrNull(); try { - if (charset != null) { + if (charset == null) { + charset = StandardCharsets.ISO_8859_1; + } + else { domBuilder.setFeature(HTMLScanner.IGNORE_SPECIFIED_CHARSET, true); } |
From: <rb...@us...> - 2018-07-15 10:53:47
|
Revision: 15463 http://sourceforge.net/p/htmlunit/code/15463 Author: rbri Date: 2018-07-15 10:53:41 +0000 (Sun, 15 Jul 2018) Log Message: ----------- encoding is the server job Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2018-07-15 07:52:16 UTC (rev 15462) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HTMLParser.java 2018-07-15 10:53:41 UTC (rev 15463) @@ -219,16 +219,9 @@ final URL url = webResponse.getWebRequest().getUrl(); final HtmlUnitDOMBuilder domBuilder = new HtmlUnitDOMBuilder(page, url, null); - Charset charset = webResponse.getContentCharsetOrNull(); + final Charset charset = webResponse.getContentCharsetOrNull(); try { - // handle charset - if (charset == null) { - final Charset specifiedCharset = webResponse.getWebRequest().getCharset(); - if (specifiedCharset != null) { - charset = specifiedCharset; - } - } - else { + if (charset != null) { domBuilder.setFeature(HTMLScanner.IGNORE_SPECIFIED_CHARSET, true); } |
From: <rb...@us...> - 2018-07-15 07:52:21
|
Revision: 15462 http://sourceforge.net/p/htmlunit/code/15462 Author: rbri Date: 2018-07-15 07:52:16 +0000 (Sun, 15 Jul 2018) Log Message: ----------- be consistent and use the submit charset at all places Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2018-07-14 11:57:57 UTC (rev 15461) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2018-07-15 07:52:16 UTC (rev 15462) @@ -249,13 +249,14 @@ final BrowserVersion browser = getPage().getWebClient().getBrowserVersion(); String actionUrl = getActionAttribute(); String anchor = null; - String queryFromFields = ""; + String queryFormFields = ""; + final Charset enc = getSubmitCharset(); + if (HttpMethod.GET == method) { if (actionUrl.contains("#")) { anchor = StringUtils.substringAfter(actionUrl, "#"); } - final Charset enc = getPage().getCharset(); - queryFromFields = + queryFormFields = URLEncodedUtils.format(Arrays.asList(NameValuePair.toHttpClient(parameters)), enc); // action may already contain some query parameters: they have to be removed @@ -263,6 +264,7 @@ actionUrl = StringUtils.substringBefore(actionUrl, "?"); parameters.clear(); // parameters have been added to query } + URL url; try { if (actionUrl.isEmpty()) { @@ -272,8 +274,8 @@ url = htmlPage.getFullyQualifiedUrl(actionUrl); } - if (!queryFromFields.isEmpty()) { - url = UrlUtils.getUrlWithNewQuery(url, queryFromFields); + if (!queryFormFields.isEmpty()) { + url = UrlUtils.getUrlWithNewQuery(url, queryFormFields); } if (HttpMethod.GET == method && browser.hasFeature(FORM_SUBMISSION_URL_WITHOUT_HASH) @@ -302,7 +304,7 @@ if (HttpMethod.POST == method) { request.setEncodingType(FormEncodingType.getInstance(getEnctypeAttribute())); } - request.setCharset(getSubmitCharset()); + request.setCharset(enc); String referer = htmlPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); |
From: <rb...@us...> - 2018-07-14 11:58:04
|
Revision: 15461 http://sourceforge.net/p/htmlunit/code/15461 Author: rbri Date: 2018-07-14 11:57:57 +0000 (Sat, 14 Jul 2018) Log Message: ----------- url encoding has to use UTF-8 as codepage Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2018-07-14 09:47:57 UTC (rev 15460) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2018-07-14 11:57:57 UTC (rev 15461) @@ -57,6 +57,7 @@ private long loadTime_; private WebResponseData responseData_; private WebRequest request_; + private boolean defaultCharsetUtf8_; /** * Constructs with all data. @@ -180,12 +181,12 @@ // xml pages are using a different content type if (null != contentType - && PageType.XML == DefaultPageCreator.determinePageType(contentType)) { + && (defaultCharsetUtf8_ + || PageType.XML == DefaultPageCreator.determinePageType(contentType))) { return UTF_8; } + } - charset = getWebRequest().getCharset(); - } if (charset == null) { charset = ISO_8859_1; } @@ -287,4 +288,11 @@ responseData_.cleanUp(); } } + + /** + * Mark this response for using UTF-8 as default charset. + */ + public void defaultCharsetUtf8() { + defaultCharsetUtf8_ = true; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java 2018-07-14 09:47:57 UTC (rev 15460) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java 2018-07-14 11:57:57 UTC (rev 15461) @@ -574,6 +574,9 @@ if (LOG.isDebugEnabled()) { LOG.debug("Web response loaded successfully."); } + // this kind of web responses using UTF-8 as default encoding + webResponse.defaultCharsetUtf8(); + boolean allowOriginResponse = true; if (originHeaderValue != null) { final String value = webResponse.getResponseHeaderValue(HttpHeader.ACCESS_CONTROL_ALLOW_ORIGIN); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2018-07-14 09:47:57 UTC (rev 15460) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2018-07-14 11:57:57 UTC (rev 15461) @@ -748,6 +748,9 @@ if (LOG.isDebugEnabled()) { LOG.debug("Web response loaded successfully."); } + // this kind of web responses using UTF-8 as default encoding + webResponse.defaultCharsetUtf8(); + boolean allowOriginResponse = true; if (originHeaderValue != null) { String value = webResponse.getResponseHeaderValue(HttpHeader.ACCESS_CONTROL_ALLOW_ORIGIN); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java 2018-07-14 09:47:57 UTC (rev 15460) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java 2018-07-14 11:57:57 UTC (rev 15461) @@ -107,8 +107,8 @@ public void illegalCharset() throws Exception { illegalCharset("text/html; text/html; charset=ISO-8859-1;", ISO_8859_1); illegalCharset("text/html; charset=UTF-8; charset=UTF-8", UTF_8); - illegalCharset("text/html; charset=#sda+s", UTF_8); - illegalCharset("text/html; charset=UnknownCharset", UTF_8); + illegalCharset("text/html; charset=#sda+s", ISO_8859_1); + illegalCharset("text/html; charset=UnknownCharset", ISO_8859_1); } private void illegalCharset(final String cntTypeHeader, final Charset expectedCharset) throws Exception { |
From: <rb...@us...> - 2018-07-14 09:48:00
|
Revision: 15460 http://sourceforge.net/p/htmlunit/code/15460 Author: rbri Date: 2018-07-14 09:47:57 +0000 (Sat, 14 Jul 2018) Log Message: ----------- url encoding has to use UTF-8 as codepage Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java 2018-07-14 09:47:32 UTC (rev 15459) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebResponseTest.java 2018-07-14 09:47:57 UTC (rev 15460) @@ -107,8 +107,8 @@ public void illegalCharset() throws Exception { illegalCharset("text/html; text/html; charset=ISO-8859-1;", ISO_8859_1); illegalCharset("text/html; charset=UTF-8; charset=UTF-8", UTF_8); - illegalCharset("text/html; charset=#sda+s", ISO_8859_1); - illegalCharset("text/html; charset=UnknownCharset", ISO_8859_1); + illegalCharset("text/html; charset=#sda+s", UTF_8); + illegalCharset("text/html; charset=UnknownCharset", UTF_8); } private void illegalCharset(final String cntTypeHeader, final Charset expectedCharset) throws Exception { |
From: <rb...@us...> - 2018-07-14 09:47:36
|
Revision: 15459 http://sourceforge.net/p/htmlunit/code/15459 Author: rbri Date: 2018-07-14 09:47:32 +0000 (Sat, 14 Jul 2018) Log Message: ----------- url encoding has to use UTF-8 as codepage Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-13 16:24:00 UTC (rev 15458) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-14 09:47:32 UTC (rev 15459) @@ -36,6 +36,7 @@ import java.net.URLConnection; import java.net.URLDecoder; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collections; @@ -460,8 +461,10 @@ */ @SuppressWarnings("unchecked") public <P extends Page> P getPage(final URL url) throws IOException, FailingHttpStatusCodeException { - return (P) getPage(getCurrentWindow().getTopWindow(), - new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader())); + final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); + request.setCharset(StandardCharsets.UTF_8); + + return (P) getPage(getCurrentWindow().getTopWindow(), request); } /** @@ -881,6 +884,8 @@ if (url != null) { try { final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); + request.setCharset(StandardCharsets.UTF_8); + if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); @@ -1011,6 +1016,8 @@ final HtmlPage openerPage = (HtmlPage) opener.getEnclosedPage(); final WebRequest request = new WebRequest(url, getBrowserVersion().getHtmlAcceptHeader()); + request.setCharset(StandardCharsets.UTF_8); + if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) { final String referer = openerPage.getUrl().toExternalForm(); request.setAdditionalHeader(HttpHeader.REFERER, referer); @@ -1444,6 +1451,8 @@ || status == HttpStatus.SC_MOVED_TEMPORARILY || status == HttpStatus.SC_SEE_OTHER) { final WebRequest wrs = new WebRequest(newUrl, HttpMethod.GET); + wrs.setCharset(webRequest.getCharset()); + if (HttpMethod.HEAD == webRequest.getHttpMethod()) { wrs.setHttpMethod(HttpMethod.HEAD); } @@ -1455,6 +1464,8 @@ else if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == 308) { final WebRequest wrs = new WebRequest(newUrl, webRequest.getHttpMethod()); + wrs.setCharset(webRequest.getCharset()); + wrs.setRequestParameters(parameters); for (final Map.Entry<String, String> entry : webRequest.getAdditionalHeaders().entrySet()) { wrs.setAdditionalHeader(entry.getKey(), entry.getValue()); |
From: <rb...@us...> - 2018-07-13 16:24:04
|
Revision: 15458 http://sourceforge.net/p/htmlunit/code/15458 Author: rbri Date: 2018-07-13 16:24:00 +0000 (Fri, 13 Jul 2018) Log Message: ----------- back to the old charset Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2018-07-13 14:36:14 UTC (rev 15457) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2018-07-13 16:24:00 UTC (rev 15458) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit; -import static java.nio.charset.StandardCharsets.UTF_8; +import static java.nio.charset.StandardCharsets.ISO_8859_1; import java.io.IOException; import java.io.ObjectInputStream; @@ -62,7 +62,7 @@ private Map<String, String> additionalHeaders_ = new HashMap<>(); private Credentials urlCredentials_; private Credentials credentials_; - private transient Charset charset_ = UTF_8; + private transient Charset charset_ = ISO_8859_1; /* These two are mutually exclusive; additionally, requestBody_ should only be set for POST requests. */ private List<NameValuePair> requestParameters_ = Collections.emptyList(); |
From: <rb...@us...> - 2018-07-13 14:36:18
|
Revision: 15457 http://sourceforge.net/p/htmlunit/code/15457 Author: rbri Date: 2018-07-13 14:36:14 +0000 (Fri, 13 Jul 2018) Log Message: ----------- url encoding has to use UTF-8 as codepage Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtml2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtmlTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -1334,7 +1334,8 @@ WebAssert.notNull("method", method); WebAssert.notNull("parameters", parameters); - url = UrlUtils.encodeUrl(url, getBrowserVersion().hasFeature(URL_MINIMAL_QUERY_ENCODING), UTF_8); + url = UrlUtils.encodeUrl(url, getBrowserVersion().hasFeature(URL_MINIMAL_QUERY_ENCODING), + webRequest.getCharset()); webRequest.setUrl(url); if (LOG.isDebugEnabled()) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit; -import static java.nio.charset.StandardCharsets.ISO_8859_1; +import static java.nio.charset.StandardCharsets.UTF_8; import java.io.IOException; import java.io.ObjectInputStream; @@ -62,7 +62,7 @@ private Map<String, String> additionalHeaders_ = new HashMap<>(); private Credentials urlCredentials_; private Credentials credentials_; - private transient Charset charset_ = ISO_8859_1; + private transient Charset charset_ = UTF_8; /* These two are mutually exclusive; additionally, requestBody_ should only be set for POST requests. */ private List<NameValuePair> requestParameters_ = Collections.emptyList(); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -21,6 +21,7 @@ import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; +import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -37,6 +38,7 @@ private final String firstResponse_; private final String otherResponse_; private ServerSocket server_; + private Charset charset_ = StandardCharsets.UTF_8; private List<String> requests_ = new ArrayList<>(); /** @@ -95,7 +97,7 @@ response = otherResponse_; } first = false; - out.write(response.getBytes(StandardCharsets.UTF_8)); + out.write(response.getBytes(charset_)); } } } @@ -131,4 +133,11 @@ public void clearRequests() { requests_.clear(); } + + /** + * @param charset the charset + */ + public void setCharset(final Charset charset) { + charset_ = charset; + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -16,7 +16,6 @@ import static com.gargoylesoftware.htmlunit.httpclient.HtmlUnitBrowserCompatCookieSpec.EMPTY_COOKIE_NAME; -import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -28,7 +27,6 @@ import org.junit.Test; import org.junit.runner.RunWith; -import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.util.Cookie; @@ -43,18 +41,6 @@ public class WebClient2Test extends SimpleWebTestCase { /** - * @throws Exception if an error occurs - */ - @Test - @Alerts(DEFAULT = "http://first/?param=%A3", - IE = "http://first/?param=\u00A3") - public void encodeURL() throws Exception { - final String html = "<body onload='alert(window.location.href)'></body>"; - getMockWebConnection().setDefaultResponse(html); - loadPageWithAlerts(html, new URL("http://first/?param=\u00A3"), -1); - } - - /** * Test for 3151939. The Browser removes leading '/..' from the path. * @throws Exception if something goes wrong */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -17,10 +17,12 @@ import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; import java.net.URL; +import java.nio.charset.StandardCharsets; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; +import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; @@ -121,23 +123,23 @@ * @throws Exception if something goes wrong */ @Test - @Alerts(DEFAULT = "/test.html?param=%C2%A9", - IE = "/test.html?param=\u00A9") + @Alerts(DEFAULT = "/test.html?param=%C2%A9%C2%A3", + IE = "/test.html?param=\u00A9\u00A3") @NotYetImplemented(IE) public void loadPage_EncodeRequest7() throws Exception { // unicode - testRequestUrlEncoding("test.html?param=\u00A9"); + testRequestUrlEncoding("test.html?param=\u00A9\u00A3"); } private void testRequestUrlEncoding(final String url) throws Exception { final String response = "HTTP/1.1 200 OK\r\n" - + "Content-Length: 2\r\n" + + "Content-Length: 58\r\n" + "Content-Type: text/html\r\n" + "\r\n" + "<html><head><title>foo</title></head><body>" + "</body></html>"; - primitiveWebServer_ = new PrimitiveWebServer(PORT, response, response); + primitiveWebServer_ = new PrimitiveWebServer(PORT, response); primitiveWebServer_.start(); final WebDriver driver = getWebDriver(); @@ -151,4 +153,97 @@ assertEquals(getExpectedAlerts()[0], reqUrl); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "/bug.html?k%C3%B6nig", + IE = "/bug.html?k\u00c3\u00b6nig") + @NotYetImplemented(IE) + public void linkUrlEncodingUTF8() throws Exception { + final String html = "<html>\n" + + "<head><title>foo</title>\n" + + " <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n" + + "</head>\n" + + "<body>\n" + + " <a id='myLink' href='bug.html?k\u00F6nig'>Click me</a>\n" + + "</body></html>"; + + final String firstResponse = "HTTP/1.1 200 OK\r\n" + + "Content-Length: " + html.length() + "\r\n" + + "Content-Type: text/html\r\n" + + "\r\n" + + html; + + final String response = "HTTP/1.1 200 OK\r\n" + + "Content-Length: 2\r\n" + + "Content-Type: text/html\r\n" + + "\r\n" + + "<html><head><title>foo</title></head><body>" + + "</body></html>"; + + primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, response); + primitiveWebServer_.start(); + + final WebDriver driver = getWebDriver(); + + driver.get(URL_FIRST.toString()); + driver.findElement(By.id("myLink")).click(); + + String reqUrl = primitiveWebServer_.getRequests().get(1); + if (reqUrl.contains("/favicon.ico")) { + reqUrl = primitiveWebServer_.getRequests().get(2); + } + reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1); + + assertEquals(getExpectedAlerts()[0], reqUrl); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts(DEFAULT = "/bug.html?k%F6nig", + IE = "/bug.html?k\u00f6nig") + @NotYetImplemented(IE) + public void linkUrlEncodingISO8859_1() throws Exception { + final String html = "<html>\n" + + "<head><title>foo</title>\n" + + " <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n" + + "</head>\n" + + "<body>\n" + + " <a id='myLink' href='bug.html?k\u00F6nig'>Click me</a>\n" + + "</body></html>"; + + final String firstResponse = "HTTP/1.1 200 OK\r\n" + + "Content-Length: " + html.length() + "\r\n" + + "Content-Type: text/html\r\n" + + "\r\n" + + html; + + final String response = "HTTP/1.1 200 OK\r\n" + + "Content-Length: 2\r\n" + + "Content-Type: text/html\r\n" + + "\r\n" + + "<html><head><title>foo</title></head><body>" + + "</body></html>"; + + primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, response); + primitiveWebServer_.setCharset(StandardCharsets.ISO_8859_1); + primitiveWebServer_.start(); + + final WebDriver driver = getWebDriver(); + + driver.get(URL_FIRST.toString()); + driver.findElement(By.id("myLink")).click(); + + String reqUrl = primitiveWebServer_.getRequests().get(1); + if (reqUrl.contains("/favicon.ico")) { + reqUrl = primitiveWebServer_.getRequests().get(2); + } + reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1); + + assertEquals(getExpectedAlerts()[0], reqUrl); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -46,7 +46,6 @@ import com.gargoylesoftware.htmlunit.FormEncodingType; import com.gargoylesoftware.htmlunit.HttpHeader; import com.gargoylesoftware.htmlunit.HttpMethod; -import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.WebDriverTestCase; import com.gargoylesoftware.htmlunit.util.NameValuePair; import com.gargoylesoftware.htmlunit.util.UrlUtils; @@ -171,35 +170,6 @@ * @throws Exception if the test fails */ @Test - public void linkUrlEncoding() throws Exception { - final String html = "<html>\n" - + "<head><title>foo</title>\n" - + " <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n" - + "</head>\n" - + "<body>\n" - + " <a href='bug.html?k\u00F6nig' id='myLink'>Click me</a>\n" - + "</body></html>"; - - final MockWebConnection webConnection = getMockWebConnection(); - webConnection.setDefaultResponse(html, "text/html", ISO_8859_1); - - final WebDriver driver = loadPage2(html); - assertEquals(URL_FIRST.toExternalForm(), driver.getCurrentUrl()); - driver.findElement(By.id("myLink")).click(); - final String linkSuffix; - if (getBrowserVersion().isIE()) { - linkSuffix = "bug.html?k\u00F6nig"; - } - else { - linkSuffix = "bug.html?k%F6nig"; - } - assertEquals(URL_FIRST + linkSuffix, driver.getCurrentUrl()); - } - - /** - * @throws Exception if the test fails - */ - @Test public void base() throws Exception { final String html = "<html><head>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtml2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtml2Test.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtml2Test.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -30,30 +30,6 @@ public class MalformedHtml2Test extends SimpleWebTestCase { /** - * @throws Exception if the test fails - */ - @Test - public void incompleteEntities() throws Exception { - final String html = "<html><head>\n" - + "<title>Test document</title>\n" - + "</head><body>\n" - + "<a href='foo?a=1©=2&prod=3' id='myLink'>my link</a>\n" - + "</body></html>"; - - final HtmlPage page = loadPage(html); - final HtmlPage page2 = page.getAnchors().get(0).click(); - - final String query; - if (getBrowserVersion().isIE()) { - query = "a=1\u00A9=2&prod=3"; - } - else { - query = "a=1%A9=2&prod=3"; - } - assertEquals(query, page2.getUrl().getQuery()); - } - - /** * Regression test for Bug #1018. * @throws Exception if an error occurs */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtmlTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtmlTest.java 2018-07-12 19:10:53 UTC (rev 15456) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/MalformedHtmlTest.java 2018-07-13 14:36:14 UTC (rev 15457) @@ -1090,4 +1090,26 @@ assertEquals(0, webDriver.findElements(By.name("main")).size()); assertEquals(1, webDriver.findElements(By.id("tester")).size()); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("§§URL§§foo?a=1©=2&prod=3") + @NotYetImplemented + public void incompleteEntities() throws Exception { + final String html = "<html><head>\n" + + "<title>Test document</title>\n" + + "</head><body>\n" + + "<a href='foo?a=1©=2&prod=3' id='myLink'>my link</a>\n" + + "</body></html>"; + + getMockWebConnection().setDefaultResponse("<html><head><title>foo</title></head><body></body></html>"); + expandExpectedAlertsVariables(URL_FIRST); + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("myLink")).click(); + + assertEquals(getExpectedAlerts()[0], getMockWebConnection().getLastWebRequest().getUrl()); + } } |
From: <rb...@us...> - 2018-07-12 19:10:58
|
Revision: 15456 http://sourceforge.net/p/htmlunit/code/15456 Author: rbri Date: 2018-07-12 19:10:53 +0000 (Thu, 12 Jul 2018) Log Message: ----------- url encoding has to use UTF-8 as codepage Issue 1973 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java Added Paths: ----------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-12 15:36:52 UTC (rev 15455) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2018-07-12 19:10:53 UTC (rev 15456) @@ -1312,8 +1312,7 @@ return makeWebResponseForDataUrl(webRequest); default: - return loadWebResponseFromWebConnection(webRequest, ALLOWED_REDIRECTIONS_SAME_URL, - webRequest.getCharset()); + return loadWebResponseFromWebConnection(webRequest, ALLOWED_REDIRECTIONS_SAME_URL); } } @@ -1321,12 +1320,11 @@ * Loads a {@link WebResponse} from the server through the WebConnection. * @param webRequest the request * @param allowedRedirects the number of allowed redirects remaining - * @param charset the charset to use * @throws IOException if an IO problem occurs * @return the resultant {@link WebResponse} */ private WebResponse loadWebResponseFromWebConnection(final WebRequest webRequest, - final int allowedRedirects, final Charset charset) throws IOException { + final int allowedRedirects) throws IOException { URL url = webRequest.getUrl(); final HttpMethod method = webRequest.getHttpMethod(); @@ -1336,7 +1334,7 @@ WebAssert.notNull("method", method); WebAssert.notNull("parameters", parameters); - url = UrlUtils.encodeUrl(url, getBrowserVersion().hasFeature(URL_MINIMAL_QUERY_ENCODING), charset); + url = UrlUtils.encodeUrl(url, getBrowserVersion().hasFeature(URL_MINIMAL_QUERY_ENCODING), UTF_8); webRequest.setUrl(url); if (LOG.isDebugEnabled()) { @@ -1451,7 +1449,7 @@ for (final Map.Entry<String, String> entry : webRequest.getAdditionalHeaders().entrySet()) { wrs.setAdditionalHeader(entry.getKey(), entry.getValue()); } - return loadWebResponseFromWebConnection(wrs, allowedRedirects - 1, UTF_8); + return loadWebResponseFromWebConnection(wrs, allowedRedirects - 1); } else if (status == HttpStatus.SC_TEMPORARY_REDIRECT || status == 308) { @@ -1460,7 +1458,7 @@ for (final Map.Entry<String, String> entry : webRequest.getAdditionalHeaders().entrySet()) { wrs.setAdditionalHeader(entry.getKey(), entry.getValue()); } - return loadWebResponseFromWebConnection(wrs, allowedRedirects - 1, UTF_8); + return loadWebResponseFromWebConnection(wrs, allowedRedirects - 1); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java 2018-07-12 15:36:52 UTC (rev 15455) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java 2018-07-12 19:10:53 UTC (rev 15456) @@ -54,7 +54,7 @@ * * @param port the port * @param firstResponse the first response, must contain the full response (to start with "HTTP/1.1 200 OK") - * @param otherResponse the sebsequent response, must contain the full response (to start with "HTTP/1.1 200 OK") + * @param otherResponse the subsequent response, must contain the full response (to start with "HTTP/1.1 200 OK") */ public PrimitiveWebServer(final int port, final String firstResponse, final String otherResponse) { port_ = port; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java 2018-07-12 15:36:52 UTC (rev 15455) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient2Test.java 2018-07-12 19:10:53 UTC (rev 15456) @@ -55,59 +55,6 @@ } /** - * Test that the path and query string are encoded to be valid. - * @throws Exception if something goes wrong - */ - @Test - public void loadPage_EncodeRequest() throws Exception { - final String htmlContent - = "<html><head><title>foo</title></head><body>\n" - + "</body></html>"; - - final WebClient client = getWebClient(); - - final MockWebConnection webConnection = new MockWebConnection(); - webConnection.setDefaultResponse(htmlContent); - client.setWebConnection(webConnection); - - // with query string not encoded - HtmlPage page = client.getPage("http://first?a=b c&d=\u00E9\u00E8"); - final String expected; - final boolean ie = getBrowserVersion().isIE(); - if (ie) { - expected = "?a=b%20c&d=\u00E9\u00E8"; - } - else { - expected = "?a=b%20c&d=%E9%E8"; - } - assertEquals("http://first/" + expected, page.getUrl()); - - // with query string already encoded - page = client.getPage("http://first?a=b%20c&d=%C3%A9%C3%A8"); - assertEquals("http://first/?a=b%20c&d=%C3%A9%C3%A8", page.getUrl()); - - // with query string partially encoded - page = client.getPage("http://first?a=b%20c&d=e f"); - assertEquals("http://first/?a=b%20c&d=e%20f", page.getUrl()); - - // with anchor - page = client.getPage("http://first?a=b c#myAnchor"); - assertEquals("http://first/?a=b%20c#myAnchor", page.getUrl()); - - // with query string containing encoded "&", "=", "+", ",", and "$" - page = client.getPage("http://first?a=%26%3D%20%2C%24"); - assertEquals("http://first/?a=%26%3D%20%2C%24", page.getUrl()); - - // with character to encode in path - page = client.getPage("http://first/page 1.html"); - assertEquals("http://first/page%201.html", page.getUrl()); - - // with character to encode in path - page = client.getPage("http://first/page 1.html"); - assertEquals("http://first/page%201.html", page.getUrl()); - } - - /** * Test for 3151939. The Browser removes leading '/..' from the path. * @throws Exception if something goes wrong */ Added: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java (rev 0) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java 2018-07-12 19:10:53 UTC (rev 15456) @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2002-2018 Gargoyle Software Inc. + * + * Licensed 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 com.gargoylesoftware.htmlunit; + +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; + +import java.net.URL; + +import org.junit.After; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.openqa.selenium.WebDriver; + +import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; + +/** + * Tests using the {@link PrimitiveWebServer}. + * + * @author Ahmed Ashour + * @author Ronald Brill + */ +@RunWith(BrowserRunner.class) +public class WebClient7Test extends WebDriverTestCase { + + private PrimitiveWebServer primitiveWebServer_; + + /** + * @throws Exception if an error occurs + */ + @After + public void stopServer() throws Exception { + if (primitiveWebServer_ != null) { + primitiveWebServer_.stop(); + } + shutDownAll(); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts(DEFAULT = "/test.html?a=b%20c&d=%C3%A9%C3%A8", + IE = "/test.html?a=b%20c&d=\u00E9\u00E8") + @NotYetImplemented(IE) + public void loadPage_EncodeRequest() throws Exception { + // with query string not encoded + testRequestUrlEncoding("test.html?a=b c&d=\u00E9\u00E8"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts("/test.html?a=b%20c&d=%C3%A9%C3%A8") + public void loadPage_EncodeRequest2() throws Exception { + // with query string already encoded + testRequestUrlEncoding("test.html?a=b%20c&d=%C3%A9%C3%A8"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts("/test.html?a=b%20c&d=e%20f") + public void loadPage_EncodeRequest3() throws Exception { + // with query string partially encoded + testRequestUrlEncoding("test.html?a=b%20c&d=e f"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts("/test.html?a=b%20c") + public void loadPage_EncodeRequest4() throws Exception { + // with anchor + testRequestUrlEncoding("test.html?a=b c#myAnchor"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts("/test.html?a=%26%3D%20%2C%24") + public void loadPage_EncodeRequest5() throws Exception { + // with query string containing encoded "&", "=", "+", ",", and "$" + testRequestUrlEncoding("test.html?a=%26%3D%20%2C%24"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts("/page%201.html") + public void loadPage_EncodeRequest6() throws Exception { + // with character to encode in path + testRequestUrlEncoding("page 1.html"); + } + + /** + * Test that the path and query string are encoded to be valid. + * @throws Exception if something goes wrong + */ + @Test + @Alerts(DEFAULT = "/test.html?param=%C2%A9", + IE = "/test.html?param=\u00A9") + @NotYetImplemented(IE) + public void loadPage_EncodeRequest7() throws Exception { + // unicode + testRequestUrlEncoding("test.html?param=\u00A9"); + } + + private void testRequestUrlEncoding(final String url) throws Exception { + final String response = "HTTP/1.1 200 OK\r\n" + + "Content-Length: 2\r\n" + + "Content-Type: text/html\r\n" + + "\r\n" + + "<html><head><title>foo</title></head><body>" + + "</body></html>"; + + primitiveWebServer_ = new PrimitiveWebServer(PORT, response, response); + primitiveWebServer_.start(); + + final WebDriver driver = getWebDriver(); + + driver.get(new URL(URL_FIRST, url).toString()); + String reqUrl = primitiveWebServer_.getRequests().get(0); + if (reqUrl.contains("/favicon.ico")) { + reqUrl = primitiveWebServer_.getRequests().get(1); + } + reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1); + + assertEquals(getExpectedAlerts()[0], reqUrl); + } +} Property changes on: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |
From: RBRi <rb...@us...> - 2018-07-12 17:45:16
|
- **status**: open --> accepted - **assigned_to**: RBRi --- ** [bugs:#1973] URLs are not properly encoded as UTF-8** **Status:** accepted **Group:** 2.31 **Created:** Thu Jul 12, 2018 01:42 AM UTC by Thrawn **Last Updated:** Thu Jul 12, 2018 01:50 AM UTC **Owner:** RBRi HTMLUnit is not properly encoding UTF-8 request URLs. This causes failures when servers strictly validate those URLs. Minimal test case: - A Spring controller that calls HttpServletRequest.getParameterMap(), such as: @RequestMapping(value = "/", method = {RequestMethod.GET, RequestMethod.HEAD}) public String welcome(HttpServletRequest request) { request.getParameterMap(); return "index"; } - Run on Jetty 9.4.x (9.4.9.v20180320 and 9.4.11.v20180605 are confirmed), eg using the Jetty Maven plugin - Run a unit test that creates a Selenium HTMLUnitDriver and attempts to load /?param=Publisher`s\u2013\u00a0Internationalé\u2014Pty\u00a9Ltd Expected: The page loads and ignores the parameter Actual: A server error occurs, reporting: org.eclipse.jetty.util.Utf8Appendable$NotUtf8Exception: Not valid UTF8! byte A0 in state 0 at org.eclipse.jetty.util.Utf8Appendable.appendByte (Utf8Appendable.java:253) at org.eclipse.jetty.util.Utf8Appendable.append (Utf8Appendable.java:158) at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To (UrlEncoded.java:354) at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To (UrlEncoded.java:296) at org.eclipse.jetty.http.HttpURI.decodeQueryTo (HttpURI.java:615) at org.eclipse.jetty.server.Request.extractQueryParameters (Request.java:437) at org.eclipse.jetty.server.Request.getParameters (Request.java:401) at org.eclipse.jetty.server.Request.getParameterMap (Request.java:1035) --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-07-12 15:36:56
|
Revision: 15455 http://sourceforge.net/p/htmlunit/code/15455 Author: rbri Date: 2018-07-12 15:36:52 +0000 (Thu, 12 Jul 2018) Log Message: ----------- ie expectations update (wip) Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-11 18:10:31 UTC (rev 15454) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-12 15:36:52 UTC (rev 15455) @@ -126,7 +126,8 @@ + " function sortFunction(s1, s2) {\n" + " return s1.toLowerCase() > s2.toLowerCase() ? 1 : -1;\n" + " }\n" - + "</script></head><body onload='test(event)'>\n" + + "</script></head>\n" + + "<body onload='test(event)'>\n" + " <svg xmlns='http://www.w3.org/2000/svg' version='1.1'>\n" + " <invalid id='mySvg'/>\n" + " </svg>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-11 18:10:31 UTC (rev 15454) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-12 15:36:52 UTC (rev 15455) @@ -41,6 +41,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.FormEncodingType; import com.gargoylesoftware.htmlunit.HttpHeader; @@ -803,8 +804,8 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "second content", - IE = "hello world") + @Alerts("second content") + @BuggyWebDriver(IE) public void inputTypeSubmitWithFormTarget() throws Exception { final String html = "<!DOCTYPE html>\n" + "<html><head></head>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java 2018-07-11 18:10:31 UTC (rev 15454) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java 2018-07-12 15:36:52 UTC (rev 15455) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.libraries; +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; + import java.util.List; import org.eclipse.jetty.server.Server; @@ -26,6 +28,7 @@ import org.openqa.selenium.WebElement; import com.gargoylesoftware.htmlunit.BrowserRunner; +import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.WebDriverTestCase; import com.gargoylesoftware.htmlunit.WebServerTestCase; @@ -156,12 +159,12 @@ * @throws Exception if an error occurs */ @Test + @BuggyWebDriver(IE) public void debug_console() throws Exception { final WebDriver driver = getPage("debug", "debug-console"); final List<WebElement> anchors = driver.findElements(By.xpath("//a")); assertEquals(2, anchors.size()); - anchors.get(1).click(); assertEquals("Hello from the Ext console.", driver.findElement(By.xpath("//div[starts-with(text(), 'Hello')][1]")).getText()); |
From: <rb...@us...> - 2018-07-11 18:10:38
|
Revision: 15454 http://sourceforge.net/p/htmlunit/code/15454 Author: rbri Date: 2018-07-11 18:10:31 +0000 (Wed, 11 Jul 2018) Log Message: ----------- ie expectations update (wip) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlButton2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java 2018-07-11 17:57:29 UTC (rev 15453) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java 2018-07-11 18:10:31 UTC (rev 15454) @@ -85,15 +85,13 @@ HtmlForm form = null; final String formId = getAttributeDirect("form"); - if (DomElement.ATTRIBUTE_NOT_DEFINED == formId) { + if (DomElement.ATTRIBUTE_NOT_DEFINED == formId || !hasFeature(FORM_FORM_ATTRIBUTE_SUPPORTED)) { form = getEnclosingForm(); } else { - if (hasFeature(FORM_FORM_ATTRIBUTE_SUPPORTED)) { - final DomElement elem = getHtmlPageOrNull().getElementById(formId); - if (elem instanceof HtmlForm) { - form = (HtmlForm) elem; - } + final DomElement elem = getHtmlPageOrNull().getElementById(formId); + if (elem instanceof HtmlForm) { + form = (HtmlForm) elem; } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlButton2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlButton2Test.java 2018-07-11 17:57:29 UTC (rev 15453) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlButton2Test.java 2018-07-11 18:10:31 UTC (rev 15454) @@ -674,7 +674,7 @@ */ @Test @Alerts(DEFAULT = {"2", "second"}, - IE = {"1", "first"}) + IE = {"2", "third"}) public void externalPreferenceFrom() throws Exception { final String html = "<html><head><title>first</title></head><body>\n" @@ -712,7 +712,7 @@ */ @Test @Alerts(DEFAULT = {"2", "second"}, - IE = {"1", "first"}) + IE = {"2", "third"}) public void internalDifferentFrom() throws Exception { final String html = "<html><head><title>first</title></head><body>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-11 17:57:29 UTC (rev 15453) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2018-07-11 18:10:31 UTC (rev 15454) @@ -41,7 +41,6 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.FormEncodingType; import com.gargoylesoftware.htmlunit.HttpHeader; @@ -480,7 +479,6 @@ */ @Test @Alerts({"2", "third"}) - @BuggyWebDriver(IE) public void buttonWithFormAction() throws Exception { final String html = "<!DOCTYPE html>\n" + "<html><head><title>first</title></head>\n" @@ -539,9 +537,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {"2", "third/"}, - IE = {"1", "/"}) - @NotYetImplemented(IE) + @Alerts({"2", "third/"}) public void inputTypeSubmitWithFormAction() throws Exception { final String html = "<!DOCTYPE html>\n" + "<html><head></head>\n" @@ -766,7 +762,6 @@ * @throws Exception if the test fails */ @Test - @BuggyWebDriver(IE) public void buttonWithFormTarget() throws Exception { final String html = "<!DOCTYPE html>\n" + "<html><head></head>\n" @@ -810,7 +805,6 @@ @Test @Alerts(DEFAULT = "second content", IE = "hello world") - @NotYetImplemented(IE) public void inputTypeSubmitWithFormTarget() throws Exception { final String html = "<!DOCTYPE html>\n" + "<html><head></head>\n" |
From: <rb...@us...> - 2018-07-11 17:57:34
|
Revision: 15453 http://sourceforge.net/p/htmlunit/code/15453 Author: rbri Date: 2018-07-11 17:57:29 +0000 (Wed, 11 Jul 2018) Log Message: ----------- ie expectations update (wip) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormat.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormatTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormat.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormat.java 2018-07-11 17:24:35 UTC (rev 15452) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormat.java 2018-07-11 17:57:29 UTC (rev 15453) @@ -193,7 +193,6 @@ IE_FORMATS_.put("ar-SD", rightToLeft); IE_FORMATS_.put("ar-SY", rightToLeft); IE_FORMATS_.put("ar-YE", rightToLeft); - IE_FORMATS_.put("ban", mmSlash); IE_FORMATS_.put("cs", ddDot); IE_FORMATS_.put("da", ddDash); IE_FORMATS_.put("en-IN", ddDash); @@ -221,10 +220,6 @@ IE_FORMATS_.put("sl", ddDot); IE_FORMATS_.put("sq", yyyyDash); IE_FORMATS_.put("sr", ddDot); - IE_FORMATS_.put("sr-BA", mmSlash); - IE_FORMATS_.put("sr-CS", mmSlash); - IE_FORMATS_.put("sr-ME", mmSlash); - IE_FORMATS_.put("sr-RS", mmSlash); IE_FORMATS_.put("zh", "\u200EYYYY\u200E\u5E74\u200EMM\u200E\u6708\u200Edd\u200E\u65E5"); IE_FORMATS_.put("zh-HK", "\u200EYYYY\u200E\u5E74\u200EMM\u200E\u6708\u200Edd\u200E\u65E5"); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormatTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormatTest.java 2018-07-11 17:24:35 UTC (rev 15452) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/intl/DateTimeFormatTest.java 2018-07-11 17:57:29 UTC (rev 15453) @@ -31,7 +31,7 @@ /** * Tests for {@link DateTimeFormat}. * - * @author Roanld Brill + * @author Ronald Brill * @author Ahmed Ashour */ @RunWith(BrowserRunner.class) @@ -121,7 +121,7 @@ @Test @Alerts(DEFAULT = "20.12.2012", FF60 = "12/20/2012", - IE = "\u200E12\u200E/\u200E20\u200E/\u200E2012") + IE = "\u200E20\u200E.\u200E12\u200E.\u200E2012") public void format_ban() throws Exception { test("new Intl.DateTimeFormat('ban').format(date)"); } @@ -1632,7 +1632,7 @@ */ @Test @Alerts(DEFAULT = "20.12.2012.", - IE = "\u200E12\u200E/\u200E20\u200E/\u200E2012") + IE = "\u200E20\u200E.\u200E12\u200E.\u200E2012") public void format_sr_ba() throws Exception { test("new Intl.DateTimeFormat('sr-BA').format(date)"); } @@ -1642,7 +1642,7 @@ */ @Test @Alerts(DEFAULT = "20.12.2012.", - IE = "\u200E12\u200E/\u200E20\u200E/\u200E2012") + IE = "\u200E20\u200E.\u200E12\u200E.\u200E2012") public void format_sr_cs() throws Exception { test("new Intl.DateTimeFormat('sr-CS').format(date)"); } @@ -1652,7 +1652,7 @@ */ @Test @Alerts(DEFAULT = "20.12.2012.", - IE = "\u200E12\u200E/\u200E20\u200E/\u200E2012") + IE = "\u200E20\u200E.\u200E12\u200E.\u200E2012") public void format_sr_me() throws Exception { test("new Intl.DateTimeFormat('sr-ME').format(date)"); } @@ -1662,7 +1662,7 @@ */ @Test @Alerts(DEFAULT = "20.12.2012.", - IE = "\u200E12\u200E/\u200E20\u200E/\u200E2012") + IE = "\u200E20\u200E.\u200E12\u200E.\u200E2012") public void format_sr_rs() throws Exception { test("new Intl.DateTimeFormat('sr-RS').format(date)"); } |
From: <rb...@us...> - 2018-07-11 17:24:44
|
Revision: 15452 http://sourceforge.net/p/htmlunit/code/15452 Author: rbri Date: 2018-07-11 17:24:35 +0000 (Wed, 11 Jul 2018) Log Message: ----------- ff60 support (wip) Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/MutationObserverTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java Added Paths: ----------- trunk/htmlunit/src/test/resources/libraries/dojo/1.0.2/expectations/testsbehavior.FF60.txt Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/MutationObserverTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/MutationObserverTest.java 2018-07-10 17:11:42 UTC (rev 15451) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/MutationObserverTest.java 2018-07-11 17:24:35 UTC (rev 15452) @@ -14,6 +14,8 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.dom; +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF60; + import java.net.URL; import java.util.Arrays; @@ -24,6 +26,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -322,6 +325,7 @@ */ @Test @Alerts("[object HTMLHeadingElement]-attributes") + @BuggyWebDriver(FF60) public void attributeValue2() throws Exception { final String html = "<html><head><script>\n" + " function makeRed() {\n" @@ -329,9 +333,13 @@ + " }\n" + " function print(mutation) {\n" - + " alert(mutation.target + '-' + mutation.type);\n" + + " log(mutation.target + '-' + mutation.type);\n" + " }\n" + + " function log(x) {\n" + + " document.getElementById('log').value += x + '\\n';\n" + + " }\n" + + " function test() {\n" + " var mobs = new MutationObserver(function(mutations) {\n" + " mutations.forEach(print)\n" @@ -353,10 +361,13 @@ + " <h1 id='headline' style='font-style: italic'>Some headline</h1>\n" + " <input id='id1' type='button' onclick='makeRed()' value='Make Red'>\n" + " </div>\n" + + " <textarea id='log' cols='80' rows='40'></textarea>\n" + "</body></html>\n"; final WebDriver driver = loadPage2(html); driver.findElement(By.id("id1")).click(); - verifyAlerts(driver, getExpectedAlerts()); + + final String text = driver.findElement(By.id("log")).getAttribute("value").trim().replaceAll("\r", ""); + assertEquals(String.join("\n", getExpectedAlerts()), text); } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java 2018-07-10 17:11:42 UTC (rev 15451) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java 2018-07-11 17:24:35 UTC (rev 15452) @@ -14,7 +14,7 @@ */ package com.gargoylesoftware.htmlunit.libraries; -import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF; +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF52; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; import org.junit.Test; @@ -269,7 +269,7 @@ * @throws Exception if an error occurs */ @Test - @NotYetImplemented({FF, IE}) + @NotYetImplemented({FF52, IE}) public void testsbehavior() throws Exception { test("tests.behavior"); } Added: trunk/htmlunit/src/test/resources/libraries/dojo/1.0.2/expectations/testsbehavior.FF60.txt =================================================================== --- trunk/htmlunit/src/test/resources/libraries/dojo/1.0.2/expectations/testsbehavior.FF60.txt (rev 0) +++ trunk/htmlunit/src/test/resources/libraries/dojo/1.0.2/expectations/testsbehavior.FF60.txt 2018-07-11 17:24:35 UTC (rev 15452) @@ -0,0 +1,18 @@ + 1 tests to run in 1 groups + ------------------------------------------------------------ + GROUP "tests.behavior" has 1 test to run + 4 tests to run in 1 groups + ------------------------------------------------------------ + GROUP "t" has 4 tests to run + PASSED test: ../../dojo/tests/behavior.html::t::add + PASSED test: ../../dojo/tests/behavior.html::t::apply + PASSED test: ../../dojo/tests/behavior.html::t::reapply + PASSED test: ../../dojo/tests/behavior.html::t::topics + PASSED test: ../../dojo/tests/behavior.html + WOOHOO!! + ------------------------------------------------------------ + | TEST SUMMARY: + ------------------------------------------------------------ + 5 tests in 2 groups + 0 errors + 0 failures Property changes on: trunk/htmlunit/src/test/resources/libraries/dojo/1.0.2/expectations/testsbehavior.FF60.txt ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property |
From: RBRi <rb...@us...> - 2018-07-11 08:15:41
|
- **status**: open --> closed - **Comment**: Thanks for the feedback --- ** [bugs:#1972] Getting the issue Can't find common super class of when using with android gradle** **Status:** closed **Group:** 2.15 **Created:** Tue Jul 10, 2018 07:56 AM UTC by Dinesh Golla **Last Updated:** Tue Jul 10, 2018 01:45 PM UTC **Owner:** nobody When i am using the htmlunit-2.15 in android project. getting this issue Can't find common super class of [com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable] --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-07-10 17:11:55
|
Revision: 15451 http://sourceforge.net/p/htmlunit/code/15451 Author: rbri Date: 2018-07-10 17:11:42 +0000 (Tue, 10 Jul 2018) Log Message: ----------- more robust and retested with IE Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLink2Test.java Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLink2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLink2Test.java 2018-07-10 16:57:10 UTC (rev 15450) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLink2Test.java 2018-07-10 17:11:42 UTC (rev 15451) @@ -27,6 +27,7 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; +import com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -208,7 +209,9 @@ * @throws Exception if an error occurs */ @Test - @Alerts({"onLoad1", "onLoadJs1", "onLoad2", "body onLoad;"}) + @Alerts(DEFAULT = {"onLoad1", "onLoadJs1", "onLoad2", "body onLoad;"}, + IE = {"onLoadJs1", "body onLoad", "onLoad1", "onLoad2;"}) + @NotYetImplemented(TestedBrowser.IE) public void onLoadOrder() throws Exception { getMockWebConnection().setResponse(new URL(URL_FIRST, "simple1.css"), ""); getMockWebConnection().setResponse(new URL(URL_FIRST, "simple2.css"), ""); @@ -238,7 +241,7 @@ * @throws Exception if an error occurs */ @Test - @Alerts({"onLoad [object Event]", "onError [object Event]"}) + @Alerts("onLoad [object Event]") public void onLoadDynamic() throws Exception { getMockWebConnection().setResponse(new URL(URL_FIRST, "simple.css"), ""); final String html @@ -253,7 +256,38 @@ + " dynLink.onload = function (e) { log(\"onLoad \" + e) };\n" + " dynLink.onerror = function (e) { log(\"onError \" + e) };\n" + " document.head.appendChild(dynLink);\n" + + " }\n" + + " function log(x) {\n" + + " document.getElementById('log').value += x + '\\n';\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'></body>\n" + + " <textarea id='log' cols='80' rows='40'></textarea>\n" + + "</body>\n" + + "</html>"; + + final WebDriver driver = loadPage2(html); + Thread.sleep(200); + final String text = driver.findElement(By.id("log")).getAttribute("value").trim().replaceAll("\r", ""); + assertEquals(String.join("\n", getExpectedAlerts()), text); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = "onError [object Event]", + IE = "onLoad [object Event]") + @NotYetImplemented(TestedBrowser.IE) + public void onLoadDynamicUnknown() throws Exception { + getMockWebConnection().setResponse(new URL(URL_FIRST, "simple.css"), ""); + final String html + = "<html>\n" + + "<head>\n" + + " <script>\n" + + " function test() {\n" + " var dynLink = document.createElement('link');\n" + " dynLink.rel = 'stylesheet';\n" + " dynLink.type = 'text/css';\n" |
From: <rb...@us...> - 2018-07-10 16:57:19
|
Revision: 15450 http://sourceforge.net/p/htmlunit/code/15450 Author: rbri Date: 2018-07-10 16:57:10 +0000 (Tue, 10 Jul 2018) Log Message: ----------- use fixed language for our chrome driver Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2018-07-10 16:25:01 UTC (rev 15449) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2018-07-10 16:57:10 UTC (rev 15450) @@ -210,8 +210,8 @@ EDGE.scriptAcceptHeader_ = "application/javascript, */*;q=0.8"; // CHROME - CHROME.applicationVersion_ = "5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"; - CHROME.userAgent_ = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"; + CHROME.applicationVersion_ = "5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"; + CHROME.userAgent_ = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"; CHROME.applicationCodeName_ = "Mozilla"; CHROME.vendor_ = "Google Inc."; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2018-07-10 16:25:01 UTC (rev 15449) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2018-07-10 16:57:10 UTC (rev 15450) @@ -75,6 +75,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriverService; +import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.edge.EdgeDriver; import org.openqa.selenium.edge.EdgeDriverService; import org.openqa.selenium.firefox.FirefoxDriver; @@ -425,7 +426,9 @@ if (CHROME_BIN_ != null) { System.setProperty(ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY, CHROME_BIN_); } - return new ChromeDriver(); + final ChromeOptions options = new ChromeOptions(); + options.addArguments("--lang=en-US"); + return new ChromeDriver(options); } if (BrowserVersion.EDGE == getBrowserVersion()) { |
From: <rb...@us...> - 2018-07-10 16:25:06
|
Revision: 15449 http://sourceforge.net/p/htmlunit/code/15449 Author: rbri Date: 2018-07-10 16:25:01 +0000 (Tue, 10 Jul 2018) Log Message: ----------- ff60 support (wip) Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame2Test.java 2018-07-09 18:01:08 UTC (rev 15448) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame2Test.java 2018-07-10 16:25:01 UTC (rev 15449) @@ -28,7 +28,6 @@ import com.gargoylesoftware.htmlunit.BrowserRunner; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; -import com.gargoylesoftware.htmlunit.BrowserRunner.BuggyWebDriver; import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.WebDriverTestCase; @@ -241,9 +240,8 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {"false", "false", "true", "false"}, - IE = {"false", "false", "false", "false"}) - @BuggyWebDriver(CHROME) + @Alerts(DEFAULT = {"1:true", "2:false", "3:false", "4:false"}, + IE = {"1:false", "2:false", "3:false", "4:false"}) @NotYetImplemented({CHROME, FF}) public void createIframeFromStrictFunction() throws Exception { final String html = "<html><head>\n" @@ -251,13 +249,13 @@ + " function test() {\n" + " 'use strict';\n" + " var iframe = document.createElement('iframe');\n" - + " alert(!this);\n" - + " alert(!iframe);\n" + + " alert('1:' + !this);\n" + + " alert('2:' + !iframe);\n" + " }\n" + " function test2() {\n" + " var iframe = document.createElement('iframe');\n" - + " alert(!this);\n" - + " alert(!iframe);\n" + + " alert('3:' + !this);\n" + + " alert('4:' + !iframe);\n" + " }\n" + "</script>\n" + "</head>\n" Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java 2018-07-09 18:01:08 UTC (rev 15448) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement2Test.java 2018-07-10 16:25:01 UTC (rev 15449) @@ -1183,21 +1183,28 @@ + "<head>\n" + " <title>test</title>\n" + " <script>\n" + + " function log(x) {\n" + + " document.getElementById('log').value += x + '\\n';\n" + + " }\n" + " function doTest() {\n" + " var myNode = document.getElementById('myNode');\n" - + " alert('Old = ' + myNode.innerHTML);\n" + + " log('Old = ' + myNode.innerHTML);\n" + " myNode.innerHTML = ' <b><i id=\"newElt\">New cell value</i></b>';\n" - + " alert('New = ' + myNode.innerHTML);\n" - + " alert(document.getElementById('newElt').tagName);\n" + + " log('New = ' + myNode.innerHTML);\n" + + " log(document.getElementById('newElt').tagName);\n" + " }\n" + " </script>\n" + "</head>\n" + "<body onload='doTest()'>\n" - + "<p id='myNode'><b>Old innerHTML</b><!-- old comment --></p>\n" + + " <p id='myNode'><b>Old innerHTML</b><!-- old comment --></p>\n" + + " <textarea id='log'></textarea>\n" + "</body>\n" + "</html>"; - final WebDriver driver = loadPageWithAlerts2(html); + final WebDriver driver = loadPage2(html); + final WebElement log = driver.findElement(By.id("log")); + final String text = log.getAttribute("value").trim().replaceAll("\r", ""); + assertEquals(String.join("\n", getExpectedAlerts()), text); final WebElement pElt = driver.findElement(By.id("myNode")); assertEquals("p", pElt.getTagName()); |
From: RBRi <rb...@us...> - 2018-07-10 13:45:01
|
2.15 is realy old, we can't really support all the old version. But is sounds like a class loader issue. Can you please provide more infos like when you get the error and please provide complete stack traces and maybe more. --- ** [bugs:#1972] Getting the issue Can't find common super class of when using with android gradle** **Status:** open **Group:** 2.15 **Created:** Tue Jul 10, 2018 07:56 AM UTC by Dinesh Golla **Last Updated:** Tue Jul 10, 2018 08:24 AM UTC **Owner:** nobody When i am using the htmlunit-2.15 in android project. getting this issue Can't find common super class of [com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable] --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-07-10 13:41:06
|
Trevor, any update on this? Does it work or do you still have problems. --- ** [bugs:#1971] Scraping ASPX pages with HtmlUnit** **Status:** pending **Group:** 2.31 **Labels:** web scraping micrsoft asp.net aspx **Created:** Fri Jun 29, 2018 08:27 PM UTC by Trevor Maliborski **Last Updated:** Tue Jul 03, 2018 06:29 PM UTC **Owner:** RBRi I'm currently trying to set up a web scraping tool for sites that present information from medical license databases. Many of the sites I've found and wish to use are .aspx sites. I haven't found much online that discusses scraping .aspx sites with HtmlUnit, and the information I have found has not been helpful. The issue I'm having is similar to that which occurs on sites with AJAX: dynamic results are attached to the DOM when they arrive, but the DOM that HtmlUnit pulls from the headless browser only contains the static elements. I've tried pausing the scraper's main thread, tried using `waitForBackgroundJavascript()`, and using more explicit waiting techniques, e.g. something like this, which is copied from the HtmlUnit site: ~~~ for (int i = 0; i < 20; i++) { if (condition_to_happen_after_js_execution) { break; } synchronized (page) { page.wait(500); } } ~~~ Here's the code I have right now for scraping one of the sites: ~~~ private static String scrapeTexasDatabase(String firstName, String lastName) { try { WebClient webClient = new WebClient(BrowserVersion.CHROME); HtmlPage homePage = webClient.getPage("https://www.bon.texas.gov/forms/apninq.asp"); HtmlTextInput firstNameField = homePage.getForms().get(1).getInputByName("firstname"); HtmlTextInput lastNameField = homePage.getForms().get(1).getInputByName("lastname"); firstNameField.setValueAttribute(firstName); lastNameField.setValueAttribute(lastName); HtmlSubmitInput searchButton = homePage.getForms().get(1).getInputByValue("Submit"); HtmlPage resultsPage = searchButton.click(); // this should be the inner text of a heading tag which includes the name of someone // from the Texas database, but instead no h2 elements are found at all String str = resultsPage.getElementsByTagName("h2").get(0).getTextContent(); return str.trim(); } catch (Exception e) { System.out.println("Caught exception: " + e); } return null; } ~~~ Searching for "Joesph Smith" on the Texas Nursing License site being used here yields a single result. After looking through the page source, I've found that an <h2> element is placed at the top of each result, a heading which holds a given license holder's name. This information is added dynamically but I still need to be able to scrape the information for each search result. Any help would be appreciated! --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-07-09 18:01:47
|
Revision: 15448 http://sourceforge.net/p/htmlunit/code/15448 Author: rbri Date: 2018-07-09 18:01:08 +0000 (Mon, 09 Jul 2018) Log Message: ----------- many fixes for document.createEvent('xxx') to support the various UI events Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2018-07-09 16:45:18 UTC (rev 15447) +++ trunk/htmlunit/src/changes/changes.xml 2018-07-09 18:01:08 UTC (rev 15448) @@ -14,6 +14,9 @@ <action type="remove" dev="rbri"> FF45 support removed. </action> + <action type="fix" dev="rbri"> + Many fixes for document.createEvent('xxx') to support the various UI events. + </action> <action type="fix" dev="rbri" issue="1966" due-to="Atsushi Nakagawa"> Correct handling of additional parameters provided in functions setTimeout/setInterval. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-09 16:45:18 UTC (rev 15447) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-09 18:01:08 UTC (rev 15448) @@ -238,6 +238,10 @@ @BrowserFeature({CHROME, FF}) EVENT_TYPE_BEFOREUNLOADEVENT, + /** Supports event type 'FocusEvent'. */ + @BrowserFeature({CHROME, FF60, IE}) + EVENT_TYPE_FOCUSEVENT, + /** Supports event type 'HashChangeEvent'. */ @BrowserFeature({CHROME, FF}) EVENT_TYPE_HASHCHANGEEVENT, @@ -258,6 +262,14 @@ @BrowserFeature(IE) EVENT_TYPE_PROGRESSEVENT, + /** Supports event type 'SVGZoomEvent'. */ + @BrowserFeature(FF52) + EVENT_TYPE_SVGZOOMEVENT, + + /** Supports event type 'WheelEvent'. */ + @BrowserFeature({CHROME, IE}) + EVENT_TYPE_WHEELEVENT, + /** For new pages the focus points to the body node. */ @BrowserFeature(IE) FOCUS_BODY_ELEMENT_AT_START, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2018-07-09 16:45:18 UTC (rev 15447) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2018-07-09 18:01:08 UTC (rev 15448) @@ -17,11 +17,14 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCLOSE_DOCUMENT_CREATE_NOT_SUPPORTED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONPOPSTATE_DOCUMENT_CREATE_NOT_SUPPORTED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_BEFOREUNLOADEVENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_FOCUSEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_HASHCHANGEEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_KEY_EVENTS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_MOUSEWHEELEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_POINTEREVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_PROGRESSEVENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_SVGZOOMEVENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_WHEELEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_APPLETS_NODELIST; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_CHARSET_LOWERCASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ANCHORS_REQUIRES_NAME_OR_ID; @@ -128,7 +131,10 @@ import com.gargoylesoftware.htmlunit.javascript.host.event.PointerEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.PopStateEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.ProgressEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.SVGZoomEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.TextEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.UIEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.WheelEvent; import com.gargoylesoftware.htmlunit.javascript.host.html.DocumentProxy; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLAnchorElement; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection; @@ -212,8 +218,8 @@ dom3EventMap.put("CustomEvent", CustomEvent.class); dom3EventMap.put("CloseEvent", CloseEvent.class); dom3EventMap.put("CompositionEvent", CompositionEvent.class); - dom3EventMap.put("FocusEvent", FocusEvent.class); dom3EventMap.put("DragEvent", DragEvent.class); + dom3EventMap.put("TextEvent", TextEvent.class); SUPPORTED_DOM3_EVENT_TYPE_MAP = Collections.unmodifiableMap(dom3EventMap); final Map<String, Class<? extends Event>> additionalEventMap = new HashMap<>(); @@ -225,6 +231,9 @@ additionalEventMap.put("PopStateEvent", PopStateEvent.class); additionalEventMap.put("ProgressEvent", ProgressEvent.class); additionalEventMap.put("MouseWheelEvent", MouseWheelEvent.class); + additionalEventMap.put("FocusEvent", FocusEvent.class); + additionalEventMap.put("WheelEvent", WheelEvent.class); + additionalEventMap.put("SVGZoomEvent", SVGZoomEvent.class); SUPPORTED_VENDOR_EVENT_TYPE_MAP = Collections.unmodifiableMap(additionalEventMap); } @@ -1218,7 +1227,13 @@ && getBrowserVersion().hasFeature(EVENT_TYPE_POINTEREVENT) || "PopStateEvent".equals(eventType) || "ProgressEvent".equals(eventType) - && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT))) { + && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT) + || "FocusEvent".equals(eventType) + && getBrowserVersion().hasFeature(EVENT_TYPE_FOCUSEVENT) + || "SVGZoomEvent".equals(eventType) + && getBrowserVersion().hasFeature(EVENT_TYPE_SVGZOOMEVENT) + || "WheelEvent".equals(eventType) + && getBrowserVersion().hasFeature(EVENT_TYPE_WHEELEVENT))) { clazz = SUPPORTED_VENDOR_EVENT_TYPE_MAP.get(eventType); if (PopStateEvent.class == clazz Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-09 16:45:18 UTC (rev 15447) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-09 18:01:08 UTC (rev 15448) @@ -320,23 +320,34 @@ html.append("<tr>").append('\n').append("<td rowspan='2'>").append("<a name='" + name + "'>").append(name) .append("</a>").append("</td>").append('\n').append("<td>"); int implementedCount = 0; - for (int i = 0; i < realProperties.size(); i++) { - final String color; - if (implementedProperties.contains(realProperties.get(i))) { - color = "green"; - implementedCount++; - } - else { - color = "blue"; - } - html.append("<span style='color: " + color + "'>").append(realProperties.get(i)).append("</span>"); - if (i < realProperties.size() - 1) { - html.append(',').append(' '); - } - } + if (realProperties.isEmpty()) { html.append(" "); } + else if (realProperties.size() == 1 + && realProperties.contains("exception") + && implementedProperties.size() == 1 + && implementedProperties.contains("exception") + && erroredProperties.size() == 0) { + html.append(" "); + } + else { + for (int i = 0; i < realProperties.size(); i++) { + final String color; + if (implementedProperties.contains(realProperties.get(i))) { + color = "green"; + implementedCount++; + } + else { + color = "blue"; + } + html.append("<span style='color: " + color + "'>").append(realProperties.get(i)).append("</span>"); + if (i < realProperties.size() - 1) { + html.append(',').append(' '); + } + } + } + html.append("</td>").append("<td>").append(implementedCount).append('/') .append(realProperties.size()).append("</td>").append("</tr>").append('\n'); html.append("<tr>").append("<td>"); @@ -3142,7 +3153,7 @@ FF52 = "exception", FF60 = "relatedTarget", IE = "initFocusEvent(),relatedTarget") - @NotYetImplemented + @NotYetImplemented({CHROME, FF60, IE}) public void focusEvent() throws Exception { testString("document.createEvent('FocusEvent'), document.createEvent('UIEvent')"); } |
From: <rb...@us...> - 2018-07-09 16:45:23
|
Revision: 15447 http://sourceforge.net/p/htmlunit/code/15447 Author: rbri Date: 2018-07-09 16:45:18 +0000 (Mon, 09 Jul 2018) Log Message: ----------- fix my last commit Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2018-07-09 13:29:28 UTC (rev 15446) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2018-07-09 16:45:18 UTC (rev 15447) @@ -320,6 +320,7 @@ setCtrlKey(ctrlKey); setAltKey(altKey); setShiftKey(shiftKey); + setMetaKey(metaKey); button_ = button; // Ignore the relatedTarget parameter; we don't support it yet. } |
From: <rb...@us...> - 2018-07-09 13:29:39
|
Revision: 15446 http://sourceforge.net/p/htmlunit/code/15446 Author: rbri Date: 2018-07-09 13:29:28 +0000 (Mon, 09 Jul 2018) Log Message: ----------- ff60 support (wip) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/KeyboardEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PointerEvent.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/UIEvent.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -246,6 +246,10 @@ @BrowserFeature(FF) EVENT_TYPE_KEY_EVENTS, + /** Supports vendor specific event type 'MouseWheelEvent'. */ + @BrowserFeature(IE) + EVENT_TYPE_MOUSEWHEELEVENT, + /** Supports event type 'PointerEvent'. */ @BrowserFeature(IE) EVENT_TYPE_POINTEREVENT, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Document.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -19,6 +19,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_BEFOREUNLOADEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_HASHCHANGEEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_KEY_EVENTS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_MOUSEWHEELEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_POINTEREVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_TYPE_PROGRESSEVENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_APPLETS_NODELIST; @@ -113,12 +114,16 @@ import com.gargoylesoftware.htmlunit.javascript.host.css.StyleSheetList; import com.gargoylesoftware.htmlunit.javascript.host.event.BeforeUnloadEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.CloseEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.CompositionEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.CustomEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.DragEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.Event; +import com.gargoylesoftware.htmlunit.javascript.host.event.FocusEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.HashChangeEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.KeyboardEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.MessageEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.MouseEvent; +import com.gargoylesoftware.htmlunit.javascript.host.event.MouseWheelEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.MutationEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.PointerEvent; import com.gargoylesoftware.htmlunit.javascript.host.event.PopStateEvent; @@ -206,6 +211,9 @@ dom3EventMap.put("UIEvent", UIEvent.class); dom3EventMap.put("CustomEvent", CustomEvent.class); dom3EventMap.put("CloseEvent", CloseEvent.class); + dom3EventMap.put("CompositionEvent", CompositionEvent.class); + dom3EventMap.put("FocusEvent", FocusEvent.class); + dom3EventMap.put("DragEvent", DragEvent.class); SUPPORTED_DOM3_EVENT_TYPE_MAP = Collections.unmodifiableMap(dom3EventMap); final Map<String, Class<? extends Event>> additionalEventMap = new HashMap<>(); @@ -216,6 +224,7 @@ additionalEventMap.put("PointerEvent", PointerEvent.class); additionalEventMap.put("PopStateEvent", PopStateEvent.class); additionalEventMap.put("ProgressEvent", ProgressEvent.class); + additionalEventMap.put("MouseWheelEvent", MouseWheelEvent.class); SUPPORTED_VENDOR_EVENT_TYPE_MAP = Collections.unmodifiableMap(additionalEventMap); } @@ -1200,14 +1209,16 @@ && ("Events".equals(eventType) || "KeyEvents".equals(eventType) && getBrowserVersion().hasFeature(EVENT_TYPE_KEY_EVENTS) || "HashChangeEvent".equals(eventType) - && getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT) + && getBrowserVersion().hasFeature(EVENT_TYPE_HASHCHANGEEVENT) || "BeforeUnloadEvent".equals(eventType) - && getBrowserVersion().hasFeature(EVENT_TYPE_BEFOREUNLOADEVENT) + && getBrowserVersion().hasFeature(EVENT_TYPE_BEFOREUNLOADEVENT) + || "MouseWheelEvent".equals(eventType) + && getBrowserVersion().hasFeature(EVENT_TYPE_MOUSEWHEELEVENT) || "PointerEvent".equals(eventType) - && getBrowserVersion().hasFeature(EVENT_TYPE_POINTEREVENT) + && getBrowserVersion().hasFeature(EVENT_TYPE_POINTEREVENT) || "PopStateEvent".equals(eventType) || "ProgressEvent".equals(eventType) - && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT))) { + && getBrowserVersion().hasFeature(EVENT_TYPE_PROGRESSEVENT))) { clazz = SUPPORTED_VENDOR_EVENT_TYPE_MAP.get(eventType); if (PopStateEvent.class == clazz Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -534,7 +534,7 @@ /** * @return indicates if event propagation is stopped */ - @JsxGetter(IE) + @JsxGetter public boolean isCancelBubble() { return stopPropagation_; } @@ -542,7 +542,7 @@ /** * @param newValue indicates if event propagation is stopped */ - @JsxSetter(IE) + @JsxSetter public void setCancelBubble(final boolean newValue) { stopPropagation_ = newValue; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/KeyboardEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/KeyboardEvent.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/KeyboardEvent.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -38,6 +38,7 @@ * * @author Ahmed Ashour * @author Frank Danek + * @author Ronald Brill */ @JsxClass public class KeyboardEvent extends UIEvent { @@ -851,6 +852,9 @@ private int charCode_; private int which_; + /** Whether or not the "meta" key was pressed during the firing of the event. */ + private boolean metaKey_; + /** * Creates a new keyboard event instance. */ @@ -1130,4 +1134,19 @@ } } + /** + * Returns whether or not the "meta" key was pressed during the event firing. + * @return whether or not the "meta" key was pressed during the event firing + */ + @JsxGetter + public boolean getMetaKey() { + return metaKey_; + } + + /** + * @param metaKey whether Meta has been pressed during this event or not + */ + protected void setMetaKey(final boolean metaKey) { + metaKey_ = metaKey; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -111,6 +111,9 @@ /** Switch to disable label handling if we already processing the event triggered from label processing */ private boolean processLabelAfterBubbling_ = true; + /** Whether or not the "meta" key was pressed during the firing of the event. */ + private boolean metaKey_; + /** * Used to build the prototype. */ @@ -137,7 +140,6 @@ setShiftKey(shiftKey); setCtrlKey(ctrlKey); setAltKey(altKey); - setMetaKey(false); if (button != BUTTON_LEFT && button != BUTTON_MIDDLE && button != BUTTON_RIGHT) { throw new IllegalArgumentException("Invalid button code: " + button); @@ -318,7 +320,6 @@ setCtrlKey(ctrlKey); setAltKey(altKey); setShiftKey(shiftKey); - setMetaKey(metaKey); button_ = button; // Ignore the relatedTarget parameter; we don't support it yet. } @@ -395,4 +396,20 @@ public void disableProcessLabelAfterBubbling() { processLabelAfterBubbling_ = false; } + + /** + * Returns whether or not the "meta" key was pressed during the event firing. + * @return whether or not the "meta" key was pressed during the event firing + */ + @JsxGetter + public boolean getMetaKey() { + return metaKey_; + } + + /** + * @param metaKey whether Meta has been pressed during this event or not + */ + protected void setMetaKey(final boolean metaKey) { + metaKey_ = metaKey; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PointerEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PointerEvent.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/PointerEvent.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -169,7 +169,7 @@ * @param hwTimestamp the initial value of hwTimestamp * @param isPrimary the initial value of isPrimary */ - @JsxFunction + @JsxFunction(IE) public void initPointerEvent(final String type, final boolean bubbles, final boolean cancelable, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/UIEvent.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/UIEvent.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/UIEvent.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -25,7 +25,6 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter; -import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter; /** * JavaScript object representing a UI event. For general information on which properties and functions should be @@ -34,6 +33,7 @@ * @author Daniel Gredler * @author Ahmed Ashour * @author Frank Danek + * @author Ronald Brill */ @JsxClass public class UIEvent extends Event { @@ -49,9 +49,6 @@ /** Specifies some detail information about the event. */ private long detail_; - /** Whether or not the "meta" key was pressed during the firing of the event. */ - private boolean metaKey_; - /** * Creates a new UI event instance. */ @@ -100,24 +97,6 @@ } /** - * @return indicates if event propagation is stopped - */ - @Override - @JsxGetter - public boolean isCancelBubble() { - return super.isCancelBubble(); - } - - /** - * @param newValue indicates if event propagation is stopped - */ - @Override - @JsxSetter - public void setCancelBubble(final boolean newValue) { - super.setCancelBubble(newValue); - } - - /** * Returns the view from which the event was generated. In browsers, this is the originating window. * * @return the view from which the event was generated @@ -147,21 +126,4 @@ // Ignore the view parameter; we always use the window. setDetail(detail); } - - /** - * Returns whether or not the "meta" key was pressed during the event firing. - * @return whether or not the "meta" key was pressed during the event firing - */ - @JsxGetter - public boolean getMetaKey() { - return metaKey_; - } - - /** - * @param metaKey whether Meta has been pressed during this event or not - */ - protected void setMetaKey(final boolean metaKey) { - metaKey_ = metaKey; - } - } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-09 10:23:36 UTC (rev 15445) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/general/ElementPropertiesTest.java 2018-07-09 13:29:28 UTC (rev 15446) @@ -18,6 +18,7 @@ import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.EDGE; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF52; +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF60; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; import static java.nio.charset.StandardCharsets.ISO_8859_1; @@ -82,7 +83,12 @@ + " var unknown = document.createElement('harhar');\n" + " var div = document.createElement('div');\n" + " var svg = document.getElementById('mySvg');\n" - + " process(" + string + ");\n" + + " try{\n" + + " process(" + string + ");\n" + + " } catch (e) {\n" + + " alert('exception');\n" + + " return;" + + " }\n" + " }\n" + "\n" + " /*\n" @@ -3017,12 +3023,211 @@ FF60 = "detail,initUIEvent(),layerX,layerY,pageX,pageY,rangeOffset,rangeParent," + "SCROLL_PAGE_DOWN,SCROLL_PAGE_UP,view,which", IE = "detail,initUIEvent(),view") - @NotYetImplemented + @NotYetImplemented({CHROME, FF}) public void uiEvent() throws Exception { testString("document.createEvent('UIEvent'), document.createEvent('Event')"); } /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.DragEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "dataTransfer", + FF52 = "dataTransfer,initDragEvent()", + FF60 = "dataTransfer,initDragEvent()", + IE = "dataTransfer,initDragEvent(),msConvertURL()") + @NotYetImplemented + public void dragEvent() throws Exception { + testString("document.createEvent('DragEvent'), document.createEvent('MouseEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.PointerEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "getCoalescedEvents(),height,isPrimary,pointerId,pointerType,pressure," + + "tangentialPressure,tiltX,tiltY,twist,width", + FF52 = "exception", + FF60 = "getCoalescedEvents(),height,isPrimary,pointerId,pointerType,pressure," + + "tangentialPressure,tiltX,tiltY,twist,width", + IE = "exception") + @NotYetImplemented({CHROME, FF60}) + public void pointerEvent() throws Exception { + testString("new PointerEvent('click'), document.createEvent('MouseEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.PointerEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "exception", + FF52 = "exception", + FF60 = "exception", + IE = "height,hwTimestamp,initPointerEvent(),isPrimary,pointerId," + + "pointerType,pressure,rotation,tiltX,tiltY,width") + @NotYetImplemented(IE) + public void pointerEvent2() throws Exception { + testString(" document.createEvent('PointerEvent'), document.createEvent('MouseEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.WheelEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "deltaMode,deltaX,deltaY,deltaZ,DOM_DELTA_LINE,DOM_DELTA_PAGE," + + "DOM_DELTA_PIXEL,wheelDelta,wheelDeltaX,wheelDeltaY", + FF52 = "exception", + FF60 = "exception", + IE = "deltaMode,deltaX,deltaY,deltaZ,DOM_DELTA_LINE,DOM_DELTA_PAGE,DOM_DELTA_PIXEL,initWheelEvent()") + @NotYetImplemented({CHROME, IE}) + public void wheelEvent() throws Exception { + testString("document.createEvent('WheelEvent'), document.createEvent('MouseEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.MouseEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "altKey,button,buttons,clientX,clientY,ctrlKey,fromElement,getModifierState()," + + "initMouseEvent(),layerX,layerY,metaKey,movementX,movementY,offsetX,offsetY," + + "pageX,pageY,relatedTarget,screenX,screenY,shiftKey,toElement,x,y", + FF52 = "altKey,button,buttons,clientX,clientY,ctrlKey,getModifierState(),initMouseEvent()," + + "initNSMouseEvent(),metaKey,movementX,movementY,MOZ_SOURCE_CURSOR,MOZ_SOURCE_ERASER," + + "MOZ_SOURCE_KEYBOARD,MOZ_SOURCE_MOUSE,MOZ_SOURCE_PEN,MOZ_SOURCE_TOUCH,MOZ_SOURCE_UNKNOWN," + + "mozInputSource,mozPressure,offsetX,offsetY,region,relatedTarget,screenX,screenY,shiftKey", + FF60 = "altKey,button,buttons,clientX,clientY,ctrlKey,getModifierState(),initMouseEvent()," + + "initNSMouseEvent(),metaKey,movementX,movementY,MOZ_SOURCE_CURSOR,MOZ_SOURCE_ERASER," + + "MOZ_SOURCE_KEYBOARD,MOZ_SOURCE_MOUSE,MOZ_SOURCE_PEN,MOZ_SOURCE_TOUCH,MOZ_SOURCE_UNKNOWN," + + "mozInputSource,mozPressure,offsetX,offsetY,region,relatedTarget,screenX,screenY,shiftKey,x,y", + IE = "altKey,button,buttons,clientX,clientY,ctrlKey,fromElement,getModifierState(),initMouseEvent()," + + "layerX,layerY,metaKey,offsetX,offsetY,pageX,pageY,relatedTarget,screenX,screenY,shiftKey," + + "toElement,which,x,y") + @NotYetImplemented + public void mouseEvent() throws Exception { + testString("document.createEvent('MouseEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.CompositionEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "data,initCompositionEvent()", + FF60 = "data,initCompositionEvent(),locale", + FF52 = "data,initCompositionEvent(),locale", + IE = "data,initCompositionEvent(),locale") + @NotYetImplemented + public void compositionEvent() throws Exception { + testString("document.createEvent('CompositionEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.FocusEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "relatedTarget", + FF52 = "exception", + FF60 = "relatedTarget", + IE = "initFocusEvent(),relatedTarget") + @NotYetImplemented + public void focusEvent() throws Exception { + testString("document.createEvent('FocusEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.InputEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "data,dataTransfer,getTargetRanges(),inputType,isComposing", + FF52 = "isComposing", + FF60 = "isComposing", + IE = "exception") + @NotYetImplemented({CHROME, FF}) + public void inputEvent() throws Exception { + testString("new InputEvent('input'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.MouseWheelEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "exception", + FF52 = "exception", + FF60 = "exception", + IE = "altKey,button,buttons,clientX,clientY,ctrlKey,fromElement,getModifierState(),initMouseEvent()," + + "initMouseWheelEvent(),layerX,layerY,metaKey,offsetX,offsetY,pageX,pageY,relatedTarget," + + "screenX,screenY,shiftKey,toElement,wheelDelta,which,x,y") + @NotYetImplemented(IE) + public void mouseWheelEvent() throws Exception { + testString("document.createEvent('MouseWheelEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.SVGZoomEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "exception", + FF52 = "newScale,newTranslate,previousScale,previousTranslate", + FF60 = "exception", + IE = "exception") + @NotYetImplemented(FF52) + public void svgZoomEvent() throws Exception { + testString("document.createEvent('SVGZoomEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.TextEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "data,initTextEvent()", + FF52 = "data,initCompositionEvent(),locale", + FF60 = "data,initCompositionEvent(),locale", + IE = "data,DOM_INPUT_METHOD_DROP,DOM_INPUT_METHOD_HANDWRITING,DOM_INPUT_METHOD_IME," + + "DOM_INPUT_METHOD_KEYBOARD,DOM_INPUT_METHOD_MULTIMODAL,DOM_INPUT_METHOD_OPTION," + + "DOM_INPUT_METHOD_PASTE,DOM_INPUT_METHOD_SCRIPT,DOM_INPUT_METHOD_UNKNOWN," + + "DOM_INPUT_METHOD_VOICE,initTextEvent(),inputMethod,locale") + @NotYetImplemented + public void textEvent() throws Exception { + testString("document.createEvent('TextEvent'), document.createEvent('UIEvent')"); + } + + /** + * Test {@link com.gargoylesoftware.htmlunit.javascript.host.event.TouchEvent}. + * + * @throws Exception if the test fails + */ + @Test + @Alerts(CHROME = "altKey,changedTouches,ctrlKey,metaKey,shiftKey,targetTouches,touches", + FF52 = "exception", + FF60 = "exception", + IE = "exception") + @NotYetImplemented(CHROME) + public void touchEvent2() throws Exception { + testString("new TouchEvent('touch'), document.createEvent('UIEvent')"); + } + + /** * Test {@link com.gargoylesoftware.htmlunit.html.HtmlSlot}. * * @throws Exception if the test fails |
From: <rb...@us...> - 2018-07-09 10:23:39
|
Revision: 15445 http://sourceforge.net/p/htmlunit/code/15445 Author: rbri Date: 2018-07-09 10:23:36 +0000 (Mon, 09 Jul 2018) Log Message: ----------- ff60 support (wip) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2018-07-09 10:11:23 UTC (rev 15444) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2018-07-09 10:23:36 UTC (rev 15445) @@ -26,6 +26,7 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF; +import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF52; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.IE; import java.io.IOException; @@ -1447,7 +1448,7 @@ * Returns the {@code onwheel} event handler for this element. * @return the {@code onwheel} event handler for this element */ - @JsxGetter({CHROME, FF}) + @JsxGetter(FF52) public Function getOnwheel() { return getEventHandler("wheel"); } @@ -1456,7 +1457,7 @@ * Sets the {@code onwheel} event handler for this element. * @param onwheel the {@code onwheel} event handler for this element */ - @JsxSetter({CHROME, FF}) + @JsxSetter(FF52) public void setOnwheel(final Object onwheel) { setEventHandler("wheel", onwheel); } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2018-07-09 10:11:23 UTC (rev 15444) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2018-07-09 10:23:36 UTC (rev 15445) @@ -24,6 +24,7 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF52; +import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF60; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.IE; import java.io.IOException; @@ -2039,6 +2040,24 @@ } /** + * Returns the {@code onwheel} event handler for this element. + * @return the {@code onwheel} event handler for this element + */ + @JsxGetter({CHROME, FF60}) + public Function getOnwheel() { + return super.getOnwheel(); + } + + /** + * Sets the {@code onwheel} event handler for this element. + * @param onwheel the {@code onwheel} event handler for this element + */ + @JsxSetter({CHROME, FF60}) + public void setOnwheel(final Object onwheel) { + super.setOnwheel(onwheel); + } + + /** * Mock for the moment. * @param retargetToElement if true, all events are targeted directly to this element; * if false, events can also fire at descendants of this element Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGElement.java 2018-07-09 10:11:23 UTC (rev 15444) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/svg/SVGElement.java 2018-07-09 10:23:36 UTC (rev 15445) @@ -18,6 +18,7 @@ import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF52; +import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF60; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.IE; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; @@ -1642,4 +1643,21 @@ setEventHandler("dragexit", dragexit); } + /** + * Returns the {@code onwheel} event handler for this element. + * @return the {@code onwheel} event handler for this element + */ + @JsxGetter({CHROME, FF60}) + public Function getOnwheel() { + return super.getOnwheel(); + } + + /** + * Sets the {@code onwheel} event handler for this element. + * @param onwheel the {@code onwheel} event handler for this element + */ + @JsxSetter({CHROME, FF60}) + public void setOnwheel(final Object onwheel) { + super.setOnwheel(onwheel); + } } |
From: <rb...@us...> - 2018-07-09 10:11:26
|
Revision: 15444 http://sourceforge.net/p/htmlunit/code/15444 Author: rbri Date: 2018-07-09 10:11:23 +0000 (Mon, 09 Jul 2018) Log Message: ----------- ff60 support (wip) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2018-07-09 10:03:39 UTC (rev 15443) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2018-07-09 10:11:23 UTC (rev 15444) @@ -1957,6 +1957,25 @@ } /** + * Mock for the moment. + * @param retargetToElement if true, all events are targeted directly to this element; + * if false, events can also fire at descendants of this element + */ + @JsxFunction(FF) + public void setCapture(final boolean retargetToElement) { + // empty + } + + /** + * Mock for the moment. + * @return true for success + */ + @JsxFunction(FF) + public boolean releaseCapture() { + return true; + } + + /** * Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, * just before this ChildNode. * @param context the context Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2018-07-09 10:03:39 UTC (rev 15443) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2018-07-09 10:11:23 UTC (rev 15444) @@ -2043,9 +2043,9 @@ * @param retargetToElement if true, all events are targeted directly to this element; * if false, events can also fire at descendants of this element */ - @JsxFunction({FF, IE}) + @JsxFunction(IE) public void setCapture(final boolean retargetToElement) { - // empty + super.setCapture(retargetToElement); } /** @@ -2052,9 +2052,9 @@ * Mock for the moment. * @return true for success */ - @JsxFunction({FF, IE}) + @JsxFunction(IE) public boolean releaseCapture() { - return true; + return super.releaseCapture(); } /** |