[HtmlUnit] SVN: [15436] trunk/htmlunit/src
rbri--- via HtmlUnit-develop <[email protected]>
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 15436
http://sourceforge.net/p/htmlunit/code/15436
Author: rbri
Date: 2018-07-05 07:25:40 +0000 (Thu, 05 Jul 2018)
Log Message:
-----------
ff60 support (wip)
Modified Paths:
--------------
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-05 06:39:14 UTC (rev 15435)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2018-07-05 07:25:40 UTC (rev 15436)
@@ -900,9 +900,13 @@
JS_FILE_SHORT_DATE_FORMAT,
/** Indicates that the action property will not be expanded if defined as empty string. */
- @BrowserFeature(FF)
+ @BrowserFeature(FF52)
JS_FORM_ACTION_EXPANDURL_IGNORE_EMPTY,
+ /** Indicates that the action property will not be expanded if defined as empty string. */
+ @BrowserFeature({CHROME, FF60})
+ JS_FORM_ACTION_EXPANDURL_NOT_DEFINED,
+
/** form.dispatchEvent(e) submits the form if the event is of type 'submit'. */
@BrowserFeature(FF)
JS_FORM_DISPATCHEVENT_SUBMITS,
Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java 2018-07-05 06:39:14 UTC (rev 15435)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElement.java 2018-07-05 07:25:40 UTC (rev 15436)
@@ -18,6 +18,7 @@
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORMFIELD_REACHABLE_BY_ORIGINAL_NAME;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_ACTION_EXPANDURL_IGNORE_EMPTY;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_ACTION_EXPANDURL_NOT_DEFINED;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_DISPATCHEVENT_SUBMITS;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_REJECT_INVALID_ENCODING;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_FORM_SUBMIT_FORCES_DOWNLOAD;
@@ -34,7 +35,6 @@
import org.apache.commons.lang3.StringUtils;
-import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.FormEncodingType;
import com.gargoylesoftware.htmlunit.WebAssert;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -192,20 +192,25 @@
*/
@JsxGetter
public String getAction() {
- String action = getHtmlForm().getActionAttribute();
- final BrowserVersion browser = getBrowserVersion();
- if (action != DomElement.ATTRIBUTE_NOT_DEFINED) {
- if (action.length() == 0 && browser.hasFeature(JS_FORM_ACTION_EXPANDURL_IGNORE_EMPTY)) {
- return action;
- }
+ final String action = getHtmlForm().getActionAttribute();
- try {
- action = ((HtmlPage) getHtmlForm().getPage()).getFullyQualifiedUrl(action).toExternalForm();
- }
- catch (final MalformedURLException e) {
- // nothing, return action attribute
- }
+ if (action != DomElement.ATTRIBUTE_NOT_DEFINED
+ && action.length() == 0
+ && getBrowserVersion().hasFeature(JS_FORM_ACTION_EXPANDURL_IGNORE_EMPTY)) {
+ return action;
}
+
+ if (action == DomElement.ATTRIBUTE_NOT_DEFINED
+ && !getBrowserVersion().hasFeature(JS_FORM_ACTION_EXPANDURL_NOT_DEFINED)) {
+ return action;
+ }
+
+ try {
+ return ((HtmlPage) getHtmlForm().getPage()).getFullyQualifiedUrl(action).toExternalForm();
+ }
+ catch (final MalformedURLException e) {
+ // nothing, return action attribute
+ }
return action;
}
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2018-07-05 06:39:14 UTC (rev 15435)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2018-07-05 07:25:40 UTC (rev 15436)
@@ -16,6 +16,7 @@
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.CHROME;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF;
+import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF60;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -268,12 +269,13 @@
* @throws Exception if an error occurs
*/
@Test
+ @BuggyWebDriver(FF60)
public void clickNestedOptionElement() throws Exception {
final String html =
"<html>\n"
+ "<body>\n"
+ " <a href='page2.html'>\n"
- + " <select>\n"
+ + " <select size=2>\n"
+ " <option id='theOption'>test</option>\n"
+ " </select>\n"
+ " </a>\n"
@@ -284,6 +286,7 @@
final WebElement option = driver.findElement(By.id("theOption"));
assertEquals("option", option.getTagName());
option.click();
+
assertEquals(URL_FIRST + "page2.html", driver.getCurrentUrl());
}
@@ -371,6 +374,8 @@
final WebElement tester = driver.findElement(By.id("a"));
tester.click();
+
+ Thread.sleep(100);
assertEquals(2, driver.getWindowHandles().size());
}
@@ -691,6 +696,7 @@
.keyUp(Keys.SHIFT)
.perform();
+ Thread.sleep(100);
assertEquals("Should have opened a new window", windowsSize + 1, driver.getWindowHandles().size());
assertEquals("Should not have navigated away", originalTitle, driver.getTitle());
}
Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2018-07-05 06:39:14 UTC (rev 15435)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLFormElementTest.java 2018-07-05 07:25:40 UTC (rev 15436)
@@ -14,8 +14,6 @@
*/
package com.gargoylesoftware.htmlunit.javascript.host.html;
-import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.CHROME;
-import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.FF;
import static com.gargoylesoftware.htmlunit.BrowserRunner.TestedBrowser.IE;
import static org.junit.Assert.fail;
@@ -31,9 +29,9 @@
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import com.gargoylesoftware.htmlunit.BrowserRunner;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.BrowserRunner.Alerts;
import com.gargoylesoftware.htmlunit.BrowserRunner.NotYetImplemented;
+import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.MockWebConnection;
import com.gargoylesoftware.htmlunit.WebDriverTestCase;
@@ -532,7 +530,9 @@
* @throws Exception if the test fails
*/
@Test
- @Alerts("")
+ @Alerts(DEFAULT = "§§URL§§",
+ FF52 = "",
+ IE = "")
public void action() throws Exception {
final String html =
"<html>\n"
@@ -551,7 +551,7 @@
*/
@Test
@Alerts(DEFAULT = "§§URL§§",
- FF = "")
+ FF52 = "")
public void actionEmpty() throws Exception {
final String html =
"<html>\n"
@@ -1194,8 +1194,8 @@
*/
@Test
@Alerts(DEFAULT = {"", "foo4?foo=", "script4.js"},
- IE = {"", "foo0?foo=", "foo1?foo=", "foo2?foo=", "foo3?foo=", "foo4?foo=", "script4.js"})
- @NotYetImplemented({CHROME, FF})
+ IE = {"", "foo0?foo=", "foo4?foo=", "script4.js"})
+ @NotYetImplemented
public void submitTriggersRequestNotParsed() throws Exception {
final String html = "<html><head><script>\n"
+ "function test() {\n"
@@ -1205,10 +1205,12 @@
+ " f.submit();\n"
+ " }\n"
+ "}\n"
- + "</script></head><body onload='test()'>\n"
- + "<form>\n"
- + "<input name='foo'>\n"
- + "</form></body></html>";
+ + "</script></head>\n"
+ + "<body onload='test()'>\n"
+ + " <form>\n"
+ + " <input name='foo'>\n"
+ + " </form>\n"
+ + "</body></html>";
final MockWebConnection connection = getMockWebConnection();
for (int i = 0; i < 5; i++) {
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop