From: <rb...@us...> - 2017-06-08 07:27:32
|
Revision: 14577 http://sourceforge.net/p/htmlunit/code/14577 Author: rbri Date: 2017-06-08 07:27:29 +0000 (Thu, 08 Jun 2017) Log Message: ----------- re tested with real browsers and fixed Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributesIterableTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java 2017-06-08 05:21:42 UTC (rev 14576) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributes.java 2017-06-08 07:27:29 UTC (rev 14577) @@ -2399,19 +2399,19 @@ PIXEL_WIDTH("pixelWidth", "pixel-width", ie("").setIteratable(false)), /** The style property {@code placeContent}. */ - PLACE_CONTENT("placeContent", "place-content", chrome("normal normal"), ff52up("").setIteratable(false)), + PLACE_CONTENT("placeContent", "place-content", chrome("normal normal"), ff52up("")), /** The style property {@code place-content}. */ PLACE_CONTENT_("place-content", "place-content", ff52up("")), /** The style property {@code placeItems}. */ - PLACE_ITEMS("placeItems", "place-items", chrome("normal normal"), ff52up("").setIteratable(false)), + PLACE_ITEMS("placeItems", "place-items", chrome("normal normal"), ff52up("")), /** The style property {@code place-items}. */ PLACE_ITEMS_("place-items", "place-items", ff52up("")), /** The style property {@code placeSelf}. */ - PLACE_SELF("placeSelf", "place-self", chrome("normal normal"), ff52up("").setIteratable(false)), + PLACE_SELF("placeSelf", "place-self", chrome("normal normal"), ff52up("")), /** The style property {@code place-self}. */ PLACE_SELF_("place-self", "place-self", ff52up("")), Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributesIterableTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributesIterableTest.java 2017-06-08 05:21:42 UTC (rev 14576) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/StyleAttributesIterableTest.java 2017-06-08 07:27:29 UTC (rev 14577) @@ -748,8 +748,9 @@ * @throws Exception if an error occurs */ @Test - @Alerts(DEFAULT = "false", - CHROME = "true") + @Alerts(DEFAULT = "true", + FF45 = "false", + IE = "false") public void _PLACE_CONTENT() throws Exception { test("placeContent"); } @@ -758,8 +759,9 @@ * @throws Exception if an error occurs */ @Test - @Alerts(DEFAULT = "false", - CHROME = "true") + @Alerts(DEFAULT = "true", + FF45 = "false", + IE = "false") public void _PLACE_ITEMS() throws Exception { test("placeItems"); } @@ -768,8 +770,9 @@ * @throws Exception if an error occurs */ @Test - @Alerts(DEFAULT = "false", - CHROME = "true") + @Alerts(DEFAULT = "true", + FF45 = "false", + IE = "false") public void _PLACE_SELF() throws Exception { test("placeSelf"); } |
From: <rb...@us...> - 2017-06-10 11:01:34
|
Revision: 14582 http://sourceforge.net/p/htmlunit/code/14582 Author: rbri Date: 2017-06-10 11:01:31 +0000 (Sat, 10 Jun 2017) Log Message: ----------- latest chrome Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-10 10:56:53 UTC (rev 14581) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-10 11:01:31 UTC (rev 14582) @@ -828,10 +828,6 @@ @BrowserFeature(IE) JS_DOM_CDATA_DELETE_THROWS_NEGATIVE_COUNT, - /** Element.baseURI is null for XML element. */ - @BrowserFeature(CHROME) - JS_ELEMENT_BASE_URL_NULL, - /** Indicates that attributeNS returns an empty string instead of null if not found. */ @BrowserFeature(IE) JS_ELEMENT_GET_ATTRIBUTE_RETURNS_EMPTY, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-06-10 10:56:53 UTC (rev 14581) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-06-10 11:01:31 UTC (rev 14582) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit.javascript.host.dom; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ELEMENT_BASE_URL_NULL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NODE_CONTAINS_RETURNS_FALSE_FOR_INVALID_ARG; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NODE_INSERT_BEFORE_REF_OPTIONAL; import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME; @@ -701,9 +700,6 @@ */ @JsxGetter({CHROME, FF}) public String getBaseURI() { - if ("Element".equals(getClass().getSimpleName()) && getBrowserVersion().hasFeature(JS_ELEMENT_BASE_URL_NULL)) { - return null; - } return getDomNodeOrDie().getBaseURI(); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2017-06-10 10:56:53 UTC (rev 14581) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/ElementTest.java 2017-06-10 11:01:31 UTC (rev 14582) @@ -873,7 +873,6 @@ */ @Test @Alerts(DEFAULT = {"§§URL§§", "§§URL§§"}, - CHROME = {"null", "§§URL§§"}, IE = {"undefined", "undefined"}) public void baseURI() throws Exception { final String html = HtmlPageTest.STANDARDS_MODE_PREFIX_ + "<html><head><title>foo</title><script>\n" |
From: <rb...@us...> - 2017-06-11 10:53:55
|
Revision: 14592 http://sourceforge.net/p/htmlunit/code/14592 Author: rbri Date: 2017-06-11 10:53:53 +0000 (Sun, 11 Jun 2017) Log Message: ----------- make browser determination more robust Issue 1890 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java 2017-06-11 10:44:26 UTC (rev 14591) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java 2017-06-11 10:53:53 UTC (rev 14592) @@ -96,20 +96,25 @@ final BrowserVersion browser) { if (browser != null) { final SupportedBrowser expectedBrowser; - if (browser.equals(BrowserVersion.CHROME)) { + if (browser.isChrome()) { expectedBrowser = SupportedBrowser.CHROME; } - else if (browser.equals(BrowserVersion.INTERNET_EXPLORER)) { + else if (browser.isIE()) { expectedBrowser = SupportedBrowser.IE; } - else if (browser.equals(BrowserVersion.FIREFOX_45)) { - expectedBrowser = SupportedBrowser.FF45; + else if (browser.isEdge()) { + expectedBrowser = SupportedBrowser.EDGE; } - else if (browser.equals(BrowserVersion.FIREFOX_52)) { - expectedBrowser = SupportedBrowser.FF52; + else if (browser.isFirefox()) { + if (browser.getBrowserVersionNumeric() < 52) { + expectedBrowser = SupportedBrowser.FF45; + } + else { + expectedBrowser = SupportedBrowser.FF52; + } } else { - expectedBrowser = SupportedBrowser.EDGE; + expectedBrowser = SupportedBrowser.CHROME; // our current fallback } final String hostClassName = klass.getName(); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java 2017-06-11 10:44:26 UTC (rev 14591) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfigurationTest.java 2017-06-11 10:53:53 UTC (rev 14592) @@ -42,7 +42,9 @@ import org.junit.Test; import com.gargoylesoftware.htmlunit.BrowserVersion; +import com.gargoylesoftware.htmlunit.MockWebConnection; import com.gargoylesoftware.htmlunit.SimpleWebTestCase; +import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.host.worker.DedicatedWorkerGlobalScope; @@ -54,6 +56,7 @@ * @author Ahmed Ashour * @author Ronald Brill * @author Frank Danek + * @author Joerg Werner */ public class JavaScriptConfigurationTest extends SimpleWebTestCase { @@ -278,4 +281,51 @@ } } + /** + * see issue 1890. + * + * @throws Exception if the test fails + */ + @Test + public void original() throws Exception { + final BrowserVersion browserVersion = BrowserVersion.CHROME; + + test(browserVersion); + } + + /** + * see issue 1890. + * + * @throws Exception if the test fails + */ + @Test + public void cloned() throws Exception { + final BrowserVersion browserVersion = BrowserVersion.FIREFOX_45.clone(); + + test(browserVersion); + } + + /** + * see issue 1890. + * + * @throws Exception if the test fails + */ + @Test + public void clonedAndModified() throws Exception { + final BrowserVersion browserVersion = BrowserVersion.FIREFOX_45.clone(); + browserVersion.setUserAgent("foo"); + + test(browserVersion); + } + + private void test(final BrowserVersion browserVersion) throws IOException { + try (WebClient webClient = new WebClient(browserVersion)) { + final MockWebConnection conn = new MockWebConnection(); + conn.setDefaultResponse("<html><body onload='document.body.firstChild'></body></html>"); + webClient.setWebConnection(conn); + + webClient.getPage("http://localhost/"); + } + } + } |
From: <rb...@us...> - 2017-06-12 17:45:32
|
Revision: 14596 http://sourceforge.net/p/htmlunit/code/14596 Author: rbri Date: 2017-06-12 17:45:29 +0000 (Mon, 12 Jun 2017) Log Message: ----------- fix Array out of bounds Exception in insertBefore implementation when calling without any parameters. Issue 1891 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-06-11 14:26:06 UTC (rev 14595) +++ trunk/htmlunit/src/changes/changes.xml 2017-06-12 17:45:29 UTC (rev 14596) @@ -14,6 +14,9 @@ </action> </release> <release version="2.27" date="June 4, 2017" description="FF52, Bugfixes"> + <action type="fix" dev="rbri" issue="1891"> + JavaScript: fix Array out of bounds Exception in insertBefore implementation when calling without any parameters. + </action> <action type="add" dev="asashour" issue="44336828" system="stackoverflow"> JavaScript: implement Array.from(). </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-06-11 14:26:06 UTC (rev 14595) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-06-12 17:45:29 UTC (rev 14596) @@ -49,6 +49,7 @@ import net.sourceforge.htmlunit.corejs.javascript.Interpreter; import net.sourceforge.htmlunit.corejs.javascript.JavaScriptException; import net.sourceforge.htmlunit.corejs.javascript.RhinoException; +import net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime; import net.sourceforge.htmlunit.corejs.javascript.Scriptable; import net.sourceforge.htmlunit.corejs.javascript.Undefined; @@ -294,6 +295,11 @@ * @return the newly added child node */ protected Object insertBeforeImpl(final Object[] args) { + if (args.length < 1) { + throw ScriptRuntime.constructError("TypeError", + "Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 0 present."); + } + final Object newChildObject = args[0]; final Object refChildObject; if (args.length > 1) { @@ -310,17 +316,15 @@ // is the node allowed here? if (!isNodeInsertable(newChild)) { - throw asJavaScriptException( - new DOMException("Node cannot be inserted at the specified point in the hierarchy", - DOMException.HIERARCHY_REQUEST_ERR)); + throw ScriptRuntime.constructError("ReferenceError", + "Node cannot be inserted at the specified point in the hierarchy"); } if (newChildNode instanceof DomDocumentFragment) { final DomDocumentFragment fragment = (DomDocumentFragment) newChildNode; for (final DomNode child : fragment.getChildren()) { if (!isNodeInsertable((Node) child.getScriptableObject())) { - throw asJavaScriptException( - new DOMException("Node cannot be inserted at the specified point in the hierarchy", - DOMException.HIERARCHY_REQUEST_ERR)); + throw ScriptRuntime.constructError("ReferenceError", + "Node cannot be inserted at the specified point in the hierarchy"); } } } @@ -332,7 +336,8 @@ refChildNode = null; } else { - throw Context.reportRuntimeError("insertBefore: not enough arguments"); + throw ScriptRuntime.typeError( + "Failed to execute 'insertBefore' on 'Node': 2 arguments required, but only 1 present."); } } else if (refChildObject != null) { @@ -348,9 +353,7 @@ domNode.insertBefore(newChildNode, refChildNode); } catch (final org.w3c.dom.DOMException e) { - throw asJavaScriptException( - new DOMException(e.getMessage(), - DOMException.HIERARCHY_REQUEST_ERR)); + throw ScriptRuntime.constructError("ReferenceError", e.getMessage()); } insertedChild = newChild; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeTest.java 2017-06-11 14:26:06 UTC (rev 14595) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeTest.java 2017-06-12 17:45:29 UTC (rev 14596) @@ -762,6 +762,17 @@ * @throws Exception if the test fails */ @Test + @Alerts("exception") + public void insertBefore_noArgs() throws Exception { + insertBefore("aNode.insertBefore();"); + } + + /** + * Regression test to verify that insertBefore correctly appends + * the new child object when the reference child object is null. + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = "exception", IE = {"3", "SPAN"}) public void insertBefore_noSecondArg() throws Exception { |
From: <rb...@us...> - 2017-06-13 12:11:09
|
Revision: 14605 http://sourceforge.net/p/htmlunit/code/14605 Author: rbri Date: 2017-06-13 12:11:06 +0000 (Tue, 13 Jun 2017) Log Message: ----------- fix header for form submit (Chrome) Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-13 11:18:24 UTC (rev 14604) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-13 12:11:06 UTC (rev 14605) @@ -265,10 +265,22 @@ @BrowserFeature({CHROME, FF}) FORM_FORM_ATTRIBUTE_SUPPORTED, + /** Form submit includes the Cache-Control: max-age=0 header. */ + @BrowserFeature(CHROME) + FORM_SUBMISSION_HEADER_CACHE_CONTROL_MAX_AGE, + + /** Form submit includes the Cache-Control: cn-cache header. */ + @BrowserFeature(IE) + FORM_SUBMISSION_HEADER_CACHE_CONTROL_NO_CACHE, + /** Form submit forces an real request also if only the hash was changed. */ @BrowserFeature(CHROME) FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED, + /** Form submit includes the origin header. */ + @BrowserFeature(CHROME) + FORM_SUBMISSION_HEADER_ORIGIN, + /** Form submit is done without the hash part of the action url. */ @BrowserFeature(IE) FORM_SUBMISSION_URL_WITHOUT_HASH, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2017-06-13 11:18:24 UTC (rev 14604) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2017-06-13 12:11:06 UTC (rev 14605) @@ -15,6 +15,9 @@ package com.gargoylesoftware.htmlunit.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_HEADER_CACHE_CONTROL_MAX_AGE; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_HEADER_CACHE_CONTROL_NO_CACHE; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_HEADER_ORIGIN; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_URL_WITHOUT_HASH; import java.net.MalformedURLException; @@ -237,8 +240,20 @@ request.setEncodingType(FormEncodingType.getInstance(getEnctypeAttribute())); } request.setCharset(getSubmitCharset()); - request.setAdditionalHeader("Referer", htmlPage.getUrl() - .toExternalForm()); + + String referer = htmlPage.getUrl().toExternalForm(); + request.setAdditionalHeader("Referer", referer); + if (browser.hasFeature(FORM_SUBMISSION_HEADER_ORIGIN)) { + referer = StringUtils.stripEnd(referer, "/"); + request.setAdditionalHeader("Origin", referer); + } + if (browser.hasFeature(FORM_SUBMISSION_HEADER_CACHE_CONTROL_MAX_AGE)) { + request.setAdditionalHeader("Cache-Control", "max-age=0"); + } + if (browser.hasFeature(FORM_SUBMISSION_HEADER_CACHE_CONTROL_NO_CACHE)) { + request.setAdditionalHeader("Cache-Control", "no-cache"); + } + return request; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2017-06-13 11:18:24 UTC (rev 14604) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2017-06-13 12:11:06 UTC (rev 14605) @@ -14,7 +14,6 @@ */ package com.gargoylesoftware.htmlunit; -import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.CHROME; import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; import static java.nio.charset.StandardCharsets.ISO_8859_1; @@ -50,7 +49,7 @@ * @throws Exception if the test fails */ @Test - @NotYetImplemented({CHROME, IE}) + @NotYetImplemented(IE) public void post() throws Exception { final String html = "<html><body><form action='foo' method='post' accept-charset='iso-8859-1'>\n" + "<input name='text1' value='me &amp; you'>\n" |
From: <rb...@us...> - 2017-06-14 17:35:52
|
Revision: 14606 http://sourceforge.net/p/htmlunit/code/14606 Author: rbri Date: 2017-06-14 17:35:49 +0000 (Wed, 14 Jun 2017) Log Message: ----------- more applet support Modified Paths: -------------- trunk/htmlunit/src/main/java/netscape/javascript/JSObject.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAppletTest.java trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.html trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.jar trunk/htmlunit/src/test/resources/objects/simpleAppletDoIt.jar Modified: trunk/htmlunit/src/main/java/netscape/javascript/JSObject.java =================================================================== --- trunk/htmlunit/src/main/java/netscape/javascript/JSObject.java 2017-06-13 12:11:06 UTC (rev 14605) +++ trunk/htmlunit/src/main/java/netscape/javascript/JSObject.java 2017-06-14 17:35:49 UTC (rev 14606) @@ -64,7 +64,14 @@ LOG.info("JSObject call '" + methodName + "(" + args + ")'"); } - throw new RuntimeException("Not yet implemented (netscape.javascript.JSObject.call(String, Object[]))."); + final Object jsResult = ScriptableObject.callMethod(scriptableObject_, methodName, args); + if (jsResult instanceof ScriptableObject) { + return new JSObject((ScriptableObject) jsResult); + } + if (jsResult instanceof ConsString) { + return ((ConsString) jsResult).toString(); + } + return jsResult; } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAppletTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAppletTest.java 2017-06-13 12:11:06 UTC (rev 14605) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAppletTest.java 2017-06-14 17:35:49 UTC (rev 14606) @@ -308,6 +308,48 @@ * @throws Exception if the test fails */ @Test + public void checkAppletCall() throws Exception { + if (getBrowserVersion().isChrome()) { + return; + } + + final URL url = getClass().getResource("/applets/simpleAppletDoIt.html"); + + final WebClient webClient = getWebClient(); + final List<String> collectedStatus = new ArrayList<>(); + final StatusHandler statusHandler = new StatusHandler() { + @Override + public void statusMessageChanged(final Page page, final String message) { + collectedStatus.add(message); + } + }; + webClient.setStatusHandler(statusHandler); + webClient.getOptions().setAppletEnabled(true); + + final HtmlPage page = webClient.getPage(url); + + final HtmlTextInput input = page.getHtmlElementById("myInput"); + + HtmlButton button = page.getHtmlElementById("callWithoutParams"); + button.click(); + + assertEquals(2, collectedStatus.size()); + assertEquals("call: 'callSample'", collectedStatus.get(0)); + assertEquals(" 'done'", collectedStatus.get(1)); + assertEquals("undefined", input.asText()); + + button = page.getHtmlElementById("callWithStringParam"); + button.click(); + + assertEquals(4, collectedStatus.size()); + assertEquals("call: 'callSample'", collectedStatus.get(2)); + assertEquals("HtmlUnit", input.asText()); + } + + /** + * @throws Exception if the test fails + */ + @Test public void checkAppletExecJs() throws Exception { if (getBrowserVersion().isChrome()) { return; Modified: trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.html =================================================================== --- trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.html 2017-06-13 12:11:06 UTC (rev 14605) +++ trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.html 2017-06-14 17:35:49 UTC (rev 14606) @@ -7,6 +7,12 @@ var script = "document.getElementById('myInput').outerHTML"; applet.execJS(script); } + + function callSample(param) { + var input = document.getElementById('myInput'); + input.value = param; + return 'done'; + } </script> </head> <body> @@ -37,4 +43,7 @@ <button onclick="execJsOuterHtml()" id="execJsOuterHtml">execJsOuterHtml</button> <button onclick="document.applets[0].setValueAttribute('myInput', 'HtmlUnit')" id="setValueAttribute">setValueAttribute</button> +<button onclick="document.applets[0].callWithoutParams('callSample')" id="callWithoutParams">callWithoutParams</button> +<button onclick="document.applets[0].callWithStringParam('callSample')" id="callWithStringParam">callWithStringParam</button> + </body></html> Modified: trunk/htmlunit/src/test/resources/applets/simpleAppletDoIt.jar =================================================================== (Binary files differ) Modified: trunk/htmlunit/src/test/resources/objects/simpleAppletDoIt.jar =================================================================== (Binary files differ) |
From: <rb...@us...> - 2017-06-14 19:29:34
|
Revision: 14610 http://sourceforge.net/p/htmlunit/code/14610 Author: rbri Date: 2017-06-14 19:29:31 +0000 (Wed, 14 Jun 2017) Log Message: ----------- fix header for form get request Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2017-06-14 19:29:02 UTC (rev 14609) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java 2017-06-14 19:29:31 UTC (rev 14610) @@ -243,11 +243,14 @@ String referer = htmlPage.getUrl().toExternalForm(); request.setAdditionalHeader("Referer", referer); - if (browser.hasFeature(FORM_SUBMISSION_HEADER_ORIGIN)) { + + if (HttpMethod.POST == method + && browser.hasFeature(FORM_SUBMISSION_HEADER_ORIGIN)) { referer = StringUtils.stripEnd(referer, "/"); request.setAdditionalHeader("Origin", referer); } - if (browser.hasFeature(FORM_SUBMISSION_HEADER_CACHE_CONTROL_MAX_AGE)) { + if (HttpMethod.POST == method + && browser.hasFeature(FORM_SUBMISSION_HEADER_CACHE_CONTROL_MAX_AGE)) { request.setAdditionalHeader("Cache-Control", "max-age=0"); } if (browser.hasFeature(FORM_SUBMISSION_HEADER_CACHE_CONTROL_NO_CACHE)) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2017-06-14 19:29:02 UTC (rev 14609) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java 2017-06-14 19:29:31 UTC (rev 14610) @@ -50,7 +50,80 @@ */ @Test @NotYetImplemented(IE) - public void post() throws Exception { + public void formGet() throws Exception { + final String html = "<html><body><form action='foo' method='get' accept-charset='iso-8859-1'>\n" + + "<input name='text1' value='me &amp; you'>\n" + + "<textarea name='text2'>Hello\nworld!</textarea>\n" + + "<input type='submit' id='submit'>\n" + + "</form></body></html>"; + + getMockWebConnection().setDefaultResponse(""); + final WebDriver driver = loadPage2(html, URL_FIRST); + driver.findElement(By.id("submit")).click(); + + // better would be to look at the HTTP traffic directly + // rather than to examine a request that has been rebuilt but... + final WebRequest lastRequest = getMockWebConnection().getLastWebRequest(); + + assertSame(ISO_8859_1, lastRequest.getCharset()); + assertEquals(null, lastRequest.getProxyHost()); + assertEquals(null, lastRequest.getRequestBody()); + assertEquals(URL_FIRST + "foo", lastRequest.getUrl()); + + String expectedHeaders = ""; + if (getBrowserVersion().isChrome()) { + expectedHeaders = "Connection: keep-alive\n" + + "Host: localhost:" + PORT + "\n" + + "Referer: http://localhost:" + PORT + "/\n" + + "Upgrade-Insecure-Requests: 1\n" + + "User-Agent: " + getBrowserVersion().getUserAgent() + "\n"; + } + if (getBrowserVersion().isFirefox()) { + if (getBrowserVersion().getBrowserVersionNumeric() < 52) { + expectedHeaders = "Connection: keep-alive\n" + + "Host: localhost:" + PORT + "\n" + + "Referer: http://localhost:" + PORT + "/\n" + + "User-Agent: " + getBrowserVersion().getUserAgent() + "\n"; + } + else { + expectedHeaders = "Connection: keep-alive\n" + + "Host: localhost:" + PORT + "\n" + + "Referer: http://localhost:" + PORT + "/\n" + + "Upgrade-Insecure-Requests: 1\n" + + "User-Agent: " + getBrowserVersion().getUserAgent() + "\n"; + } + } + if (getBrowserVersion().isIE()) { + expectedHeaders = "Connection: keep-alive\n" + + "DNT: 1\n" + + "Host: localhost:" + PORT + "\n" + + "Referer: http://localhost:" + PORT + "/\n" + + "User-Agent: " + getBrowserVersion().getUserAgent() + "\n"; + } + assertEquals(expectedHeaders, headersToString(lastRequest)); + + assertEquals(FormEncodingType.URL_ENCODED, lastRequest.getEncodingType()); + assertEquals(HttpMethod.GET, lastRequest.getHttpMethod()); + assertEquals(0, lastRequest.getProxyPort()); + final List<NameValuePair> parameters = lastRequest.getRequestParameters(); + assertEquals(2, parameters.size()); + for (final NameValuePair pair : parameters) { + if ("text1".equals(pair.getName())) { + assertEquals("me & you", pair.getValue()); + } + else { + assertEquals("Hello\r\nworld!", pair.getValue()); + } + } + } + + /** + * Tests a simple POST request. + * @throws Exception if the test fails + */ + @Test + @NotYetImplemented(IE) + public void formPost() throws Exception { final String html = "<html><body><form action='foo' method='post' accept-charset='iso-8859-1'>\n" + "<input name='text1' value='me &amp; you'>\n" + "<textarea name='text2'>Hello\nworld!</textarea>\n" @@ -71,7 +144,7 @@ assertEquals(URL_FIRST + "foo", lastRequest.getUrl()); String expectedHeaders = ""; - if (getBrowserVersion().isChrome() || getBrowserVersion().isFirefox()) { + if (getBrowserVersion().isChrome()) { expectedHeaders = "Cache-Control: max-age=0\n" + "Connection: keep-alive\n" + "Content-Length: 48\n" |
From: <rb...@us...> - 2017-06-15 08:31:16
|
Revision: 14611 http://sourceforge.net/p/htmlunit/code/14611 Author: rbri Date: 2017-06-15 08:31:13 +0000 (Thu, 15 Jun 2017) Log Message: ----------- the JDK censors the Origin header - sometimes i really like the JDK Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnection.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnectionTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnection.java 2017-06-14 19:29:31 UTC (rev 14610) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnection.java 2017-06-15 08:31:13 UTC (rev 14611) @@ -42,10 +42,15 @@ * Note: this class is experimental and not mature like {@link HttpWebConnection}. * It doesn't currently support multipart POST. * </p> + * <p>This might not use all headers because the JDK ignores/censors some headers (at lease Origin). + * You can disable this censorship by setting 'sun.net.http.allowRestrictedHeaders' to true + * </p> * * @author Amit Manjhi * @author Marc Guillemot * @author Pieter Herroelen + * @author Ronald Brill + * * @since HtmlUnit 2.8 * @see "http://code.google.com/p/googleappengine/issues/detail?id=3379" */ @@ -94,6 +99,9 @@ connection.setInstanceFollowRedirects(false); // copy the headers from WebRequestSettings + // this might not copy all headers because the JDK ignores/censors some headers + // you can disable this by setting sun.net.http.allowRestrictedHeaders to true + // see UrlFetchWebConnectionTest for some links for (final Entry<String, String> header : webRequest.getAdditionalHeaders().entrySet()) { connection.addRequestProperty(header.getKey(), header.getValue()); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnectionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnectionTest.java 2017-06-14 19:29:31 UTC (rev 14610) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/UrlFetchWebConnectionTest.java 2017-06-15 08:31:13 UTC (rev 14611) @@ -14,6 +14,7 @@ */ package com.gargoylesoftware.htmlunit; +import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; @@ -26,6 +27,8 @@ import java.util.Set; import java.util.TreeMap; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -40,11 +43,42 @@ * * @author Marc Guillemot * @author Pieter Herroelen + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class UrlFetchWebConnectionTest extends WebServerTestCase { + private static final String allowRestrictedHeaders = System.getProperty("sun.net.http.allowRestrictedHeaders"); + /** + * Setup jdk / HttpURLConnection + * to support all headers (Origin in this case). + * + * see https://stackoverflow.com/questions/8335501/does-httpurlconnection-censor-some-headers-notably-origin + * see https://stackoverflow.com/questions/13255051/ + * setting-origin-and-access-control-request-method-headers-with-jersey-client + */ + @BeforeClass + public static void beforeClass() { + System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); + } + + /** + * Saves HTML and PNG files. + * + * @throws IOException if an error occurs + */ + @AfterClass + public static void saveAll() throws IOException { + if (allowRestrictedHeaders == null) { + System.setProperty("sun.net.http.allowRestrictedHeaders", "false"); + } + else { + System.setProperty("sun.net.http.allowRestrictedHeaders", allowRestrictedHeaders); + } + } + + /** * Tests a simple GET. * @throws Exception if the test fails */ @@ -148,11 +182,14 @@ assertEquals(referenceRequest.getCharset(), newRequest.getCharset()); assertEquals(referenceRequest.getProxyHost(), newRequest.getProxyHost()); assertEquals(referenceRequest.getUrl(), newRequest.getUrl()); - assertEquals(headersToString(referenceRequest), headersToString(newRequest)); assertEquals(referenceRequest.getEncodingType(), newRequest.getEncodingType()); assertEquals(referenceRequest.getHttpMethod(), newRequest.getHttpMethod()); assertEquals(referenceRequest.getProxyPort(), newRequest.getProxyPort()); assertEquals(referenceRequest.getRequestParameters().toString(), newRequest.getRequestParameters().toString()); + + // java U + // https://stackoverflow.com/questions/8335501/does-httpurlconnection-censor-some-headers-notably-origin + assertEquals(headersToString(referenceRequest), headersToString(newRequest)); } private static String headersToString(final WebRequest request) { |
From: <asa...@us...> - 2017-06-16 15:56:32
|
Revision: 14613 http://sourceforge.net/p/htmlunit/code/14613 Author: asashour Date: 2017-06-16 15:56:29 +0000 (Fri, 16 Jun 2017) Log Message: ----------- Empty implementation of HTMLMediaElement.pause() Issue 1893 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java 2017-06-15 08:34:45 UTC (rev 14612) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java 2017-06-16 15:56:29 UTC (rev 14613) @@ -110,4 +110,11 @@ final Promise promise = new Promise(getWindow()); return promise; } + + /** + * Pauses playback of the media. + */ + @JsxFunction + public void pause() { + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElementTest.java 2017-06-15 08:34:45 UTC (rev 14612) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElementTest.java 2017-06-16 15:56:29 UTC (rev 14613) @@ -48,4 +48,26 @@ loadPageWithAlerts2(html); } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"[object HTMLAudioElement]", "done"}) + public void pause() throws Exception { + final String html = "" + + "<html><head><title>foo</title>\n" + + "<script>\n" + + " function test() {\n" + + " var a = new Audio('1.mp3');\n" + + " alert(a);\n" + + " a.pause();\n" + + " alert('done');\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <asa...@us...> - 2017-06-16 16:04:06
|
Revision: 14614 http://sourceforge.net/p/htmlunit/code/14614 Author: asashour Date: 2017-06-16 16:04:04 +0000 (Fri, 16 Jun 2017) Log Message: ----------- Fix Audio with null constructor. Issue 1893 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ErrorOutputChecker.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java 2017-06-16 15:56:29 UTC (rev 14613) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLMediaElement.java 2017-06-16 16:04:04 UTC (rev 14614) @@ -96,7 +96,11 @@ */ @JsxFunction public String canPlayType(final String type) { - return ((HtmlMedia) getDomNodeOrDie()).canPlayType(type); + final HtmlMedia element = (HtmlMedia) getDomNodeOrNull(); + if (element == null) { + return "maybe"; + } + return element.canPlayType(type); } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ErrorOutputChecker.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ErrorOutputChecker.java 2017-06-16 15:56:29 UTC (rev 14613) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/ErrorOutputChecker.java 2017-06-16 16:04:04 UTC (rev 14614) @@ -38,7 +38,7 @@ private final ByteArrayOutputStream baos_ = new ByteArrayOutputStream(); private static final Pattern[] PATTERNS = { Pattern.compile("Starting ChromeDriver " + ExternalTest.CHROME_DRIVER_.replace(".", "\\.") - + "\\.461591 ?\\(?[0-9a-f]*\\)? on port \\d*\r?\n" + + "\\.[0-9]+ ?\\(?[0-9a-f]*\\)? on port \\d*\r?\n" + "Only local connections are allowed\\.\r?\n"), Pattern.compile(".*FirefoxOptions toCapabilities\r?\n"), Pattern.compile(".*Preferring the firefox binary in these options \\(.*\\)\r?\n"), Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java 2017-06-16 15:56:29 UTC (rev 14613) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java 2017-06-16 16:04:04 UTC (rev 14614) @@ -148,4 +148,26 @@ loadPage2(html); assertEquals(1, getMockWebConnection().getRequestCount()); } -} + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"[object HTMLAudioElement]", "maybe", "done"}) + public void nullConstructor() throws Exception { + final String html = "" + + "<html><head><title>foo</title>\n" + + "<script>\n" + + " function test() {\n" + + " var a = new Audio(null);\n" + + " alert(a);\n" + + " alert(a.canPlayType('audio/ogg'));\n" + + " alert('done');\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + }} |
From: <asa...@us...> - 2017-06-16 16:26:55
|
Revision: 14615 http://sourceforge.net/p/htmlunit/code/14615 Author: asashour Date: 2017-06-16 16:26:53 +0000 (Fri, 16 Jun 2017) Log Message: ----------- JavaScript: fix Number.toLocaleString(). Issue 1892 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java Added Paths: ----------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-06-16 16:04:04 UTC (rev 14614) +++ trunk/htmlunit/src/changes/changes.xml 2017-06-16 16:26:53 UTC (rev 14615) @@ -8,6 +8,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="fix" dev="asashour" issue="1892"> + JavaScript: fix Number.toLocaleString(). + </action> <action type="add" dev="rbri" > JavaScript: SVGMatrix operations (flipX, flipY, inverse, multiply, rotate, rotateFromVector, scale, scaleNonUniform, skewX, skewY, translate) implemented. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-06-16 16:04:04 UTC (rev 14614) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-06-16 16:26:53 UTC (rev 14615) @@ -58,6 +58,7 @@ import com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject; import com.gargoylesoftware.htmlunit.javascript.host.ArrayCustom; import com.gargoylesoftware.htmlunit.javascript.host.DateCustom; +import com.gargoylesoftware.htmlunit.javascript.host.NumberCustom; import com.gargoylesoftware.htmlunit.javascript.host.ObjectCustom; import com.gargoylesoftware.htmlunit.javascript.host.Reflect; import com.gargoylesoftware.htmlunit.javascript.host.StringCustom; @@ -498,6 +499,11 @@ ArrayCustom.class, ScriptableObject.DONTENUM); } + final ScriptableObject numberPrototype + = (ScriptableObject) ScriptableObject.getClassPrototype(window, "Number"); + ((ScriptableObject) numberPrototype).defineFunctionProperties(new String[] {"toLocaleString"}, + NumberCustom.class, ScriptableObject.DONTENUM); + window.setPrototypes(prototypes, prototypesPerJSName); window.initialize(webWindow); } Added: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java (rev 0) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java 2017-06-16 16:26:53 UTC (rev 14615) @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2002-2017 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.javascript.host; + +import java.text.NumberFormat; +import java.util.Locale; + +import net.sourceforge.htmlunit.corejs.javascript.Context; +import net.sourceforge.htmlunit.corejs.javascript.Function; +import net.sourceforge.htmlunit.corejs.javascript.Scriptable; + +/** + * Contains some missing features of Rhino NativeNumber. + * + * @author Ahmed Ashour + */ +public final class NumberCustom { + + private NumberCustom() { } + + /** + * Returns a string with a language sensitive representation of this number. + * @param context the JavaScript context + * @param thisObj the scriptable + * @param args the arguments passed into the method + * @param function the function + * @return the string + */ + public static String toLocaleString( + final Context context, final Scriptable thisObj, final Object[] args, final Function function) { + String string = thisObj.toString(); + if (args.length != 0 && args[0] instanceof String) { + final Locale locale = Locale.forLanguageTag((String) args[0]); + string = NumberFormat.getInstance(locale).format(Double.parseDouble(string)); + } + return string; + } +} Property changes on: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java 2017-06-16 16:04:04 UTC (rev 14614) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java 2017-06-16 16:26:53 UTC (rev 14615) @@ -22,11 +22,10 @@ import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** - * Number is a native JavaScript object and therefore provided by Rhino but some tests are needed here - * to be sure that we have the expected results (for instance EcmaScript 5 adds methods that are not - * available in FF2 or FF3). + * Number is a native JavaScript object. * * @author Marc Guillemot + * @author Ahmed Ashour */ @RunWith(BrowserRunner.class) public class NativeNumberTest extends WebDriverTestCase { @@ -69,4 +68,29 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("12,345") + public void toLocaleString() throws Exception { + final String html = "<html><head><script>\n" + + " alert((12345).toLocaleString('en'));\n" + + "</script></head><body>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("12.345") + public void toLocaleStringDe() throws Exception { + final String html = "<html><head><script>\n" + + " alert((12345).toLocaleString('de'));\n" + + "</script></head><body>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java 2017-06-16 16:04:04 UTC (rev 14614) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLAudioElementTest.java 2017-06-16 16:26:53 UTC (rev 14615) @@ -170,4 +170,5 @@ + "</body></html>"; loadPageWithAlerts2(html); - }} + } +} |
From: <rb...@us...> - 2017-06-16 18:30:48
|
Revision: 14617 http://sourceforge.net/p/htmlunit/code/14617 Author: rbri Date: 2017-06-16 18:30:45 +0000 (Fri, 16 Jun 2017) Log Message: ----------- more locale tests and fixes Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java 2017-06-16 16:37:19 UTC (rev 14616) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java 2017-06-16 18:30:45 UTC (rev 14617) @@ -17,8 +17,13 @@ import java.text.NumberFormat; import java.util.Locale; +import org.apache.commons.lang3.LocaleUtils; + +import com.gargoylesoftware.htmlunit.BrowserVersion; + import net.sourceforge.htmlunit.corejs.javascript.Context; import net.sourceforge.htmlunit.corejs.javascript.Function; +import net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime; import net.sourceforge.htmlunit.corejs.javascript.Scriptable; /** @@ -25,6 +30,7 @@ * Contains some missing features of Rhino NativeNumber. * * @author Ahmed Ashour + * @author Ronald Brill */ public final class NumberCustom { @@ -40,11 +46,19 @@ */ public static String toLocaleString( final Context context, final Scriptable thisObj, final Object[] args, final Function function) { - String string = thisObj.toString(); if (args.length != 0 && args[0] instanceof String) { - final Locale locale = Locale.forLanguageTag((String) args[0]); - string = NumberFormat.getInstance(locale).format(Double.parseDouble(string)); + final String localeStr = (String) args[0]; + try { + final Locale locale = LocaleUtils.toLocale(localeStr); + return NumberFormat.getInstance(locale).format(Double.parseDouble(thisObj.toString())); + } + catch (final IllegalArgumentException e) { + throw ScriptRuntime.rangeError("Invalid language tag: " + localeStr); + } } - return string; + + final BrowserVersion browserVersion = ((Window) thisObj.getParentScope()).getBrowserVersion(); + final Locale locale = Locale.forLanguageTag(browserVersion.getBrowserLanguage()); + return NumberFormat.getInstance(locale).format(Double.parseDouble(thisObj.toString())); } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java 2017-06-16 16:37:19 UTC (rev 14616) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeNumberTest.java 2017-06-16 18:30:45 UTC (rev 14617) @@ -26,6 +26,7 @@ * * @author Marc Guillemot * @author Ahmed Ashour + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class NativeNumberTest extends WebDriverTestCase { @@ -94,4 +95,34 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("12,345") + public void toLocaleStringNoParam() throws Exception { + final String html = "<html><head><script>\n" + + " try {\n" + + " alert((12345).toLocaleString());\n" + + " } catch(e) { alert(e); }\n" + + "</script></head><body>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("exception") + public void toLocaleStringHintertupfingen() throws Exception { + final String html = "<html><head><script>\n" + + " try {\n" + + " alert((12345).toLocaleString('Hintertupfingen'));\n" + + " } catch(e) { alert('exception'); }\n" + + "</script></head><body>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } |
From: <asa...@us...> - 2017-06-18 07:55:32
|
Revision: 14620 http://sourceforge.net/p/htmlunit/code/14620 Author: asashour Date: 2017-06-18 07:55:29 +0000 (Sun, 18 Jun 2017) Log Message: ----------- Latest chrome Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-06-17 08:05:58 UTC (rev 14619) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-06-18 07:55:29 UTC (rev 14620) @@ -148,10 +148,10 @@ /** Latest Chrome. */ public static final BrowserVersion CHROME = new BrowserVersion( NETSCAPE, "5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36", + + " (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36", - 58, "Chrome", null); + + " (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36", + 59, "Chrome", null); /** Microsoft Edge. Work In Progress!!! */ public static final BrowserVersion EDGE = new BrowserVersion( Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2017-06-17 08:05:58 UTC (rev 14619) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/BrowserVersionTest.java 2017-06-18 07:55:29 UTC (rev 14620) @@ -34,7 +34,7 @@ assertEquals(45, BrowserVersion.FIREFOX_45.getBrowserVersionNumeric()); assertEquals(52, BrowserVersion.FIREFOX_52.getBrowserVersionNumeric()); assertEquals(11, BrowserVersion.INTERNET_EXPLORER.getBrowserVersionNumeric()); - assertEquals(58, BrowserVersion.CHROME.getBrowserVersionNumeric()); + assertEquals(59, BrowserVersion.CHROME.getBrowserVersionNumeric()); assertEquals(14, BrowserVersion.EDGE.getBrowserVersionNumeric()); } |
From: <rb...@us...> - 2017-06-23 16:41:46
|
Revision: 14630 http://sourceforge.net/p/htmlunit/code/14630 Author: rbri Date: 2017-06-23 16:41:44 +0000 (Fri, 23 Jun 2017) Log Message: ----------- take care of bom headers when downloading js Issue 1895 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScript3Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2017-06-21 17:37:23 UTC (rev 14629) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java 2017-06-23 16:41:44 UTC (rev 14630) @@ -22,9 +22,12 @@ import java.io.Serializable; import java.net.URL; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.List; +import org.apache.commons.io.ByteOrderMark; import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.BOMInputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -45,6 +48,10 @@ public class WebResponse implements Serializable { private static final Log LOG = LogFactory.getLog(WebResponse.class); + private static final ByteOrderMark[] BOM_HEADERS = new ByteOrderMark[] { + ByteOrderMark.UTF_8, + ByteOrderMark.UTF_16LE, + ByteOrderMark.UTF_16BE}; private long loadTime_; private WebResponseData responseData_; @@ -238,6 +245,7 @@ /** * Returns the response content as a string, using the specified charset, * rather than the charset/encoding specified in the server response. + * If there is a bom header the charset parameter will be overwritten by the bom. * @param encoding the charset/encoding to use to convert the response content into a string * @return the response content as a string or null if the content retrieval was failing */ @@ -245,7 +253,22 @@ if (responseData_ != null) { try (InputStream in = responseData_.getInputStream()) { if (in != null) { - return IOUtils.toString(in, encoding); + try (BOMInputStream bomIn = new BOMInputStream(in, BOM_HEADERS)) { + // there seems to be a bug in BOMInputStream + // we have to call this before hasBOM(ByteOrderMark) + if (bomIn.hasBOM()) { + if (bomIn.hasBOM(ByteOrderMark.UTF_8)) { + return IOUtils.toString(bomIn, StandardCharsets.UTF_8); + } + if (bomIn.hasBOM(ByteOrderMark.UTF_16BE)) { + return IOUtils.toString(bomIn, StandardCharsets.UTF_16BE); + } + if (bomIn.hasBOM(ByteOrderMark.UTF_16LE)) { + return IOUtils.toString(bomIn, StandardCharsets.UTF_16LE); + } + } + return IOUtils.toString(bomIn, encoding); + } } } catch (final IOException e) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-06-21 17:37:23 UTC (rev 14629) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-06-23 16:41:44 UTC (rev 14630) @@ -61,6 +61,7 @@ import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.ranges.Range; +import com.gargoylesoftware.htmlunit.BrowserVersion; import com.gargoylesoftware.htmlunit.Cache; import com.gargoylesoftware.htmlunit.ElementNotFoundException; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; @@ -1020,9 +1021,8 @@ final WebRequest referringRequest = getWebResponse().getWebRequest(); final WebClient client = getWebClient(); - final Cache cache = client.getCache(); - - final WebRequest request = new WebRequest(url, getWebClient().getBrowserVersion().getScriptAcceptHeader()); + final BrowserVersion browser = client.getBrowserVersion(); + final WebRequest request = new WebRequest(url, browser.getScriptAcceptHeader()); request.setAdditionalHeaders(new HashMap<>(referringRequest.getAdditionalHeaders())); request.setAdditionalHeader("Referer", referringRequest.getUrl().toString()); request.setAdditionalHeader("Accept", client.getBrowserVersion().getScriptAcceptHeader()); @@ -1034,6 +1034,7 @@ // now we can look into the cache with the fixed request for // a cached script + final Cache cache = client.getCache(); final Object cachedScript = cache.getCachedObject(request); if (cachedScript instanceof Script || cachedScript instanceof ScriptFunction) { return cachedScript; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScript3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScript3Test.java 2017-06-21 17:37:23 UTC (rev 14629) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlScript3Test.java 2017-06-23 16:41:44 UTC (rev 14630) @@ -14,11 +14,13 @@ */ package com.gargoylesoftware.htmlunit.html; +import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE; import static java.nio.charset.StandardCharsets.ISO_8859_1; import static java.nio.charset.StandardCharsets.UTF_8; import java.net.URL; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -35,6 +37,7 @@ import com.gargoylesoftware.htmlunit.BrowserParameterizedRunner; import com.gargoylesoftware.htmlunit.BrowserParameterizedRunner.Default; import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts; +import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.WebDriverTestCase; /** @@ -45,12 +48,14 @@ @RunWith(BrowserParameterizedRunner.class) public class HtmlScript3Test extends WebDriverTestCase { + private static final String BOM_UTF_16LE = "BOMUTF16LE"; private static final String BOM_UTF_16BE = "BOMUTF16BE"; private static final String BOM_UTF_8 = "BOMUTF8"; private enum TestCharset { UTF8("UTF8", UTF_8), - ISO88591("ISO88591", ISO_8859_1); + ISO88591("ISO88591", ISO_8859_1), + GB2312("GB2312", Charset.forName("GB2312")); private final String label_; private final Charset charset_; @@ -80,11 +85,11 @@ final List<Object[]> list = new ArrayList<>(); final TestCharset[] charsetHtmlResponseHeader = - new TestCharset[] {null, TestCharset.UTF8, TestCharset.ISO88591}; + new TestCharset[] {null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.GB2312}; final TestCharset[] charsetAttribute = new TestCharset[] {null, TestCharset.UTF8, TestCharset.ISO88591}; final TestCharset[] charsetResponseHeader = new TestCharset[] {null, TestCharset.UTF8, TestCharset.ISO88591}; final TestCharset[] charsetResponseEncoding = new TestCharset[] {null, TestCharset.UTF8, TestCharset.ISO88591}; - final String[] bom = new String[] {null, BOM_UTF_8, BOM_UTF_16BE}; + final String[] bom = new String[] {null, BOM_UTF_8, BOM_UTF_16LE, BOM_UTF_16BE}; for (final Object charsetHtml : charsetHtmlResponseHeader) { for (final Object attribute : charsetAttribute) { @@ -135,7 +140,7 @@ * @throws Exception if an error occurs */ @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) @Default public void charset() throws Exception { charset(charsetHtmlResponseHeader_, charsetAttribute_, charsetResponseHeader_, charsetResponseEncoding_, bom_); @@ -153,6 +158,7 @@ String html = "<html><head>\n" + + " <script type='text/javascript'>window.onerror=function(msg) { alert(msg); }</script>" + " <script src='" + cssUrl + "'"; if (charsetAttribute != null) { html = html + " charset='" + charsetAttribute.getCharset().name().toLowerCase() + "'"; @@ -167,7 +173,7 @@ scriptContentType = scriptContentType + "; charset=" + charsetResponseHeader.getCharset().name().toLowerCase(); } - final String js = "alert('أهلاً');"; + final String js = "alert('a'); alert('ä'); alert('أهلاً'); alert('мир'); alert('房间');"; byte[] script = null; if (charsetResponseEncoding == null) { @@ -178,11 +184,14 @@ } if (BOM_UTF_8.equals(bom)) { - script = ArrayUtils.addAll(ByteOrderMark.UTF_8.getBytes(), script); + script = ArrayUtils.addAll(ByteOrderMark.UTF_8.getBytes(), js.getBytes(StandardCharsets.UTF_8)); } else if (BOM_UTF_16BE.equals(bom)) { - script = ArrayUtils.addAll(ByteOrderMark.UTF_16BE.getBytes(), script); + script = ArrayUtils.addAll(ByteOrderMark.UTF_16BE.getBytes(), js.getBytes(StandardCharsets.UTF_16BE)); } + else if (BOM_UTF_16LE.equals(bom)) { + script = ArrayUtils.addAll(ByteOrderMark.UTF_16LE.getBytes(), js.getBytes(StandardCharsets.UTF_16LE)); + } getMockWebConnection().setResponse(cssUrl, script, 200, "OK", scriptContentType, null); String htmlContentType = "text/html"; @@ -195,14 +204,25 @@ htmlResponseCharset = charsetHtmlResponse.getCharset(); } + expandExpectedAlertsVariables(URL_FIRST); + final String[] expectedAlerts = getExpectedAlerts(); try { - expandExpectedAlertsVariables(URL_FIRST); - final String[] expectedAlerts = getExpectedAlerts(); - final WebDriver driver = loadPage2(html, URL_FIRST, htmlContentType, htmlResponseCharset, null); - verifyAlerts(DEFAULT_WAIT_TIME, driver, expectedAlerts); + if (expectedAlerts.length == 1) { + final List<String> actualAlerts = getCollectedAlerts(DEFAULT_WAIT_TIME, driver, expectedAlerts.length); + assertEquals(1, actualAlerts.size()); + + final String msg = actualAlerts.get(0); + assertEquals(expectedAlerts[0], "Invalid token"); + assertTrue(msg, msg.contains("Invalid or unexpected token") + || msg.contains("illegal character") + || msg.contains("Ungültiges Zeichen")); + } + else { + verifyAlerts(DEFAULT_WAIT_TIME, driver, expectedAlerts); + } } catch (final WebDriverException e) { if (!e.getCause().getMessage().contains("illegal character") @@ -209,6 +229,10 @@ && !e.getCause().getMessage().contains("is not defined.")) { throw e; } + + assertTrue(expectedAlerts.length == 1); + final String msg = e.getCause().getMessage(); + assertTrue(msg, msg.contains(expectedAlerts[0])); } } @@ -216,7 +240,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591____() throws Exception { charset(TestCharset.ISO88591, null, null, null, null); } @@ -225,15 +249,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591____BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591___UTF8_() throws Exception { charset(TestCharset.ISO88591, null, null, TestCharset.UTF8, null); } @@ -242,15 +258,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591___UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _ISO88591___ISO88591_() throws Exception { charset(TestCharset.ISO88591, null, null, TestCharset.ISO88591, null); } @@ -259,40 +267,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591___ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, null, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591___ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591__UTF8__BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.UTF8, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591__UTF8_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _ISO88591__UTF8_ISO88591_() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -301,24 +276,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591__UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591__UTF8_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591__ISO88591__() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, null, null); } @@ -327,8 +285,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591__ISO88591__BOMUTF8() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -337,15 +296,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591__ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591__ISO88591_UTF8_() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -354,8 +305,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591__ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -364,15 +316,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591__ISO88591_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _ISO88591__ISO88591_ISO88591_() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -381,17 +325,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591__ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "?????") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591__ISO88591_ISO88591_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, null, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); } @@ -400,23 +334,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591_UTF8___BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591_UTF8__UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _ISO88591_UTF8__ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, null, TestCharset.ISO88591, null); } @@ -425,25 +343,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_UTF8__ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591_UTF8__ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_UTF8__BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, null, BOM_UTF_16BE); } @@ -452,8 +352,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_UTF8_UTF8_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); } @@ -462,7 +361,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _ISO88591_UTF8_UTF8_ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -471,17 +370,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_UTF8_UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "?????") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_UTF8_ISO88591_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); } @@ -490,7 +379,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_ISO88591__() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null, null); } @@ -499,8 +388,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591_UTF8_ISO88591__BOMUTF8() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -509,15 +399,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591_UTF8_ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_ISO88591_UTF8_() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -526,8 +408,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591_UTF8_ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -536,8 +419,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_ISO88591_UTF8_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); } @@ -546,7 +428,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _ISO88591_UTF8_ISO88591_ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -555,17 +437,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_UTF8_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "?????") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_UTF8_ISO88591_ISO88591_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); } @@ -574,7 +446,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591___() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, null, null, null); } @@ -583,15 +455,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591_ISO88591___BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591__UTF8_() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, null, TestCharset.UTF8, null); } @@ -600,15 +464,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591_ISO88591__UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _ISO88591_ISO88591__ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, null, TestCharset.ISO88591, null); } @@ -617,25 +473,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_ISO88591__ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _ISO88591_ISO88591__ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_UTF8__BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null, BOM_UTF_16BE); } @@ -644,8 +482,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_UTF8_UTF8_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); } @@ -654,7 +491,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _ISO88591_ISO88591_UTF8_ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -663,17 +500,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_ISO88591_UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "?????") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_UTF8_ISO88591_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); } @@ -682,7 +509,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_ISO88591__() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null, null); } @@ -691,8 +518,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591_ISO88591_ISO88591__BOMUTF8() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -701,15 +529,7 @@ * @throws Exception if the test fails */ @Test - public void _ISO88591_ISO88591_ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_ISO88591_UTF8_() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -718,8 +538,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "أهلاً") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _ISO88591_ISO88591_ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -728,8 +549,7 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = {}, - IE = "أهلاً") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_ISO88591_UTF8_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); } @@ -738,7 +558,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _ISO88591_ISO88591_ISO88591_ISO88591_() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -747,17 +567,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void _ISO88591_ISO88591_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = {}, - IE = "?????") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _ISO88591_ISO88591_ISO88591_ISO88591_BOMUTF16BE() throws Exception { charset(TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); } @@ -766,7 +576,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _UTF8_ISO88591_ISO88591_ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -775,24 +585,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591_ISO88591_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_ISO88591_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_ISO88591_ISO88591_UTF8_() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -801,15 +594,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591_ISO88591_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_ISO88591_ISO88591__() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null, null); } @@ -818,15 +603,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591_ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _UTF8_ISO88591_UTF8_ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -835,40 +612,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591_UTF8_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_ISO88591_UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8_ISO88591_UTF8_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8_ISO88591_UTF8__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _UTF8_ISO88591__ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, null, TestCharset.ISO88591, null); } @@ -877,24 +621,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591__ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_ISO88591__ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_ISO88591__UTF8_() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, null, TestCharset.UTF8, null); } @@ -903,15 +630,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591__UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_ISO88591___() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, null, null, null); } @@ -920,15 +639,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_ISO88591___BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.ISO88591, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _UTF8_UTF8_ISO88591_ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -937,24 +648,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_UTF8_ISO88591_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_UTF8_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_UTF8_ISO88591_UTF8_() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -963,15 +657,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_UTF8_ISO88591_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_UTF8_ISO88591__() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null, null); } @@ -980,15 +666,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_UTF8_ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _UTF8_UTF8_UTF8_ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -997,40 +675,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_UTF8_UTF8_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_UTF8_UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8_UTF8_UTF8_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8_UTF8_UTF8__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.UTF8, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _UTF8_UTF8__ISO88591_() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, null, TestCharset.ISO88591, null); } @@ -1039,31 +684,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8_UTF8__ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8_UTF8__ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8_UTF8__UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, TestCharset.UTF8, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8_UTF8___BOMUTF16BE() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, null, null, BOM_UTF_8); } @@ -1072,7 +693,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void _UTF8__ISO88591_ISO88591_() throws Exception { charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -1081,24 +702,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8__ISO88591_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8__ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8__ISO88591_UTF8_() throws Exception { charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.UTF8, null); } @@ -1107,15 +711,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8__ISO88591_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) public void _UTF8__ISO88591__() throws Exception { charset(TestCharset.UTF8, null, TestCharset.ISO88591, null, null); } @@ -1124,15 +720,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8__ISO88591__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.ISO88591, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _UTF8__UTF8_ISO88591_() throws Exception { charset(TestCharset.UTF8, null, TestCharset.UTF8, TestCharset.ISO88591, null); } @@ -1141,40 +729,7 @@ * @throws Exception if the test fails */ @Test - public void _UTF8__UTF8_ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8__UTF8_ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8__UTF8_UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8__UTF8__BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, TestCharset.UTF8, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") + @Alerts({"a", "�", "?????", "???", "??"}) public void _UTF8___ISO88591_() throws Exception { charset(TestCharset.UTF8, null, null, TestCharset.ISO88591, null); } @@ -1183,41 +738,9 @@ * @throws Exception if the test fails */ @Test - public void _UTF8___ISO88591_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, null, TestCharset.ISO88591, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts("?????") - public void _UTF8___ISO88591_BOMUTF8() throws Exception { - charset(TestCharset.UTF8, null, null, TestCharset.ISO88591, BOM_UTF_8); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8___UTF8_BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, null, TestCharset.UTF8, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - public void _UTF8____BOMUTF16BE() throws Exception { - charset(TestCharset.UTF8, null, null, null, BOM_UTF_16BE); - } - - /** - * @throws Exception if the test fails - */ - @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8_ISO88591_ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -1226,8 +749,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8_ISO88591_ISO88591__BOMUTF8() throws Exception { charset(TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -1236,8 +760,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8_UTF8_ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -1246,8 +771,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8_UTF8_ISO88591__BOMUTF8() throws Exception { charset(TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -1256,8 +782,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8__ISO88591_UTF8_BOMUTF8() throws Exception { charset(TestCharset.UTF8, null, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } @@ -1266,8 +793,9 @@ * @throws Exception if the test fails */ @Test - @Alerts(DEFAULT = "أهلاً", - IE = "\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) public void _UTF8__ISO88591__BOMUTF8() throws Exception { charset(TestCharset.UTF8, null, TestCharset.ISO88591, null, BOM_UTF_8); } @@ -1276,7 +804,7 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") + @Alerts({"a", "ä", "?????", "???", "??"}) public void __ISO88591_ISO88591_ISO88591_() throws Exception { charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, null); } @@ -1285,8 +813,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591_ISO88591_ISO88591_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __ISO88591_ISO88591_UTF8_() throws Exception { + charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null); } /** @@ -1293,9 +822,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __ISO88591_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __ISO88591_ISO88591__() throws Exception { + charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, null); } /** @@ -1302,9 +831,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") - public void __ISO88591_ISO88591_UTF8_() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, null); + @Alerts({"a", "�", "?????", "???", "??"}) + public void __ISO88591_UTF8_ISO88591_() throws Exception { + charset(null, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null); } /** @@ -1311,8 +840,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591_ISO88591_UTF8_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_16BE); + @Alerts({"a", "ä", "?????", "???", "??"}) + public void __ISO88591__ISO88591_() throws Exception { + charset(null, TestCharset.ISO88591, null, TestCharset.ISO88591, null); } /** @@ -1319,9 +849,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") - public void __ISO88591_ISO88591__() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, null); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __ISO88591__UTF8_() throws Exception { + charset(null, TestCharset.ISO88591, null, TestCharset.UTF8, null); } /** @@ -1328,8 +858,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591_ISO88591__BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_16BE); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __ISO88591___() throws Exception { + charset(null, TestCharset.ISO88591, null, null, null); } /** @@ -1336,17 +867,26 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __ISO88591_UTF8_ISO88591_() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, null); + @Alerts({"a", "ä", "?????", "???", "??"}) + public void __UTF8_ISO88591_ISO88591_() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null); } + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __UTF8_ISO88591_UTF8_() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, null); + } /** * @throws Exception if the test fails */ @Test - public void __ISO88591_UTF8_ISO88591_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_16BE); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void __UTF8_ISO88591__() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.ISO88591, null, null); } /** @@ -1353,9 +893,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __ISO88591_UTF8_ISO88591_BOMUTF8() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.ISO88591, BOM_UTF_8); + @Alerts({"a", "�", "?????", "???", "??"}) + public void __UTF8_UTF8_ISO88591_() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.UTF8, TestCharset.ISO88591, null); } /** @@ -1362,8 +902,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591_UTF8_UTF8_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.UTF8, TestCharset.UTF8, BOM_UTF_16BE); + @Alerts({"a", "�", "?????", "???", "??"}) + public void __UTF8__ISO88591_() throws Exception { + charset(null, TestCharset.UTF8, null, TestCharset.ISO88591, null); } /** @@ -1370,8 +911,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591_UTF8__BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, TestCharset.UTF8, null, BOM_UTF_16BE); + @Alerts({"a", "ä", "?????", "???", "??"}) + public void ___ISO88591_ISO88591_() throws Exception { + charset(null, null, TestCharset.ISO88591, TestCharset.ISO88591, null); } /** @@ -1378,9 +920,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __ISO88591__ISO88591_() throws Exception { - charset(null, TestCharset.ISO88591, null, TestCharset.ISO88591, null); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void ___ISO88591_UTF8_() throws Exception { + charset(null, null, TestCharset.ISO88591, TestCharset.UTF8, null); } /** @@ -1387,8 +929,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591__ISO88591_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_16BE); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void ___ISO88591__() throws Exception { + charset(null, null, TestCharset.ISO88591, null, null); } /** @@ -1395,9 +938,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __ISO88591__ISO88591_BOMUTF8() throws Exception { - charset(null, TestCharset.ISO88591, null, TestCharset.ISO88591, BOM_UTF_8); + @Alerts({"a", "ä", "?????", "???", "??"}) + public void ___UTF8_ISO88591_() throws Exception { + charset(null, null, null, TestCharset.ISO88591, null); } /** @@ -1404,9 +947,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") - public void __ISO88591__UTF8_() throws Exception { - charset(null, TestCharset.ISO88591, null, TestCharset.UTF8, null); + @Alerts({"a", "ä", "?????", "???", "??"}) + public void ____ISO88591_() throws Exception { + charset(null, null, null, TestCharset.ISO88591, null); } /** @@ -1413,8 +956,9 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591__UTF8_BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, null, TestCharset.UTF8, BOM_UTF_16BE); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void ____UTF8_() throws Exception { + charset(null, null, null, TestCharset.UTF8, null); } /** @@ -1421,9 +965,9 @@ * @throws Exception if the test fails */ @Test - @Alerts("\u00D8\u00A3\u00D9\u2021\u00D9\u201E\u00D8\u00A7\u00D9\u2039") - public void __ISO88591___() throws Exception { - charset(null, TestCharset.ISO88591, null, null, null); + @Alerts({"a", "ä", "أهلاً", "мир", "房间"}) + public void _____() throws Exception { + charset(null, null, null, null, null); } /** @@ -1430,8 +974,11 @@ * @throws Exception if the test fails */ @Test - public void __ISO88591___BOMUTF16BE() throws Exception { - charset(null, TestCharset.ISO88591, null, null, BOM_UTF_16BE); + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) + public void __ISO88591_ISO88591_UTF8_BOMUTF8() throws Exception { + charset(null, TestCharset.ISO88591, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } /** @@ -1438,9 +985,11 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __UTF8_ISO88591_ISO88591_() throws Exception { - charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, null); + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) + public void __ISO88591_ISO88591__BOMUTF8() throws Exception { + charset(null, TestCharset.ISO88591, TestCharset.ISO88591, null, BOM_UTF_8); } /** @@ -1447,8 +996,11 @@ * @throws Exception if the test fails */ @Test - public void __UTF8_ISO88591_ISO88591_BOMUTF16BE() throws Exception { - charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_16BE); + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) + public void __UTF8_ISO88591_UTF8_BOMUTF8() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.UTF8, BOM_UTF_8); } /** @@ -1455,9 +1007,11 @@ * @throws Exception if the test fails */ @Test - @Alerts("?????") - public void __UTF8_ISO88591_ISO88591_BOMUTF8() throws Exception { - charset(null, TestCharset.UTF8, TestCharset.ISO88591, TestCharset.ISO88591, BOM_UTF_8); + @Alerts(DEFAULT = {"a", "ä", "أهلاً", "мир", "房间"}, + IE = {"a", "ä", "أهلاً", "мир", "房间"}) + @NotYetImplemented(IE) + public void __UTF8_ISO88591__BOMUTF8() throws Exception { + charset(null, TestCharset.UTF8, TestCharset.ISO88591, null, BOM_UTF_8); } /** @@ -1464,9 +1018,11 @@ * @throw... [truncated message content] |
From: <rb...@us...> - 2017-06-25 08:35:14
|
Revision: 14633 http://sourceforge.net/p/htmlunit/code/14633 Author: rbri Date: 2017-06-25 08:35:12 +0000 (Sun, 25 Jun 2017) Log Message: ----------- small updates for new releases, switch to 64 bit because we test with these versions Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-06-24 14:39:24 UTC (rev 14632) +++ trunk/htmlunit/src/changes/changes.xml 2017-06-25 08:35:12 UTC (rev 14633) @@ -8,6 +8,12 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="update" dev="rbri"> + We are simulating the 64 bit version of Firefox 52 ESR and CHROME now. + </action> + <action type="update" dev="rbri"> + More appropriate browser appVersion. + </action> <action type="fix" dev="asashour" issue="1892"> JavaScript: fix Number.toLocaleString(). </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-06-24 14:39:24 UTC (rev 14632) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-06-25 08:35:12 UTC (rev 14633) @@ -123,6 +123,11 @@ private static final String PLATFORM_WIN32 = "Win32"; /** + * The WIN64 platform. + */ + private static final String PLATFORM_WIN64 = "Win64"; + + /** * Firefox 45 ESR. * @since 2.21 */ @@ -142,15 +147,15 @@ /** Internet Explorer 11. */ public static final BrowserVersion INTERNET_EXPLORER = new BrowserVersion( - NETSCAPE, "5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko", + NETSCAPE, "5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko", "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko", 11, "IE", null); /** Latest Chrome. */ public static final BrowserVersion CHROME = new BrowserVersion( - NETSCAPE, "5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36", + NETSCAPE, "5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36" + + " (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36" - + " (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36", + + " (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36", 59, "Chrome", null); /** Microsoft Edge. Work In Progress!!! */ @@ -174,6 +179,7 @@ // FF45 FIREFOX_45.initDefaultFeatures(); FIREFOX_45.setVendor(""); + FIREFOX_45.setPlatform(PLATFORM_WIN32); FIREFOX_45.buildId_ = "20170411115307"; FIREFOX_45.setHeaderNamesOrdered(new String[] { "Host", "User-Agent", "Accept", "Accept-Language", "Accept-Encoding", "Referer", "Cookie", "Connection"}); @@ -185,7 +191,7 @@ // FF52 FIREFOX_52.initDefaultFeatures(); FIREFOX_52.setVendor(""); - FIREFOX_52.buildId_ = "20170517122419"; + FIREFOX_52.buildId_ = "20170607123825"; FIREFOX_52.setHeaderNamesOrdered(new String[] { "Host", "User-Agent", "Accept", "Accept-Language", "Accept-Encoding", "Referer", "Cookie", "Connection", "Upgrade-Insecure-Requests"}); FIREFOX_52.setHtmlAcceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); @@ -194,6 +200,7 @@ // IE INTERNET_EXPLORER.initDefaultFeatures(); INTERNET_EXPLORER.setVendor(""); + INTERNET_EXPLORER.setPlatform(PLATFORM_WIN32); INTERNET_EXPLORER.setHeaderNamesOrdered(new String[] { "Accept", "Referer", "Accept-Language", "User-Agent", "Accept-Encoding", "Host", "DNT", "Connection", "Cookie"}); @@ -210,7 +217,7 @@ CHROME.initDefaultFeatures(); CHROME.setApplicationCodeName("Mozilla"); CHROME.setVendor("Google Inc."); - CHROME.setPlatform("MacIntel"); + CHROME.setPlatform(PLATFORM_WIN32); CHROME.setCpuClass(null); CHROME.setHeaderNamesOrdered(new String[] { "Host", "Connection", "Upgrade-Insecure-Requests", "User-Agent", "Accept", "Referer", "Accept-Encoding", "Accept-Language", "Cookie"}); @@ -320,19 +327,19 @@ CHROME.getPlugins().add(flash); flash = new PluginConfiguration("Shockwave Flash", - "Shockwave Flash 25.0 r0", "25.0.0.171", "NPSWF32_25_0_0_171.dll"); + "Shockwave Flash 26.0 r0", "26.0.0.131", "NPSWF32_26_0_0_131.dll"); flash.getMimeTypes().add(new PluginConfiguration.MimeType("application/x-shockwave-flash", "Shockwave Flash", "swf")); FIREFOX_45.getPlugins().add(flash); flash = new PluginConfiguration("Shockwave Flash", - "Shockwave Flash 25.0 r0", "25.0.0.171", "NPSWF32_25_0_0_171.dll"); + "Shockwave Flash 26.0 r0", "26.0.0.131", "NPSWF64_26_0_0_131.dll"); flash.getMimeTypes().add(new PluginConfiguration.MimeType("application/x-shockwave-flash", "Shockwave Flash", "swf")); FIREFOX_52.getPlugins().add(flash); flash = new PluginConfiguration("Shockwave Flash", - "Shockwave Flash 25.0 r0", "25.0.0.171", "Flash32_25_0_0_171.ocx"); + "Shockwave Flash 26.0 r0", "26.0.0.131", "Flash32_26_0_0_131.ocx"); flash.getMimeTypes().add(new PluginConfiguration.MimeType("application/x-shockwave-flash", "Shockwave Flash", "swf")); INTERNET_EXPLORER.getPlugins().add(flash); @@ -353,7 +360,7 @@ private String browserLanguage_ = LANGUAGE_ENGLISH_US; private String cpuClass_ = CPU_CLASS_X86; private boolean onLine_ = true; - private String platform_ = PLATFORM_WIN32; + private String platform_ = PLATFORM_WIN64; private String systemLanguage_ = LANGUAGE_ENGLISH_US; private TimeZone systemTimezone_ = TimeZone.getTimeZone(TIMEZONE_NEW_YORK); private String userAgent_; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java 2017-06-24 14:39:24 UTC (rev 14632) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/NavigatorTest.java 2017-06-25 08:35:12 UTC (rev 14633) @@ -74,8 +74,7 @@ @Test public void appVersion() throws Exception { attribute("appVersion", getBrowserVersion().getApplicationVersion(), - "WOW64; ", "; WOW64", "; Win64", "; x64", "SLCC2; ", - ".NET CLR 2.0.50727; ", ".NET CLR 3.5.30729; ", ".NET CLR 3.0.30729; ", + "SLCC2; ", ".NET CLR 2.0.50727; ", ".NET CLR 3.5.30729; ", ".NET CLR 3.0.30729; ", "Media Center PC 6.0; ", ".NET4.0C; ", ".NET4.0E; "); } @@ -210,9 +209,10 @@ * @throws Exception on test failure */ @Test - @Alerts(FF = {"Shockwave Flash", "Shockwave Flash 25.0 r0", "25.0.0.171", "NPSWF32_25_0_0_171.dll"}, + @Alerts(FF45 = {"Shockwave Flash", "Shockwave Flash 26.0 r0", "26.0.0.131", "NPSWF32_26_0_0_131.dll"}, + FF52 = {"Shockwave Flash", "Shockwave Flash 26.0 r0", "26.0.0.131", "NPSWF64_26_0_0_131.dll"}, CHROME = {"Shockwave Flash", "Shockwave Flash 24.0 r0", "undefined", "internal-not-yet-present"}, - IE = {"Shockwave Flash", "Shockwave Flash 25.0 r0", "25.0.0.171", "Flash32_25_0_0_171.ocx"}, + IE = {"Shockwave Flash", "Shockwave Flash 26.0 r0", "26.0.0.131", "Flash32_26_0_0_131.ocx"}, EDGE = {"Shockwave Flash", "Shockwave Flash 18.0 r0", "18.0.0.232", "Flash.ocx"}) public void pluginsShockwaveFlash() throws Exception { final String html = "<html>\n" @@ -375,7 +375,7 @@ @Test @Alerts(DEFAULT = "undefined", FF45 = "20170411115307", - FF52 = "20170517122419") + FF52 = "20170607123825") public void buildID() throws Exception { final String html = "<html><head><title>First</title>\n" |
From: <rb...@us...> - 2017-06-27 16:29:39
|
Revision: 14636 http://sourceforge.net/p/htmlunit/code/14636 Author: rbri Date: 2017-06-27 16:29:37 +0000 (Tue, 27 Jun 2017) Log Message: ----------- fix window.getComputedStyle() pseudo handling if pseudo param starts with double colon 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/Window.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-06-25 11:24:59 UTC (rev 14635) +++ trunk/htmlunit/src/changes/changes.xml 2017-06-27 16:29:37 UTC (rev 14636) @@ -8,6 +8,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="fix" dev="rbri"> + JavaScript: fix window.getComputedStyle() pseudo handling if pseudo param starts with double colon. + </action> <action type="update" dev="rbri"> We are simulating the 64 bit version of Firefox 52 ESR and CHROME now. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-25 11:24:59 UTC (rev 14635) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-06-27 16:29:37 UTC (rev 14636) @@ -1335,6 +1335,10 @@ @BrowserFeature(IE) JS_WINDOW_CHANGE_OPENER_ONLY_WINDOW_OBJECT, + /** window.getComputedStyle works with pseudo selectors without colon in front. */ + @BrowserFeature(CHROME) + JS_WINDOW_COMPUTED_STYLE_PSEUDO_ACCEPT_WITHOUT_COLON, + /** <code>window.name</code> returns also form fields (e.g. input, textarea). */ @BrowserFeature(IE) JS_WINDOW_FORMFIELDS_ACCESSIBLE_BY_NAME, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2017-06-25 11:24:59 UTC (rev 14635) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2017-06-27 16:29:37 UTC (rev 14636) @@ -15,6 +15,7 @@ package com.gargoylesoftware.htmlunit.javascript.host; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_CHANGE_OPENER_ONLY_WINDOW_OBJECT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_COMPUTED_STYLE_PSEUDO_ACCEPT_WITHOUT_COLON; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_FORMFIELDS_ACCESSIBLE_BY_NAME; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_FRAMES_ACCESSIBLE_BY_ID; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WINDOW_FRAME_BY_ID_RETURNS_WINDOW; @@ -1608,7 +1609,8 @@ * that of <tt>element.style</tt>, but the value returned by this method is read-only. * * @param element the element - * @param pseudoElement a string specifying the pseudo-element to match (may be {@code null}) + * @param pseudoElement a string specifying the pseudo-element to match (may be {@code null}); + * e.g. ':before' * @return the computed style */ @JsxFunction @@ -1617,10 +1619,20 @@ throw ScriptRuntime.typeError("parameter 1 is not of type 'Element'"); } final Element e = (Element) element; + + String normalizedPseudo = pseudoElement; + if (normalizedPseudo != null && normalizedPseudo.startsWith("::")) { + normalizedPseudo = normalizedPseudo.substring(1); + } + if (getBrowserVersion().hasFeature(JS_WINDOW_COMPUTED_STYLE_PSEUDO_ACCEPT_WITHOUT_COLON) + && !normalizedPseudo.startsWith(":")) { + normalizedPseudo = ":" + normalizedPseudo; + } + synchronized (computedStyles_) { final Map<String, CSS2Properties> elementMap = computedStyles_.get(e); if (elementMap != null) { - final CSS2Properties style = elementMap.get(pseudoElement); + final CSS2Properties style = elementMap.get(normalizedPseudo); if (style != null) { return style; } @@ -1639,7 +1651,7 @@ if (trace) { LOG.trace("modifyIfNecessary: " + sheet + ", " + style + ", " + e); } - sheet.modifyIfNecessary(style, e, pseudoElement); + sheet.modifyIfNecessary(style, e, normalizedPseudo); } } @@ -1649,7 +1661,7 @@ elementMap = new WeakHashMap<>(); computedStyles_.put(e, elementMap); } - elementMap.put(pseudoElement, style); + elementMap.put(normalizedPseudo, style); } } return style; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2017-06-25 11:24:59 UTC (rev 14635) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2017-06-27 16:29:37 UTC (rev 14636) @@ -2060,4 +2060,46 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts(DEFAULT = {"\"@\"", "none", "\"@\"", "\"#\"", "none", "\"#\""}, + CHROME = {"\"@\"", "\"@\"", "\"@\"", "\"#\"", "\"#\"", "\"#\""}, + IE = {"\"@\"", "normal", "\"@\"", "\"#\"", "normal", "\"#\""}) + public void pseudoBefore() throws Exception { + final String html = "<html><head>\n" + + "<style type='text/css'>\n" + + " /* <![CDATA[ */\n" + + " #myDiv:before { content: '@' }\n" + + " #myDiv2::before { content: '#' }\n" + + " /* ]]> */\n" + + "</style>\n" + + "<script>\n" + + " function test() {\n" + + " var node = document.getElementById('myDiv');\n" + + " var style = window.getComputedStyle(node, ':before');\n" + + " alert(style.content);\n" + + " var style = window.getComputedStyle(node, 'before');\n" + + " alert(style.content);\n" + + " var style = window.getComputedStyle(node, '::before');\n" + + " alert(style.content);\n" + + + " node = document.getElementById('myDiv2');\n" + + " var style = window.getComputedStyle(node, ':before');\n" + + " alert(style.content);\n" + + " var style = window.getComputedStyle(node, 'before');\n" + + " alert(style.content);\n" + + " var style = window.getComputedStyle(node, '::before');\n" + + " alert(style.content);\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + " <div id='myDiv' >Test</div>\n" + + " <div id='myDiv2' >Test</div>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } |
From: <rb...@us...> - 2017-07-03 17:37:30
|
Revision: 14642 http://sourceforge.net/p/htmlunit/code/14642 Author: rbri Date: 2017-07-03 17:37:27 +0000 (Mon, 03 Jul 2017) Log Message: ----------- take care of label elements during event bubbling; they have to trigger a click event for the associated element Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.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/Event2.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.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/MouseEvent2.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-03 17:37:27 UTC (rev 14642) @@ -9,6 +9,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> <action type="fix" dev="rbri"> + Take care of label elements during event bubbling; they have to trigger a click event for the associated element. + </action> + <action type="fix" dev="rbri"> JavaScript: fix window.getComputedStyle() pseudo handling if pseudo param starts with double colon. </action> <action type="update" dev="rbri"> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -892,15 +892,40 @@ * @return the page contained in the current window as returned by {@link WebClient#getCurrentWindow()} * @exception IOException if an IO error occurs */ - @SuppressWarnings("unchecked") - protected <P extends Page> P click(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, + public <P extends Page> P click(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final boolean triggerMouseEvents) throws IOException { + return click(shiftKey, ctrlKey, altKey, triggerMouseEvents, false, false); + } + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> + * + * Simulates clicking on this element, returning the page in the window that has the focus + * after the element has been clicked. Note that the returned page may or may not be the same + * as the original page, depending on the type of element being clicked, the presence of JavaScript + * action listeners, etc. + * + * @param shiftKey {@code true} if SHIFT is pressed during the click + * @param ctrlKey {@code true} if CTRL is pressed during the click + * @param altKey {@code true} if ALT is pressed during the click + * @param triggerMouseEvents if true trigger the mouse events also + * @param ignoreVisibility whether to ignore visibility or not + * @param disableProcessLabelAfterBubbling ignore label processing + * @param <P> the page type + * @return the page contained in the current window as returned by {@link WebClient#getCurrentWindow()} + * @exception IOException if an IO error occurs + */ + @SuppressWarnings("unchecked") + public <P extends Page> P click(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, + final boolean triggerMouseEvents, final boolean ignoreVisibility, + final boolean disableProcessLabelAfterBubbling) throws IOException { + // make enclosing window the current one final SgmlPage page = getPage(); page.getWebClient().setCurrentWindow(page.getEnclosingWindow()); - if (!isDisplayed() || !(page instanceof HtmlPage) + if ((!ignoreVisibility && !isDisplayed()) + || !(page instanceof HtmlPage) || this instanceof DisabledElement && ((DisabledElement) this).isDisabled()) { return (P) page; } @@ -927,7 +952,7 @@ } if (getPage().getWebClient().getJavaScriptEngine() instanceof NashornJavaScriptEngine) { - final Event2 event; + final MouseEvent2 event; if (getPage().getWebClient().getBrowserVersion().hasFeature(EVENT_ONCLICK_USES_POINTEREVENT)) { event = new PointerEvent2(getEventTargetElement(), MouseEvent.TYPE_CLICK, shiftKey, ctrlKey, altKey, MouseEvent.BUTTON_LEFT); @@ -936,10 +961,14 @@ event = new MouseEvent2(getEventTargetElement(), MouseEvent.TYPE_CLICK, shiftKey, ctrlKey, altKey, MouseEvent.BUTTON_LEFT); } + + if (disableProcessLabelAfterBubbling) { + event.disableProcessLabelAfterBubbling(); + } return (P) click(event, false); } - final Event event; + final MouseEvent event; if (getPage().getWebClient().getBrowserVersion().hasFeature(EVENT_ONCLICK_USES_POINTEREVENT)) { event = new PointerEvent(getEventTargetElement(), MouseEvent.TYPE_CLICK, shiftKey, ctrlKey, altKey, MouseEvent.BUTTON_LEFT); @@ -948,7 +977,11 @@ event = new MouseEvent(getEventTargetElement(), MouseEvent.TYPE_CLICK, shiftKey, ctrlKey, altKey, MouseEvent.BUTTON_LEFT); } - return (P) click(event, false); + + if (disableProcessLabelAfterBubbling) { + event.disableProcessLabelAfterBubbling(); + } + return (P) click(event, ignoreVisibility); } } 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 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -666,4 +666,15 @@ builder.append(");"); return builder.toString(); } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> + * + * If we click on a label, we have to simulate a click on the element referenced by the 'for' attribute also. + * To support this for special events we have this method here. + * @return false in this default impl + */ + public boolean processLabelAfterBubbling() { + return false; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2.java 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -1097,4 +1097,15 @@ return META_MASK; } } + + /** + * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> + * + * If we click on a label, we have to simulate a click on the element referenced by the 'for' attribute also. + * To support this for special events we have this method here. + * @return false in this default impl + */ + public boolean processLabelAfterBubbling() { + return false; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -32,6 +32,8 @@ import com.gargoylesoftware.htmlunit.html.DomDocumentFragment; import com.gargoylesoftware.htmlunit.html.DomElement; import com.gargoylesoftware.htmlunit.html.DomNode; +import com.gargoylesoftware.htmlunit.html.HtmlElement; +import com.gargoylesoftware.htmlunit.html.HtmlLabel; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass; import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor; @@ -38,6 +40,7 @@ import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction; import com.gargoylesoftware.htmlunit.javascript.host.Window; import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement; +import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLLabelElement; import net.sourceforge.htmlunit.corejs.javascript.Context; import net.sourceforge.htmlunit.corejs.javascript.Function; @@ -179,7 +182,13 @@ // bubbling phase event.setEventPhase(Event.AT_TARGET); eventTarget = this; + HtmlLabel label = null; + final boolean processLabelAfterBubbling = event.processLabelAfterBubbling(); + while (eventTarget != null) { + if (label == null && processLabelAfterBubbling && eventTarget instanceof HTMLLabelElement) { + label = (HtmlLabel) eventTarget.getDomNodeOrNull(); + } final EventTarget jsNode = eventTarget; final EventListenersContainer elc = jsNode.eventListenersContainer_; if (elc != null && !(jsNode instanceof Window) && (isAttached || !(jsNode instanceof HTMLElement))) { @@ -197,6 +206,19 @@ event.setEventPhase(Event.BUBBLING_PHASE); } + if (label != null) { + System.out.println("call " + label); + final HtmlElement element = label.getReferencedElement(); + if (element != null) { + try { + element.click(event.isShiftKey(), event.isCtrlKey(), event.isAltKey(), false, true, true); + } + catch (final IOException e) { + // ignore for now + } + } + } + if (isAttached || windowEventIfDetached) { final ScriptResult r = windowsListeners.executeBubblingListeners(event, args, propHandlerArgs); result = ScriptResult.combine(r, result, ie); 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 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -39,6 +39,7 @@ * @author Marc Guillemot * @author Ahmed Ashour * @author Frank Danek + * @author Ronald Brill */ @JsxClass public class MouseEvent extends UIEvent { @@ -107,6 +108,9 @@ /** The button code according to W3C (0: left button, 1: middle button, 2: right button). */ private int button_; + /** Switch to disable label handling if we already processing the event triggered from label processing */ + private boolean processLabelAfterBubbling_ = true; + /** * Used to build the prototype. */ @@ -376,4 +380,19 @@ public boolean isShiftKey() { return super.isShiftKey(); } + + /** + * {@inheritDoc} Overridden take care of click events. + */ + @Override + public boolean processLabelAfterBubbling() { + return MouseEvent.TYPE_CLICK == getType() && processLabelAfterBubbling_; + } + + /** + * Disable the lable processing if we are already processing one. + */ + public void disableProcessLabelAfterBubbling() { + processLabelAfterBubbling_ = false; + } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent2.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent2.java 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent2.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -85,6 +85,9 @@ /** The button code according to W3C (0: left button, 1: middle button, 2: right button). */ private int button_; + /** Switch to disable label handling if we already processing the event triggered from label processing */ + private boolean processLabelAfterBubbling_ = true; + /** * Used to build the prototype. */ @@ -222,4 +225,19 @@ super("MouseEvent"); } } + + /** + * {@inheritDoc} Overridden take care of click events. + */ + @Override + public boolean processLabelAfterBubbling() { + return MouseEvent.TYPE_CLICK == getType() && processLabelAfterBubbling_; + } + + /** + * Disable the lable processing if we are already processing one. + */ + public void disableProcessLabelAfterBubbling() { + processLabelAfterBubbling_ = false; + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-03 17:33:52 UTC (rev 14641) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-03 17:37:27 UTC (rev 14642) @@ -72,4 +72,99 @@ driver.findElement(By.id("label1")).click(); verifyAlerts(driver, getExpectedAlerts()); } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", + "click radio1", "click radio1Label", + "click listItem1", "click list"}) + public void triggerRadioComplexCase() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + + " <span>\n" + + " <input id='radio1' name='radios' value='1' type='radio'" + + "onclick='alert(\"click radio1\");'>\n" + + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", + "click radio1", "click radio1Label", + "click listItem1", "click list"}) + public void triggerRadioComplexCaseHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + + " <span>\n" + + " <input id='radio1' name='radios' value='1' type='radio' style='display: none;'" + + "onclick='alert(\"click radio1\");'>\n" + + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Span")).click(); + verifyAlerts(2000000, driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", + "click radio1Label", "click listItem1", "click list"}) + public void triggerRadioComplexCaseDisabled() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + + " <span>\n" + + " <input id='radio1' name='radios' value='1' type='radio' disabled" + + "onclick='alert(\"click radio1\");'>\n" + + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } } |
From: <rb...@us...> - 2017-07-05 06:17:23
|
Revision: 14646 http://sourceforge.net/p/htmlunit/code/14646 Author: rbri Date: 2017-07-05 06:17:20 +0000 (Wed, 05 Jul 2017) Log Message: ----------- one more label handling fix Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-04 06:43:04 UTC (rev 14645) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-05 06:17:20 UTC (rev 14646) @@ -158,7 +158,7 @@ // then the click on the referenced element final HtmlElement element = getReferencedElement(); if (element != null) { - response = element.click(false, false, false, false, false, false); + response = element.click(false, false, false, false, false, true); } else { response = page; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-04 06:43:04 UTC (rev 14645) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/EventTarget.java 2017-07-05 06:17:20 UTC (rev 14646) @@ -210,9 +210,8 @@ } if (label != null) { - System.out.println("call " + label); final HtmlElement element = label.getReferencedElement(); - if (element != null) { + if (element != null && element != this.getDomNodeOrNull()) { try { element.click(event.isShiftKey(), event.isCtrlKey(), event.isAltKey(), false, true, true); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-04 06:43:04 UTC (rev 14645) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-05 06:17:20 UTC (rev 14646) @@ -87,7 +87,7 @@ + " <li onclick='alert(\"click listItem1\")'>\n" + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + " <span>\n" - + " <input id='radio1' name='radios' value='1' type='radio'" + + " <input id='radio1' name='radios' value='1' type='radio' " + "onclick='alert(\"click radio1\");'>\n" + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + " </span>\n" @@ -112,6 +112,38 @@ @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", "click radio1", "click radio1Label", "click listItem1", "click list"}) + public void triggerRadioComplexCaseChecked() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + + " <span>\n" + + " <input id='radio1' name='radios' value='1' type='radio' checked " + + "onclick='alert(\"click radio1\");'>\n" + + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", + "click radio1", "click radio1Label", + "click listItem1", "click list"}) public void triggerRadioComplexCaseHidden() throws Exception { final String html = "<html>\n" + "<body>\n" @@ -119,7 +151,7 @@ + " <li onclick='alert(\"click listItem1\")'>\n" + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + " <span>\n" - + " <input id='radio1' name='radios' value='1' type='radio' style='display: none;'" + + " <input id='radio1' name='radios' value='1' type='radio' style='display: none;' " + "onclick='alert(\"click radio1\");'>\n" + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + " </span>\n" @@ -141,8 +173,7 @@ * @throws Exception if an error occurs */ @Test - @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", - "click radio1Label", "click listItem1", "click list"}) + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list"}) public void triggerRadioComplexCaseDisabled() throws Exception { final String html = "<html>\n" + "<body>\n" @@ -150,7 +181,7 @@ + " <li onclick='alert(\"click listItem1\")'>\n" + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + " <span>\n" - + " <input id='radio1' name='radios' value='1' type='radio' disabled" + + " <input id='radio1' name='radios' value='1' type='radio' disabled " + "onclick='alert(\"click radio1\");'>\n" + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + " </span>\n" @@ -165,6 +196,244 @@ verifyAlerts(driver, getExpectedAlerts()); driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "false"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click radio1Label", "click listItem1", "click list", + "click radio1", "click radio1Label", + "click listItem1", "click list"}) + public void triggerRadioComplexCaseChildOfLabel() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Label\n" + + " <input id='radio1' name='radios' value='1' type='radio'" + + "onclick='alert(\"click radio1\");'>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); verifyAlerts(driver, "true"); } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click radio1", "click radio1Label", "click listItem1", "click list"}) + public void triggerRadioComplexCaseClickRadio() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Label\n" + + " <input id='radio1' name='radios' value='1' type='radio'" + + "onclick='alert(\"click radio1\");'>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click check1Label", "click listItem1", "click list", + "click check1", "click check1Label", + "click listItem1", "click list"}) + public void triggerCheckboxComplexCase() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>\n" + + " <span>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' " + + "onclick='alert(\"click check1\");'>\n" + + " <span id='check1Span' onclick='alert(\"click span1\")'>Checkbox 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click check1Label", "click listItem1", "click list", + "click check1", "click check1Label", + "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseChecked() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>\n" + + " <span>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' checked " + + "onclick='alert(\"click check1\");'>\n" + + " <span id='check1Span' onclick='alert(\"click span1\")'>Checkbox 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "false"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click check1Label", "click listItem1", "click list", + "click check1", "click check1Label", + "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>\n" + + " <span>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' style='display: none;' " + + "onclick='alert(\"click check1\");'>\n" + + " <span id='check1Span' onclick='alert(\"click span1\")'>Checkbox 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Span")).click(); + verifyAlerts(2000000, driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click span1", "click check1Label", "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseDisabled() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>\n" + + " <span>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' disabled " + + "onclick='alert(\"click check1\");'>\n" + + " <span id='check1Span' onclick='alert(\"click span1\")'>Checkbox 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "false"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click check1Label", "click listItem1", "click list", + "click check1", "click check1Label", + "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseChildOfLabel() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Label\n" + + " <input id='check1' name='checks' value='1' type='checkbox'" + + "onclick='alert(\"click check1\");'>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click check1", "click check1Label", "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseClickCheckbox() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Label\n" + + " <input id='check1' name='checks' value='1' type='checkbox'" + + "onclick='alert(\"click check1\");'>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } } |
From: <rb...@us...> - 2017-07-07 08:35:57
|
Revision: 14647 http://sourceforge.net/p/htmlunit/code/14647 Author: rbri Date: 2017-07-07 08:35:55 +0000 (Fri, 07 Jul 2017) Log Message: ----------- more label fixes Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-05 06:17:20 UTC (rev 14646) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java 2017-07-07 08:35:55 UTC (rev 14647) @@ -158,7 +158,7 @@ // then the click on the referenced element final HtmlElement element = getReferencedElement(); if (element != null) { - response = element.click(false, false, false, false, false, true); + response = element.click(false, false, false, false, true, true); } else { response = page; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-05 06:17:20 UTC (rev 14646) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlLabelTest.java 2017-07-07 08:35:55 UTC (rev 14647) @@ -30,6 +30,7 @@ * @author Marc Guillemot * @author Ahmed Ashour * @author Frank Danek + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class HtmlLabelTest extends WebDriverTestCase { @@ -77,6 +78,114 @@ * @throws Exception if an error occurs */ @Test + @Alerts({"click radio1Label", "click listItem1", "click list", + "click radio1", "click listItem1", "click list"}) + public void triggerRadio() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Radio 1</label>\n" + + " <input id='radio1' name='radios' value='1' type='radio' " + + "onclick='alert(\"click radio1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click radio1Label", "click listItem1", "click list", + "click radio1", "click listItem1", "click list"}) + public void triggerRadioChecked() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Radio 1</label>\n" + + " <input id='radio1' name='radios' value='1' type='radio' checked " + + "onclick='alert(\"click radio1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click radio1Label", "click listItem1", "click list", + "click radio1", "click listItem1", "click list"}) + public void triggerRadioInvisible() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Radio 1</label>\n" + + " <input id='radio1' name='radios' value='1' type='radio' style='display: none;' " + + "onclick='alert(\"click radio1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click radio1Label", "click listItem1", "click list", + "click radio1", "click listItem1", "click list"}) + public void triggerRadioHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>Radio 1</label>\n" + + " <input id='radio1' name='radios' value='1' type='radio' hidden " + + "onclick='alert(\"click radio1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", "click radio1", "click radio1Label", "click listItem1", "click list"}) @@ -144,7 +253,7 @@ @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", "click radio1", "click radio1Label", "click listItem1", "click list"}) - public void triggerRadioComplexCaseHidden() throws Exception { + public void triggerRadioComplexCaseInvisible() throws Exception { final String html = "<html>\n" + "<body>\n" + " <ul onclick='alert(\"click list\")'>\n" @@ -163,7 +272,7 @@ final WebDriver driver = loadPage2(html); driver.findElement(By.id("radio1Span")).click(); - verifyAlerts(2000000, driver, getExpectedAlerts()); + verifyAlerts(driver, getExpectedAlerts()); driver.findElement(By.id("check")).click(); verifyAlerts(driver, "true"); @@ -173,6 +282,38 @@ * @throws Exception if an error occurs */ @Test + @Alerts({"click span1", "click radio1Label", "click listItem1", "click list", + "click radio1", "click radio1Label", + "click listItem1", "click list"}) + public void triggerRadioComplexCaseHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='radio1Label' for='radio1' onclick='alert(\"click radio1Label\")'>\n" + + " <span>\n" + + " <input id='radio1' name='radios' value='1' type='radio' hidden " + + "onclick='alert(\"click radio1\");'>\n" + + " <span id='radio1Span' onclick='alert(\"click span1\")'>Radio 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"radio1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("radio1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts({"click span1", "click radio1Label", "click listItem1", "click list"}) public void triggerRadioComplexCaseDisabled() throws Exception { final String html = "<html>\n" @@ -259,6 +400,114 @@ * @throws Exception if an error occurs */ @Test + @Alerts({"click check1Label", "click listItem1", "click list", + "click check1", "click listItem1", "click list"}) + public void triggerCheckbox() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Checkbox 1</label>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' " + + "onclick='alert(\"click check1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click check1Label", "click listItem1", "click list", + "click check1", "click listItem1", "click list"}) + public void triggerCheckboxChecked() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Checkbox 1</label>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' checked " + + "onclick='alert(\"click check1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "false"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click check1Label", "click listItem1", "click list", + "click check1", "click listItem1", "click list"}) + public void triggerCheckboxInvisible() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Checkbox 1</label>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' style='display: none;' " + + "onclick='alert(\"click check1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts({"click check1Label", "click listItem1", "click list", + "click check1", "click listItem1", "click list"}) + public void triggerCheckboxHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>Checkbox 1</label>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' hidden " + + "onclick='alert(\"click check1\");'>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Label")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts({"click span1", "click check1Label", "click listItem1", "click list", "click check1", "click check1Label", "click listItem1", "click list"}) @@ -326,7 +575,7 @@ @Alerts({"click span1", "click check1Label", "click listItem1", "click list", "click check1", "click check1Label", "click listItem1", "click list"}) - public void triggerCheckboxComplexCaseHidden() throws Exception { + public void triggerCheckboxComplexCaseInvisible() throws Exception { final String html = "<html>\n" + "<body>\n" + " <ul onclick='alert(\"click list\")'>\n" @@ -345,7 +594,7 @@ final WebDriver driver = loadPage2(html); driver.findElement(By.id("check1Span")).click(); - verifyAlerts(2000000, driver, getExpectedAlerts()); + verifyAlerts(driver, getExpectedAlerts()); driver.findElement(By.id("check")).click(); verifyAlerts(driver, "true"); @@ -355,6 +604,38 @@ * @throws Exception if an error occurs */ @Test + @Alerts({"click span1", "click check1Label", "click listItem1", "click list", + "click check1", "click check1Label", + "click listItem1", "click list"}) + public void triggerCheckboxComplexCaseHidden() throws Exception { + final String html = "<html>\n" + + "<body>\n" + + " <ul onclick='alert(\"click list\")'>\n" + + " <li onclick='alert(\"click listItem1\")'>\n" + + " <label id='check1Label' for='check1' onclick='alert(\"click check1Label\")'>\n" + + " <span>\n" + + " <input id='check1' name='checks' value='1' type='checkbox' hidden " + + "onclick='alert(\"click check1\");'>\n" + + " <span id='check1Span' onclick='alert(\"click span1\")'>Checkbox 1</span>\n" + + " </span>\n" + + " </label>\n" + + " </li>\n" + + "</ul>\n" + + "<button id='check' onclick='alert(document.getElementById(\"check1\").checked)'>Check</button>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + driver.findElement(By.id("check1Span")).click(); + verifyAlerts(driver, getExpectedAlerts()); + + driver.findElement(By.id("check")).click(); + verifyAlerts(driver, "true"); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts({"click span1", "click check1Label", "click listItem1", "click list"}) public void triggerCheckboxComplexCaseDisabled() throws Exception { final String html = "<html>\n" |
From: <rb...@us...> - 2017-07-10 06:45:39
|
Revision: 14648 http://sourceforge.net/p/htmlunit/code/14648 Author: rbri Date: 2017-07-10 06:45:37 +0000 (Mon, 10 Jul 2017) Log Message: ----------- fix ClassCastException when calculating offsetHeight Issue 1899 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-07 08:35:55 UTC (rev 14647) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-10 06:45:37 UTC (rev 14648) @@ -8,6 +8,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="fix" dev="rbri" issue="1899" due-to="Christian Rösch"> + JavaScript: fix ClassCastException when calculating offsetHeight. + </action> <action type="fix" dev="rbri"> Take care of label elements during event bubbling; they have to trigger a click event for the associated element. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2017-07-07 08:35:55 UTC (rev 14647) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2017-07-10 06:45:37 UTC (rev 14648) @@ -1386,7 +1386,7 @@ boolean prevHadComputedTop = false; while (prev != null && !prevHadComputedTop) { if (prev instanceof HtmlElement) { - final HTMLElement e = (HTMLElement) ((HtmlElement) prev).getScriptableObject(); + final Element e = prev.getScriptableObject(); final ComputedCSSStyleDeclaration style = e.getWindow().getComputedStyle(e, null); int prevTop = 0; if (style.top_ == null) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2017-07-07 08:35:55 UTC (rev 14647) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2017-07-10 06:45:37 UTC (rev 14648) @@ -2102,4 +2102,22 @@ + "</body></html>"; loadPageWithAlerts2(html); } + + /** + * @throws Exception if an error occurs + */ + @Test + @Alerts("true") + public void calculateContentHeightAfterSVG() throws Exception { + final String html = + "<html><body>\n" + + "<svg/>\n" + + "<img />\n" + + "<textarea id='myTextarea' cols='120' rows='20'></textarea>\n" + + "<script>\n" + + " alert(document.body.offsetHeight > 10);\n" + + "</script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } } |
From: <rb...@us...> - 2017-07-12 20:10:32
|
Revision: 14650 http://sourceforge.net/p/htmlunit/code/14650 Author: rbri Date: 2017-07-12 20:10:30 +0000 (Wed, 12 Jul 2017) Log Message: ----------- code style Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-12 18:43:03 UTC (rev 14649) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-12 20:10:30 UTC (rev 14650) @@ -9,7 +9,7 @@ <body> <release version="2.28" date="???" description="Bugfixes"> <action type="add" dev="rbri" due-to="Anton Demydenko" issue="1884"> - Support for form attributes formaction, formmethod, formtarget and formenctype added. + Support for form attributes formaction, formmethod, formtarget and formenctype added. </action> <action type="fix" dev="rbri" issue="1899" due-to="Christian Rösch"> JavaScript: fix ClassCastException when calculating offsetHeight. Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2017-07-12 18:43:03 UTC (rev 14649) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlForm2Test.java 2017-07-12 20:10:30 UTC (rev 14650) @@ -772,8 +772,8 @@ + "<body>\n" + " <p>hello world</p>\n" + " <form id='myForm' action='" + URL_SECOND + "' target='_self'>\n" - + " <button id='myButton' type='submit'" - + " formtarget='_blank'>Submit with different form target</button>\n" + + " <button id='myButton' type='submit' " + + "formtarget='_blank'>Submit with different form target</button>\n" + " </form>\n" + "</body></html>"; final String secondContent = "second content"; |
From: <rb...@us...> - 2017-07-13 17:03:32
|
Revision: 14652 http://sourceforge.net/p/htmlunit/code/14652 Author: rbri Date: 2017-07-13 17:03:29 +0000 (Thu, 13 Jul 2017) Log Message: ----------- fix ClassCastException in Array.from. Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ArrayCustom.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-13 16:39:55 UTC (rev 14651) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-13 17:03:29 UTC (rev 14652) @@ -8,6 +8,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="fix" dev="rbri"> + JavaScript: fix ClassCastException in Array.from. + </action> <action type="add" dev="rbri" due-to="Anton Demydenko" issue="1884"> Support for form attributes formaction, formmethod, formtarget and formenctype added. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ArrayCustom.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ArrayCustom.java 2017-07-13 16:39:55 UTC (rev 14651) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ArrayCustom.java 2017-07-13 17:03:29 UTC (rev 14652) @@ -29,6 +29,7 @@ * Contains some missing features of Rhino NativeArray. * * @author Ahmed Ashour + * @author Ronald Brill */ public final class ArrayCustom { @@ -50,7 +51,7 @@ final Scriptable scriptable = (Scriptable) arrayLike; final Object length = scriptable.get("length", scriptable); if (length != Scriptable.NOT_FOUND) { - final int size = (int) length; + final int size = (int) Context.toNumber(length); array = new Object[(int) size]; for (int i = 0; i < size; i++) { array[i] = scriptable.get(i, scriptable); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java 2017-07-13 16:39:55 UTC (rev 14651) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/NativeArrayTest.java 2017-07-13 17:03:29 UTC (rev 14652) @@ -36,6 +36,7 @@ * @author Marc Guillemot * @author Frank Danek * @author Ahmed Ashour + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class NativeArrayTest extends WebDriverTestCase { @@ -274,7 +275,7 @@ @Test @Alerts(DEFAULT = {"3", "a", "b", "c"}, IE = "not supported") - public void from() throws Exception { + public void fromString() throws Exception { final String html = "<html>\n" + "<head>\n" @@ -300,6 +301,34 @@ * @throws Exception if the test fails */ @Test + @Alerts(DEFAULT = {"3", "a", "b", "c"}, + IE = "not supported") + public void fromArray() throws Exception { + final String html + = "<html>\n" + + "<head>\n" + + "<script>\n" + + " if (Array.from) {\n" + + " var arr = Array.from(['a', 'b', 'c']);\n" + + " alert(arr.length);\n" + + " for (var i = 0; i < arr.length; i++) {\n" + + " alert(arr[i]);\n" + + " }\n" + + " } else {\n" + + " alert('not supported');\n" + + " }\n" + + "</script>\n" + + "</head>\n" + + "<body>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test @Alerts(DEFAULT = {"2", "abc", "[object Window]"}, IE = "not supported") public void fromSet() throws Exception { |
From: <asa...@us...> - 2017-07-18 07:40:49
|
Revision: 14663 http://sourceforge.net/p/htmlunit/code/14663 Author: asashour Date: 2017-07-18 07:40:46 +0000 (Tue, 18 Jul 2017) Log Message: ----------- remove "this." Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window2.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/LocalTestServer.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/runners/FrameworkMethodWithParameters.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -608,7 +608,7 @@ * @param localAddress the local address */ public void setLocalAddress(final InetAddress localAddress) { - this.localAddress_ = localAddress; + localAddress_ = localAddress; } /** @@ -616,7 +616,7 @@ * @param downloadImages whether to automatically download images by default, or not */ public void setDownloadImages(final boolean downloadImages) { - this.downloadImages_ = downloadImages; + downloadImages_ = downloadImages; } /** @@ -633,7 +633,7 @@ * @param screenWidth the screen width */ public void setScreenWidth(final int screenWidth) { - this.screenWidth_ = screenWidth; + screenWidth_ = screenWidth; } /** @@ -651,7 +651,7 @@ * @param screenHeight the screen height */ public void setScreenHeight(final int screenHeight) { - this.screenHeight_ = screenHeight; + screenHeight_ = screenHeight; } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -153,7 +153,7 @@ catch (final IllegalArgumentException e) { // is it the right place or should Rhino throw a RuntimeError instead of an IllegalArgumentException? throw Context.reportRuntimeError("'set " - + name + "' called on an object that does not implement interface " + this.getClassName()); + + name + "' called on an object that does not implement interface " + getClassName()); } } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window2.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window2.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window2.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -268,7 +268,7 @@ * @param webWindow the {@link WebWindow} */ public void setWebWindow(final WebWindow webWindow) { - this.webWindow_ = webWindow; + webWindow_ = webWindow; } /** Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/LocalTestServer.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/LocalTestServer.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/LocalTestServer.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -36,7 +36,7 @@ public LocalTestServer(final SSLContext sslContext) throws Exception { super(ProtocolScheme.https); super.setUp(); - this.serverBootstrap.setSslContext(sslContext); + serverBootstrap.setSslContext(sslContext); } /** @@ -45,7 +45,7 @@ * @param handler the handler */ public void register(final String pattern, final HttpRequestHandler handler) { - this.serverBootstrap.registerHandler(pattern, handler); + serverBootstrap.registerHandler(pattern, handler); } /** @@ -53,6 +53,6 @@ * @return the server */ public HttpServer getServer() { - return this.server; + return server; } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -211,7 +211,7 @@ @Override public void onWebSocketConnect(final Session session) { - this.session_ = session; + session_ = session; webSockets_.add(this); } @@ -328,7 +328,7 @@ @Override public void onWebSocketConnect(final Session session) { - this.session_ = session; + session_ = session; webSockets_.add(this); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/runners/FrameworkMethodWithParameters.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/runners/FrameworkMethodWithParameters.java 2017-07-18 07:36:41 UTC (rev 14662) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/runners/FrameworkMethodWithParameters.java 2017-07-18 07:40:46 UTC (rev 14663) @@ -44,8 +44,8 @@ public FrameworkMethodWithParameters(final TestClass testClass, final Method method, final List<Object> parameters) { super(method); - this.testClass_ = testClass; - this.parameters_ = parameters; + testClass_ = testClass; + parameters_ = parameters; } /** |
From: <asa...@us...> - 2017-07-19 13:38:27
|
Revision: 14670 http://sourceforge.net/p/htmlunit/code/14670 Author: asashour Date: 2017-07-19 13:38:25 +0000 (Wed, 19 Jul 2017) Log Message: ----------- Fix Location header if it has non-ASCII characters Issue 1898 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection3Test.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2017-07-19 12:22:37 UTC (rev 14669) +++ trunk/htmlunit/src/changes/changes.xml 2017-07-19 13:38:25 UTC (rev 14670) @@ -8,6 +8,9 @@ <body> <release version="2.28" date="???" description="Bugfixes"> + <action type="fix" dev="asashour" issue="1898"> + Fix Location header if it has non-ASCII characters. + </action> <action type="fix" dev="rbri"> JavaScript: fix ClassCastException in Array.from. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-07-19 12:22:37 UTC (rev 14669) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-07-19 13:38:25 UTC (rev 14670) @@ -20,6 +20,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MINIMAL_QUERY_ENCODING; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.WINDOW_EXECUTE_EVENTS; +import static java.nio.charset.StandardCharsets.ISO_8859_1; import static java.nio.charset.StandardCharsets.UTF_8; import java.io.BufferedInputStream; @@ -1419,6 +1420,7 @@ if (locationString == null) { return webResponse; } + locationString = new String(locationString.getBytes(ISO_8859_1), UTF_8); newUrl = expandUrl(url, locationString); } catch (final MalformedURLException e) { Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection3Test.java 2017-07-19 12:22:37 UTC (rev 14669) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection3Test.java 2017-07-19 13:38:25 UTC (rev 14670) @@ -157,7 +157,6 @@ * @throws Exception if an error occurs */ @Test - @NotYetImplemented public void locationUTF() throws Exception { final String response = "HTTP/1.1 302 Found\r\n" + "Content-Length: 0\r\n" |
From: <asa...@us...> - 2017-07-20 09:47:40
|
Revision: 14676 http://sourceforge.net/p/htmlunit/code/14676 Author: asashour Date: 2017-07-20 09:47:37 +0000 (Thu, 20 Jul 2017) Log Message: ----------- a/an Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSMediaRule.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSRule.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet2.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/performance/PerformanceTiming.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/Cookie.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/MooTools121Test.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersion.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -664,7 +664,7 @@ /** * Returns the value used by the browser for the {@code Accept} header - * if requesting an script. + * if requesting a script. * @return the accept header string */ public String getScriptAcceptHeader() { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -213,11 +213,11 @@ @BrowserFeature(IE) EVENT_ONMOUSEDOWN_NOT_FOR_SELECT_OPTION, - /** FF triggers an mouseover event even if the option is disabled. */ + /** FF triggers a mouseover event even if the option is disabled. */ @BrowserFeature(FF) EVENT_ONMOUSEOVER_FOR_DISABLED_OPTION, - /** IE never triggers an mouseover event for select options. */ + /** IE never triggers a mouseover event for select options. */ @BrowserFeature(IE) EVENT_ONMOUSEOVER_NEVER_FOR_SELECT_OPTION, @@ -269,7 +269,7 @@ @BrowserFeature(IE) FORM_PARAMETRS_NOT_SUPPORTED_FOR_IMAGE, - /** Form submit forces an real request also if only the hash was changed. */ + /** Form submit forces a real request also if only the hash was changed. */ @BrowserFeature(CHROME) FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED, @@ -484,7 +484,7 @@ @BrowserFeature({CHROME, FF}) HTMLTEXTAREA_SET_DEFAULT_VALUE_UPDATES_VALUE, - /** When calculation the value of an text area ie uses a recursive approach. */ + /** When calculation the value of a text area ie uses a recursive approach. */ @BrowserFeature(IE) HTMLTEXTAREA_USE_ALL_TEXT_CHILDREN, @@ -1454,7 +1454,7 @@ @BrowserFeature(CHROME) QUERYSELECTORALL_NO_TARGET, - /** IE throws a syntax error if a css3 pseudo selector is used on an detached node. */ + /** IE throws a syntax error if a css3 pseudo selector is used on a detached node. */ @BrowserFeature(IE) QUERYSELECTOR_CSS3_PSEUDO_REQUIRE_ATTACHED_NODE, @@ -1525,11 +1525,11 @@ @BrowserFeature({CHROME, FF}) URL_AUTH_CREDENTIALS, - /** Replace only ' ' with %20 when encode the query part of an url. */ + /** Replace only ' ' with %20 when encode the query part of a url. */ @BrowserFeature(IE) URL_MINIMAL_QUERY_ENCODING, - /** */ + /** Handles missing slashes. */ @BrowserFeature({CHROME, FF}) URL_MISSING_SLASHES, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -438,7 +438,7 @@ } /** - * Convenient method to build an URL and load it into the current WebWindow as it would be done + * Convenient method to build a URL and load it into the current WebWindow as it would be done * by {@link #getPage(WebWindow, WebRequest)}. * @param url the URL of the new content * @param <P> the page type @@ -1226,7 +1226,7 @@ /** * Tries to guess the content type of the file.<br> - * This utility could be located in an helper class but we can compare this functionality + * This utility could be located in a helper class but we can compare this functionality * for instance with the "Helper Applications" settings of Mozilla and therefore see it as a * property of the "browser". * @param file the file Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -1196,7 +1196,7 @@ * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * Detach this node from all relationships with other nodes. - * This is the first step of an move. + * This is the first step of a move. */ protected void detach() { final DomNode exParent = parent_; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -1265,7 +1265,7 @@ * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * Detach this node from all relationships with other nodes. - * This is the first step of an move. + * This is the first step of a move. */ @Override protected void detach() { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -59,7 +59,7 @@ /** * @see com.gargoylesoftware.htmlunit.html.HtmlInput#asText() - * @return an empty string as an hidden field is not visible + * @return an empty string as hidden field is not visible */ // we need to preserve this method as it is there since many versions with the above documentation. @Override Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -1244,7 +1244,7 @@ final FrameWindow fw = (FrameWindow) window; final BaseFrameElement frame = fw.getFrameElement(); - // if part of an document fragment, then the load event is not triggered + // if part of a document fragment, then the load event is not triggered if (Event.TYPE_LOAD.equals(eventType) && frame.getParentNode() instanceof DomDocumentFragment) { return true; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -270,7 +270,7 @@ @Override public X509Certificate[] getAcceptedIssuers() { // it seems to be OK for Java <= 6 to return an empty array but not for Java 7 (at least 1.7.0_04-b20): - // requesting an URL with a valid certificate (working without WebClient.setUseInsecureSSL(true)) throws a + // requesting a URL with a valid certificate (working without WebClient.setUseInsecureSSL(true)) throws a // javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated // when the array returned here is empty if (acceptedIssuers_.isEmpty()) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -55,7 +55,7 @@ MalformedURLException malformedURLException); /** - * Informs about an exception during load of an javascript file refereed from a page. + * Informs about an exception during load of a javascript file refereed from a page. * * @param page the page that causes the problem * @param scriptUrl the url to load the script from Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -91,7 +91,7 @@ } /** - * Add an rect. + * Add a rect. * @param clientRect the rect to add */ public void add(final ClientRect clientRect) { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -41,7 +41,7 @@ } /** - * The URL.createObjectURL() static method creates a DOMString containing an URL + * The URL.createObjectURL() static method creates a DOMString containing a URL * representing the object given in parameter. * The URL lifetime is tied to the document in the window on which it was created. * The new object URL represents the specified File object or Blob object. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSMediaRule.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSMediaRule.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSMediaRule.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -64,8 +64,8 @@ } /** - * Returns the wrapped rule, as an media rule. - * @return the wrapped rule, as an media rule + * Returns the wrapped rule, as a media rule. + * @return the wrapped rule, as a media rule */ private org.w3c.dom.css.CSSMediaRule getMediaRule() { return (org.w3c.dom.css.CSSMediaRule) getRule(); Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSRule.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSRule.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSRule.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -246,7 +246,7 @@ } /** - * If this rule is contained inside another rule (e.g. a style rule inside an @media block), + * If this rule is contained inside another rule (e.g. a style rule inside a @media block), * this is the containing rule. If this rule is not nested inside any other rules, this returns {@code null}. * @return the parent rule */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -303,7 +303,7 @@ * Loads the stylesheet at the specified link or href. * @param window the current window * @param element the parent DOM element - * @param link the stylesheet's link (may be {@code null} if an <tt>url</tt> is specified) + * @param link the stylesheet's link (may be {@code null} if a <tt>url</tt> is specified) * @param url the stylesheet's url (may be {@code null} if a <tt>link</tt> is specified) * @return the loaded stylesheet */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet2.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet2.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet2.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -521,7 +521,7 @@ * Loads the stylesheet at the specified link or href. * @param window the current window * @param element the parent DOM element - * @param link the stylesheet's link (may be {@code null} if an <tt>url</tt> is specified) + * @param link the stylesheet's link (may be {@code null} if a <tt>url</tt> is specified) * @param url the stylesheet's url (may be {@code null} if a <tt>link</tt> is specified) * @return the loaded stylesheet */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -66,8 +66,8 @@ } /** - * Returns {@code true} if the attribute is an custom property. - * @return {@code true} if the attribute is an custom property + * Returns {@code true} if the attribute is a custom property. + * @return {@code true} if the attribute is a custom property */ @JsxGetter(IE) public boolean isExpando() { Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/performance/PerformanceTiming.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/performance/PerformanceTiming.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/performance/PerformanceTiming.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -153,7 +153,7 @@ } /** - * @return an redirectStart + * @return a redirectStart */ @JsxGetter public long getRedirectStart() { @@ -161,7 +161,7 @@ } /** - * @return an redirectEnd + * @return a redirectEnd */ @JsxGetter public long getRedirectEnd() { 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 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -379,7 +379,7 @@ } if (webResponse_ instanceof NetworkErrorWebResponse) { if (LOG.isDebugEnabled()) { - LOG.debug("XMLHttpRequest.responseXML returns of an network error (" + LOG.debug("XMLHttpRequest.responseXML returns of a network error (" + ((NetworkErrorWebResponse) webResponse_).getError() + ")"); } return null; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest2.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -228,7 +228,7 @@ } if (webResponse_ instanceof NetworkErrorWebResponse) { if (LOG.isDebugEnabled()) { - LOG.debug("XMLHttpRequest.responseXML returns of an network error (" + LOG.debug("XMLHttpRequest.responseXML returns of a network error (" + ((NetworkErrorWebResponse) webResponse_).getError() + ")"); } return null; Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/Cookie.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/Cookie.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/Cookie.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -232,7 +232,7 @@ } /** - * Converts the specified collection of cookies into an collection of HttpClient cookies. + * Converts the specified collection of cookies into a collection of HttpClient cookies. * @param cookies the cookies to be converted * @return the specified cookies, as HttpClient cookies */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -62,7 +62,7 @@ * In this example an overview page will be generated under the name myTest/index.html in the temp directory * and all received responses will be saved into the myTest folder.<br> * <br> - * <em>This class is only intended as an help during the conception.</em> + * <em>This class is only intended as a help during the conception.</em> * * @author Marc Guillemot * @author Ahmed Ashour Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient3Test.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -309,7 +309,7 @@ } /** - * Ensures, that a window opened by javascript and than filled by an form with target attribute + * Ensures, that a window opened by javascript and than filled by a form with target attribute * is attached to the javascript event loop. * * @throws Exception if an error occurs Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebTestCase.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -309,7 +309,7 @@ } /** - * Facility to test external form of an URL. + * Facility to test external form of a URL. * @param expectedUrl the string representation of the expected URL * @param actualUrl the URL to test */ @@ -343,7 +343,7 @@ } /** - * Facility to test external form of an URL. + * Facility to test external form of a URL. * @param message the message to display if assertion fails * @param expectedUrl the string representation of the expected URL * @param actualUrl the URL to test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParser2Test.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -117,7 +117,7 @@ } /** - * This tests for an bug in NekoHTML. + * This tests for a bug in NekoHTML. * @throws Exception on test failure */ @Test @@ -145,7 +145,7 @@ } /** - * This tests for an bug in NekoHTML. + * This tests for a bug in NekoHTML. * @throws Exception on test failure */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -172,7 +172,7 @@ } /** - * Test parsing of an fragment. + * Test parsing of a fragment. * @exception Exception If the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlElementTest.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -55,7 +55,7 @@ } /** - * Test hasAttribute() on an element with the attribute but without an value. + * Test hasAttribute() on an element with the attribute but without a value. * @throws Exception if the test fails */ @Test @@ -121,7 +121,7 @@ } /** - * Test getAttribute() on an element with the attribute but without an value. + * Test getAttribute() on an element with the attribute but without a value. * @throws Exception if the test fails */ @Test @@ -135,7 +135,7 @@ } /** - * Test getAttribute() on an element with the attribute but without an value. + * Test getAttribute() on an element with the attribute but without a value. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocketTest.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -245,7 +245,7 @@ for (final Thread thread : Thread.getAllStackTraces().keySet()) { if (thread.getName().contains("WebSocket")) { try { - // ok found one but let's wait a bit an start a second check before + // ok found one but let's wait a bit to start a second check before // pressing the panic button Thread.sleep(400); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2Test.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/Event2Test.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -308,7 +308,7 @@ } /** - * Test event order for typing into an password field. + * Test event order for typing into a password field. * @throws Exception if the test fails */ @Test @@ -323,7 +323,7 @@ } /** - * Test event order for typing into an password field. + * Test event order for typing into a password field. * @throws Exception if the test fails */ @Test Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocumentWriteTest.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -181,7 +181,7 @@ } /** - * Verifies that calling document.write() after document parsing has finished results in an whole + * Verifies that calling document.write() after document parsing has finished results in a whole * new page being loaded. * @throws Exception if an error occurs */ Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/ExtJS22Test.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -210,7 +210,7 @@ final WebDriver driver = getPage("grid", "binding"); // usually this need 1s but sometimes our build machine is slower - // this is not an performance test, we only like to ensure that all + // this is not a performance test, we only like to ensure that all // functionality is running Thread.sleep(2 * DEFAULT_WAIT_TIME); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/MooTools121Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/MooTools121Test.java 2017-07-20 08:10:47 UTC (rev 14675) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/MooTools121Test.java 2017-07-20 09:47:37 UTC (rev 14676) @@ -85,7 +85,7 @@ driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS); driver.findElement(By.xpath("id('progress')[text() = '100']")); // usually this need 40s but sometimes our build machine is slower - // this is not an performance test, we only like to ensure that all + // this is not a performance test, we only like to ensure that all // functionality is running final List<WebElement> failed = driver.findElements(By.xpath("//li[@class = 'exception']/h4")); |