But keep in mind this now one still behaves like a FF78, only the stuff reported to the
+ *
But keep in mind this new one still behaves like a FF78, only the stuff reported to the
* outside is changed. This is more or less the same you can do with real browsers installing
* plugins like UserAgentSwitcher.
*
@@ -94,7 +94,7 @@ public final class BrowserVersion implements Serializable {
private static final String PLATFORM_WIN64 = "Win64";
/** Latest Firefox. */
- public static final BrowserVersion FIREFOX = new BrowserVersion(84, "FF");
+ public static final BrowserVersion FIREFOX = new BrowserVersion(88, "FF");
/** Firefox 78 ESR. */
public static final BrowserVersion FIREFOX_78 = new BrowserVersion(78, "FF78");
@@ -103,10 +103,10 @@ public final class BrowserVersion implements Serializable {
public static final BrowserVersion INTERNET_EXPLORER = new BrowserVersion(11, "IE");
/** Latest Edge */
- public static final BrowserVersion EDGE = new BrowserVersion(87, "Edge");
+ public static final BrowserVersion EDGE = new BrowserVersion(90, "Edge");
/** Latest Chrome. */
- public static final BrowserVersion CHROME = new BrowserVersion(87, "Chrome");
+ public static final BrowserVersion CHROME = new BrowserVersion(90, "Chrome");
/**
* Array with all supported browsers
@@ -212,9 +212,9 @@ public final class BrowserVersion implements Serializable {
// CHROME (Win10 64bit)
CHROME.applicationVersion_ = "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"
- + CHROME.getBrowserVersionNumeric() + ".0.4280.66 Safari/537.36";
+ + CHROME.getBrowserVersionNumeric() + ".0.4430.72 Safari/537.36";
CHROME.userAgent_ = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"
- + CHROME.getBrowserVersionNumeric() + ".0.4280.66 Safari/537.36";
+ + CHROME.getBrowserVersionNumeric() + ".0.4430.72 Safari/537.36";
CHROME.applicationCodeName_ = "Mozilla";
CHROME.vendor_ = "Google Inc.";
@@ -239,7 +239,7 @@ public final class BrowserVersion implements Serializable {
CHROME.htmlAcceptHeader_ = "text/html,application/xhtml+xml,application/xml;"
+ "q=0.9,image/avif,image/webp,image/apng,*/*;"
+ "q=0.8,application/signed-exchange;v=b3;q=0.9";
- CHROME.imgAcceptHeader_ = "image/avif,image/webp,image/apng,image/*,*/*;q=0.8";
+ CHROME.imgAcceptHeader_ = "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8";
CHROME.cssAcceptHeader_ = "text/css,*/*;q=0.1";
CHROME.scriptAcceptHeader_ = "*/*";
// there are other issues with Chrome; a different productSub, etc.
@@ -253,11 +253,11 @@ public final class BrowserVersion implements Serializable {
// EDGE (Win10 64bit)
EDGE.applicationVersion_ = "5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"
- + EDGE.getBrowserVersionNumeric() + ".0.4280.67 Safari/537.36 Edg/"
- + EDGE.getBrowserVersionNumeric() + ".0.664.47";
+ + EDGE.getBrowserVersionNumeric() + ".0.4430.72 Safari/537.36 Edg/"
+ + EDGE.getBrowserVersionNumeric() + ".0.818.41";
EDGE.userAgent_ = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/"
- + EDGE.getBrowserVersionNumeric() + ".0.4280.67 Safari/537.36 Edg/"
- + EDGE.getBrowserVersionNumeric() + ".0.664.47";
+ + EDGE.getBrowserVersionNumeric() + ".0.4430.72 Safari/537.36 Edg/"
+ + EDGE.getBrowserVersionNumeric() + ".0.818.41";
EDGE.applicationCodeName_ = "Mozilla";
EDGE.vendor_ = "Google Inc.";
@@ -282,7 +282,7 @@ public final class BrowserVersion implements Serializable {
EDGE.htmlAcceptHeader_ = "text/html,application/xhtml+xml,application/xml;"
+ "q=0.9,image/webp,image/apng,*/*;"
+ "q=0.8,application/signed-exchange;v=b3;q=0.9";
- EDGE.imgAcceptHeader_ = "image/webp,image/apng,image/*,*/*;q=0.8";
+ EDGE.imgAcceptHeader_ = "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8";
EDGE.cssAcceptHeader_ = "text/css,*/*;q=0.1";
EDGE.scriptAcceptHeader_ = "*/*";
// there are other issues with Chrome; a different productSub, etc.
@@ -427,7 +427,7 @@ public final class BrowserVersion implements Serializable {
// flush plugin (windows version)
final PluginConfiguration flash = new PluginConfiguration("Shockwave Flash",
- "Shockwave Flash 32.0 r0", "32.0.0.387", "Flash.ocx"); //NOPMD
+ "Shockwave Flash 32.0 r0", "32.0.0.445", "Flash.ocx"); //NOPMD
flash.getMimeTypes().add(new PluginConfiguration.MimeType("application/x-shockwave-flash",
"Shockwave Flash", "swf"));
INTERNET_EXPLORER.plugins_.add(flash);
@@ -988,6 +988,10 @@ public BrowserVersionBuilder setApplicationCodeName(final String applicationCode
}
/**
+ * Changes the browser language property. This is used for various output
+ * formating. If you like change the language the browser requests from the server
+ * you have to adjust the {@link #setAcceptLanguageHeader(String)}.
+ *
* @param browserLanguage the browserLanguage to set
* @return this for fluent use
*/
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java b/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
index d58104151..ab8074e31 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -278,7 +278,7 @@ public enum BrowserVersionFeatures {
FORM_PARAMETRS_NOT_SUPPORTED_FOR_IMAGE,
/** Form submit forces a real request also if only the hash was changed. */
- @BrowserFeature({CHROME, EDGE, FF})
+ @BrowserFeature({CHROME, EDGE, FF, FF78})
FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED,
/** Form submit takes care of fields outside the form linked to the form
@@ -302,6 +302,10 @@ public enum BrowserVersionFeatures {
@BrowserFeature(IE)
FORM_SUBMISSION_URL_WITHOUT_HASH,
+ /** If the frame src has 'about:' scheme use always 'about:blank' as source. */
+ @BrowserFeature({FF, FF78, IE})
+ FRAME_LOCATION_ABOUT_BLANK_FOR_ABOUT_SCHEME,
+
/** */
@BrowserFeature(IE)
HTMLABBREVIATED,
@@ -586,6 +590,10 @@ public enum BrowserVersionFeatures {
@BrowserFeature(IE)
JS_ANCHORS_REQUIRES_NAME_OR_ID,
+ /** The anchor hostname setter ignores blank url's. */
+ @BrowserFeature({FF, FF78})
+ JS_ANCHOR_HOSTNAME_IGNORE_BLANK,
+
/** The anchor pathname detects url's starting with one letter as file url's. */
@BrowserFeature({CHROME, EDGE, IE})
JS_ANCHOR_PATHNAME_DETECT_WIN_DRIVES_URL,
@@ -614,6 +622,10 @@ public enum BrowserVersionFeatures {
@BrowserFeature({FF, FF78})
JS_ANCHOR_PROTOCOL_HTTP_FOR_BROKEN_URL,
+ /** The anchor protocol property setter throws an error if the protocol is not valid. */
+ @BrowserFeature(IE)
+ JS_ANCHOR_PROTOCOL_INVALID_THROWS,
+
/** An area element without a href attribute is focusable. */
@BrowserFeature({FF, FF78})
JS_AREA_WITHOUT_HREF_FOCUSABLE,
@@ -702,10 +714,6 @@ public enum BrowserVersionFeatures {
@BrowserFeature(IE)
JS_DATE_WITH_LEFT_TO_RIGHT_MARK,
- /** */
- @BrowserFeature(IE)
- JS_DEFERRED,
-
/** Javascript doctyp.entities returns null (FF10). */
@BrowserFeature(IE)
JS_DOCTYPE_ENTITIES_NULL,
@@ -898,6 +906,14 @@ public enum BrowserVersionFeatures {
@BrowserFeature({FF, FF78})
JS_EVENT_DISTINGUISH_PRINTABLE_KEY,
+ /** Javascript InputEvent reads the inputType property from data. */
+ @BrowserFeature({FF, FF78})
+ JS_EVENT_INPUT_CTOR_INPUTTYPE,
+
+ /** Javascript KeyboardEvent reads the which property from data. */
+ @BrowserFeature({FF, FF78, IE})
+ JS_EVENT_KEYBOARD_CTOR_WHICH,
+
/** do not trigger the onload event if the frame content
* was not shown because of the csp. */
@BrowserFeature({FF, FF78})
@@ -1020,6 +1036,14 @@ public enum BrowserVersionFeatures {
@BrowserFeature({CHROME, EDGE, FF, FF78})
JS_INPUT_IGNORE_NEGATIVE_SELECTION_START,
+ /** FF accepts all chars. */
+ @BrowserFeature({FF, FF78, IE})
+ JS_INPUT_NUMBER_ACCEPT_ALL,
+
+ /** FF commat at end is not an integer. */
+ @BrowserFeature(FF)
+ JS_INPUT_NUMBER_DOT_AT_END_IS_DOUBLE,
+
/** Chrome/FF returns null for selectionStart/selectionEnd. */
@BrowserFeature({CHROME, EDGE, FF, FF78})
JS_INPUT_NUMBER_SELECTION_START_END_NULL,
@@ -1255,7 +1279,7 @@ public enum BrowserVersionFeatures {
JS_STORAGE_PRESERVED_INCLUDED,
/** Stylesheet list contains only active style sheets. */
- @BrowserFeature({CHROME, EDGE})
+ @BrowserFeature({CHROME, EDGE, FF})
JS_STYLESHEETLIST_ACTIVE_ONLY,
/** IE supports accessing unsupported style elements via getter
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/Cache.java b/src/main/java/com/gargoylesoftware/htmlunit/Cache.java
index 879b88665..d794a2803 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/Cache.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/Cache.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -217,7 +217,7 @@ protected void deleteOverflow() {
*/
protected boolean isCacheable(final WebRequest request, final WebResponse response) {
return HttpMethod.GET == response.getWebRequest().getHttpMethod()
- && WebClient.URL_ABOUT_BLANK != request.getUrl()
+ && UrlUtils.URL_ABOUT_BLANK != request.getUrl()
&& isCacheableContent(response);
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/CollectingAlertHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/CollectingAlertHandler.java
index e39d9c4b0..dda937aae 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/CollectingAlertHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/CollectingAlertHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ConfirmHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/ConfirmHandler.java
index daa78002a..a7478b072 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ConfirmHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ConfirmHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/CookieManager.java b/src/main/java/com/gargoylesoftware/htmlunit/CookieManager.java
index 8ff31596c..2a9e045a9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/CookieManager.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/CookieManager.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/DefaultCredentialsProvider.java b/src/main/java/com/gargoylesoftware/htmlunit/DefaultCredentialsProvider.java
index fffc9a101..da42a1cef 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/DefaultCredentialsProvider.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/DefaultCredentialsProvider.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/DefaultCssErrorHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/DefaultCssErrorHandler.java
index 2cc45c9b4..1af7defb8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/DefaultCssErrorHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/DefaultCssErrorHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java b/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java
index 2de69b461..84e2782ef 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/DefaultPageCreator.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -82,6 +82,12 @@ public class DefaultPageCreator implements PageCreator, Serializable {
private static final byte[] markerUTF16BE_ = {(byte) 0xfe, (byte) 0xff};
private static final byte[] markerUTF16LE_ = {(byte) 0xff, (byte) 0xfe};
+ /**
+ * See http://tools.ietf.org/html/draft-abarth-mime-sniff-05
+ */
+ private static final String[] htmlPatterns = {"!DOCTYPE HTML", "HTML", "HEAD", "SCRIPT",
+ "IFRAME", "H1", "DIV", "FONT", "TABLE", "A", "STYLE", "TITLE", "B", "BODY", "BR", "P", "!--" };
+
private static final HTMLParser htmlParser_ = new HtmlUnitNekoHtmlParser();
/**
@@ -110,7 +116,8 @@ public static PageType determinePageType(final String contentType) {
return PageType.UNKNOWN;
}
- switch (contentType) {
+ final String contentTypeLC = contentType.toLowerCase(Locale.ROOT);
+ switch (contentTypeLC) {
case MimeType.TEXT_HTML:
case "image/svg+xml":
return PageType.HTML;
@@ -126,11 +133,11 @@ public static PageType determinePageType(final String contentType) {
return PageType.XML;
default:
- if (contentType.endsWith("+xml")) {
+ if (contentTypeLC.endsWith("+xml")) {
return PageType.XML;
}
- if (contentType.startsWith("text/")) {
+ if (contentTypeLC.startsWith("text/")) {
return PageType.TEXT;
}
@@ -138,6 +145,54 @@ public static PageType determinePageType(final String contentType) {
}
}
+ /**
+ * Determines the kind of page to create from the content type.
+ * @param webResponse the response to investigate
+ * @exception IOException if an IO problem occurs
+ * @return "xml", "html", "javascript", "text" or "unknown"
+ */
+ public static PageType determinePageType(final WebResponse webResponse) throws IOException {
+ final String contentType = webResponse.getContentType();
+ if (!StringUtils.isEmpty(contentType)) {
+ return determinePageType(contentType);
+ }
+
+ // sniff - http://tools.ietf.org/html/draft-abarth-mime-sniff-05
+ try (InputStream contentAsStream = webResponse.getContentAsStream()) {
+ final byte[] bytes = read(contentAsStream, 512);
+ if (bytes.length == 0) {
+ return determinePageType(MimeType.TEXT_PLAIN);
+ }
+
+ if (startsWith(bytes, markerUTF8_) || startsWith(bytes, markerUTF16BE_)
+ || startsWith(bytes, markerUTF16LE_)) {
+ return determinePageType(MimeType.TEXT_PLAIN);
+ }
+
+ if (isBinary(bytes)) {
+ return determinePageType(MimeType.APPLICATION_OCTET_STREAM);
+ }
+
+ final String asAsciiString = new String(bytes, "ASCII").trim().toUpperCase(Locale.ROOT);
+ for (final String htmlPattern : htmlPatterns) {
+ try {
+ if ('<' == asAsciiString.charAt(0)) {
+ if (asAsciiString.startsWith(htmlPattern, 1)) {
+ final char spaceOrBracket = asAsciiString.charAt(htmlPattern.length() + 1);
+ if (' ' == spaceOrBracket || '>' == spaceOrBracket) {
+ return determinePageType(MimeType.TEXT_HTML);
+ }
+ }
+ }
+ }
+ catch (final ArrayIndexOutOfBoundsException e) {
+ // ignore and try next
+ }
+ }
+ }
+ return determinePageType(MimeType.TEXT_PLAIN);
+ }
+
/**
* Creates an instance.
*/
@@ -155,9 +210,7 @@ public DefaultPageCreator() {
*/
@Override
public Page createPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException {
- final String contentType = determineContentType(webResponse);
-
- final PageType pageType = determinePageType(contentType);
+ final PageType pageType = determinePageType(webResponse);
switch (pageType) {
case HTML:
return createHtmlPage(webResponse, webWindow);
@@ -181,46 +234,6 @@ public Page createPage(final WebResponse webResponse, final WebWindow webWindow)
}
}
- /**
- * Tries to determine the content type.
- * TODO: implement a content type sniffer based on the
- * Content-Type Processing Model
- * @param webResponse the response from the server
- * @return the sniffed mime type
- * @exception IOException if an IO problem occurs
- */
- private static String determineContentType(final WebResponse webResponse)
- throws IOException {
-
- final String contentType = webResponse.getContentType();
- if (!StringUtils.isEmpty(contentType)) {
- return contentType.toLowerCase(Locale.ROOT);
- }
-
- try (InputStream contentAsStream = webResponse.getContentAsStream()) {
- final byte[] bytes = read(contentAsStream, 500);
- if (bytes.length == 0) {
- return MimeType.TEXT_PLAIN;
- }
-
- final String asAsciiString = new String(bytes, "ASCII").toUpperCase(Locale.ROOT);
- if (asAsciiString.contains("")) {
- return MimeType.APPLICATION_JAVASCRIPT;
- }
- else if (isBinary(bytes)) {
- return MimeType.APPLICATION_OCTET_STREAM;
- }
- }
- return MimeType.TEXT_PLAIN;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java b/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java
index 037528872..0a40bcc7d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/DialogWindow.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/DownloadedContent.java b/src/main/java/com/gargoylesoftware/htmlunit/DownloadedContent.java
index e57f53edc..a2a9d5c1a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/DownloadedContent.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/DownloadedContent.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ElementNotFoundException.java b/src/main/java/com/gargoylesoftware/htmlunit/ElementNotFoundException.java
index 73472a97d..65d7fa989 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ElementNotFoundException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ElementNotFoundException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeException.java b/src/main/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeException.java
index 2f982e991..ca7da9f6f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/FormEncodingType.java b/src/main/java/com/gargoylesoftware/htmlunit/FormEncodingType.java
index 2c46fd40a..340f2e26e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/FormEncodingType.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/FormEncodingType.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/FrameContentHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/FrameContentHandler.java
index 410ef4d09..91eebef92 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/FrameContentHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/FrameContentHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/History.java b/src/main/java/com/gargoylesoftware/htmlunit/History.java
index c6bd6091e..798d9179d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/History.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/History.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/HttpHeader.java b/src/main/java/com/gargoylesoftware/htmlunit/HttpHeader.java
index 18c507ad6..41ac4710b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/HttpHeader.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/HttpHeader.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/HttpMethod.java b/src/main/java/com/gargoylesoftware/htmlunit/HttpMethod.java
index fa66f95dc..ed67e25a8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/HttpMethod.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/HttpMethod.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java b/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
index 61979557b..54be6f3ef 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -255,16 +255,17 @@ private void setProxy(final HttpRequestBase httpRequest, final WebRequest webReq
if (webRequest.getProxyHost() == null) {
requestBuilder.setProxy(null);
httpRequest.setConfig(requestBuilder.build());
+ return;
+ }
+
+ final HttpHost proxy = new HttpHost(webRequest.getProxyHost(),
+ webRequest.getProxyPort(), webRequest.getProxyScheme());
+ if (webRequest.isSocksProxy()) {
+ SocksConnectionSocketFactory.setSocksProxy(getHttpContext(), proxy);
}
else {
- final HttpHost proxy = new HttpHost(webRequest.getProxyHost(), webRequest.getProxyPort());
- if (webRequest.isSocksProxy()) {
- SocksConnectionSocketFactory.setSocksProxy(getHttpContext(), proxy);
- }
- else {
- requestBuilder.setProxy(proxy);
- httpRequest.setConfig(requestBuilder.build());
- }
+ requestBuilder.setProxy(proxy);
+ httpRequest.setConfig(requestBuilder.build());
}
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ImmediateRefreshHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/ImmediateRefreshHandler.java
index 500a1bc1f..b5ef36c40 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ImmediateRefreshHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ImmediateRefreshHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListener.java b/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListener.java
index 86e575816..0ba0deb81 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListenerImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListenerImpl.java
index 421f77f0a..79d36988b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListenerImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/IncorrectnessListenerImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/MockWebConnection.java b/src/main/java/com/gargoylesoftware/htmlunit/MockWebConnection.java
index c97039473..8dc4aa113 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/MockWebConnection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/MockWebConnection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/NiceRefreshHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/NiceRefreshHandler.java
index 8c873cbff..d7b58f3d8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/NiceRefreshHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/NiceRefreshHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/NicelyResynchronizingAjaxController.java b/src/main/java/com/gargoylesoftware/htmlunit/NicelyResynchronizingAjaxController.java
index 6b0b262ef..08fcd9128 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/NicelyResynchronizingAjaxController.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/NicelyResynchronizingAjaxController.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/NotYetImplementedException.java b/src/main/java/com/gargoylesoftware/htmlunit/NotYetImplementedException.java
index 71e7e247c..3da181f64 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/NotYetImplementedException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/NotYetImplementedException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ObjectInstantiationException.java b/src/main/java/com/gargoylesoftware/htmlunit/ObjectInstantiationException.java
index b14434e73..9e5a684aa 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ObjectInstantiationException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ObjectInstantiationException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/OnbeforeunloadHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/OnbeforeunloadHandler.java
index 9fd6c2bd9..878ebec47 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/OnbeforeunloadHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/OnbeforeunloadHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/Page.java b/src/main/java/com/gargoylesoftware/htmlunit/Page.java
index e7eedd046..b94e835ce 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/Page.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/Page.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/PageCreator.java b/src/main/java/com/gargoylesoftware/htmlunit/PageCreator.java
index 1bb934394..c4a3cec82 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/PageCreator.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/PageCreator.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/PluginConfiguration.java b/src/main/java/com/gargoylesoftware/htmlunit/PluginConfiguration.java
index f0eac54a9..575bf7f0c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/PluginConfiguration.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/PluginConfiguration.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/PromptHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/PromptHandler.java
index b7261af8c..45db71d29 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/PromptHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/PromptHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ProxyAutoConfig.java b/src/main/java/com/gargoylesoftware/htmlunit/ProxyAutoConfig.java
index 5c415ea46..69cd8944d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ProxyAutoConfig.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ProxyAutoConfig.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -52,8 +52,7 @@ private ProxyAutoConfig() {
* @return semicolon-separated result
*/
public static String evaluate(final String content, final URL url) {
- final Context cx = Context.enter();
- try {
+ try (Context cx = Context.enter()) {
final ProxyAutoConfig config = new ProxyAutoConfig();
final Scriptable scope = cx.initSafeStandardObjects();
@@ -79,9 +78,6 @@ public static String evaluate(final String content, final URL url) {
final Object result = f.call(cx, scope, scope, functionArgs);
return Context.toString(result);
}
- finally {
- Context.exit();
- }
}
private void defineMethod(final String methodName, final Scriptable scope) {
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ProxyConfig.java b/src/main/java/com/gargoylesoftware/htmlunit/ProxyConfig.java
index 1fed09369..9f4dadc68 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ProxyConfig.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ProxyConfig.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -24,12 +24,14 @@
* class. One instance of this class exists for each WebClient instance.
*
* @author Daniel Gredler
+ * @author Ronald Brill
* @see WebClientOptions#getProxyConfig()
*/
public class ProxyConfig implements Serializable {
private String proxyHost_;
private int proxyPort_;
+ private String proxyScheme_;
private boolean isSocksProxy_;
private final Map proxyBypassHosts_ = new HashMap<>();
private String proxyAutoConfigUrl_;
@@ -39,27 +41,30 @@ public class ProxyConfig implements Serializable {
* Creates a new instance.
*/
public ProxyConfig() {
- this(null, 0);
+ this(null, 0, null, false);
}
/**
* Creates a new instance.
* @param proxyHost the proxy host
* @param proxyPort the proxy port
+ * @param proxyScheme the scheme http/https; null defaults to http
*/
- public ProxyConfig(final String proxyHost, final int proxyPort) {
- this(proxyHost, proxyPort, false);
+ public ProxyConfig(final String proxyHost, final int proxyPort, final String proxyScheme) {
+ this(proxyHost, proxyPort, proxyScheme, false);
}
/**
* Creates a new instance.
* @param proxyHost the proxy host
* @param proxyPort the proxy port
+ * @param proxyScheme the scheme http/https
* @param isSocks whether SOCKS proxy or not
*/
- public ProxyConfig(final String proxyHost, final int proxyPort, final boolean isSocks) {
+ public ProxyConfig(final String proxyHost, final int proxyPort, final String proxyScheme, final boolean isSocks) {
proxyHost_ = proxyHost;
proxyPort_ = proxyPort;
+ proxyScheme_ = proxyScheme;
isSocksProxy_ = isSocks;
}
@@ -95,6 +100,22 @@ public void setProxyPort(final int proxyPort) {
proxyPort_ = proxyPort;
}
+ /**
+ * Returns the proxy scheme used to perform HTTP requests.
+ * @return the proxy scheme used to perform HTTP requests
+ */
+ public String getProxyScheme() {
+ return proxyScheme_;
+ }
+
+ /**
+ * Sets the proxy scheme used to perform HTTP requests.
+ * @param proxyScheme the proxy scheme used to perform HTTP requests
+ */
+ public void setProxyPort(final String proxyScheme) {
+ proxyScheme_ = proxyScheme;
+ }
+
/**
* Returns whether SOCKS proxy or not.
* @return whether SOCKS proxy or not
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/RefreshHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/RefreshHandler.java
index 61004f310..e1f123604 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/RefreshHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/RefreshHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java b/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java
index 4409528db..6e746c748 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ScriptException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ScriptPreProcessor.java b/src/main/java/com/gargoylesoftware/htmlunit/ScriptPreProcessor.java
index 27a9758bb..fe4b4155e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ScriptPreProcessor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ScriptPreProcessor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java b/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java
index 4b5048df1..0f74ef701 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ScriptResult.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java b/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java
index d781f2c65..9e1c73a5e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/SgmlPage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -42,6 +42,7 @@
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.DomText;
import com.gargoylesoftware.htmlunit.html.DomTreeWalker;
+import com.gargoylesoftware.htmlunit.util.UrlUtils;
/**
* A basic class of Standard Generalized Markup Language (SGML), e.g. HTML and XML.
@@ -270,7 +271,7 @@ public DomAttr createAttribute(final String name) {
public URL getUrl() {
final WebResponse wr = getWebResponse();
if (null == wr) {
- return WebClient.URL_ABOUT_BLANK;
+ return UrlUtils.URL_ABOUT_BLANK;
}
return getWebResponse().getWebRequest().getUrl();
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/SilentCssErrorHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/SilentCssErrorHandler.java
index 649048103..fd4066aa6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/SilentCssErrorHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/SilentCssErrorHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/StatusHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/StatusHandler.java
index 9496fe411..d747437f9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/StatusHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/StatusHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/StorageHolder.java b/src/main/java/com/gargoylesoftware/htmlunit/StorageHolder.java
index be77754e9..4716615b5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/StorageHolder.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/StorageHolder.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java b/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java
index fafd5c598..d2d4bdb6e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/StringWebResponse.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/TextPage.java b/src/main/java/com/gargoylesoftware/htmlunit/TextPage.java
index 176c3ac2b..936507909 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/TextPage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/TextPage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/ThreadedRefreshHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/ThreadedRefreshHandler.java
index 1d2530052..c64d8f024 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/ThreadedRefreshHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/ThreadedRefreshHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/TopLevelWindow.java b/src/main/java/com/gargoylesoftware/htmlunit/TopLevelWindow.java
index 59aa331d9..b3a0a760e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/TopLevelWindow.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/TopLevelWindow.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -18,6 +18,7 @@
import org.apache.commons.logging.LogFactory;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.util.UrlUtils;
/**
* A window representing a top level browser window.
@@ -72,7 +73,7 @@ public WebWindow getTopWindow() {
@Override
protected boolean isJavaScriptInitializationNeeded(final Page page) {
return getScriptableObject() == null
- || page.getUrl() == WebClient.URL_ABOUT_BLANK
+ || page.getUrl() == UrlUtils.URL_ABOUT_BLANK
|| !(page.getWebResponse() instanceof StringWebResponse);
// TODO: find a better way to distinguish content written by document.open(),...
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/UnexpectedPage.java b/src/main/java/com/gargoylesoftware/htmlunit/UnexpectedPage.java
index 9c69e168b..6d724a725 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/UnexpectedPage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/UnexpectedPage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/Version.java b/src/main/java/com/gargoylesoftware/htmlunit/Version.java
index 2ecf1c878..ee7dde6ef 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/Version.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/Version.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WaitingRefreshHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/WaitingRefreshHandler.java
index 70dcb37d8..e898e6741 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WaitingRefreshHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WaitingRefreshHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebAssert.java b/src/main/java/com/gargoylesoftware/htmlunit/WebAssert.java
index d17e2984c..cfacd3fd7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebAssert.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebAssert.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java b/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
index 6ad9ba619..707ba8d74 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -82,6 +82,8 @@
import com.gargoylesoftware.htmlunit.html.FrameWindow.PageDenied;
import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.XHtmlPage;
+import com.gargoylesoftware.htmlunit.html.parser.HTMLParser;
import com.gargoylesoftware.htmlunit.html.parser.HTMLParserListener;
import com.gargoylesoftware.htmlunit.httpclient.HtmlUnitBrowserCompatCookieSpec;
import com.gargoylesoftware.htmlunit.javascript.AbstractJavaScriptEngine;
@@ -198,20 +200,36 @@ public class WebClient implements Serializable, AutoCloseable {
private Cache cache_ = new Cache();
/** target "_blank". */
- private static final String TARGET_BLANK = "_blank";
- /** target "_parent". */
- private static final String TARGET_SELF = "_self";
+ public static final String TARGET_BLANK = "_blank";
+
+ /** target "_self". */
+ public static final String TARGET_SELF = "_self";
+
/** target "_parent". */
private static final String TARGET_PARENT = "_parent";
/** target "_top". */
private static final String TARGET_TOP = "_top";
- /** "about:". */
- public static final String ABOUT_SCHEME = "about:";
- /** "about:blank". */
- public static final String ABOUT_BLANK = ABOUT_SCHEME + "blank";
- /** URL for "about:blank". */
- public static final URL URL_ABOUT_BLANK = UrlUtils.toUrlSafe(ABOUT_BLANK);
+ /**
+ * "about:".
+ * @deprecated as of version 2.47.0; use UrlUtils.ABOUT_BLANK instead
+ */
+ @Deprecated
+ public static final String ABOUT_SCHEME = UrlUtils.ABOUT_SCHEME;
+
+ /**
+ * "about:blank".
+ * @deprecated as of version 2.47.0; use UrlUtils.ABOUT_BLANK instead
+ */
+ @Deprecated
+ public static final String ABOUT_BLANK = UrlUtils.ABOUT_BLANK;
+
+ /**
+ * URL for "about:blank".
+ * @deprecated as of version 2.47.0; use UrlUtils.URL_ABOUT_BLANK instead
+ */
+ @Deprecated
+ public static final URL URL_ABOUT_BLANK = UrlUtils.URL_ABOUT_BLANK;
private ScriptPreProcessor scriptPreProcessor_;
@@ -248,7 +266,19 @@ public WebClient(final BrowserVersion browserVersion) {
* @param proxyPort the port to use on the proxy server
*/
public WebClient(final BrowserVersion browserVersion, final String proxyHost, final int proxyPort) {
- this(browserVersion, true, proxyHost, proxyPort);
+ this(browserVersion, true, proxyHost, proxyPort, null);
+ }
+
+ /**
+ * Creates an instance that will use the specified {@link BrowserVersion} and proxy server.
+ * @param browserVersion the browser version to simulate
+ * @param proxyHost the server that will act as proxy or null for no proxy
+ * @param proxyPort the port to use on the proxy server
+ * @param proxyScheme the scheme http/https
+ */
+ public WebClient(final BrowserVersion browserVersion,
+ final String proxyHost, final int proxyPort, final String proxyScheme) {
+ this(browserVersion, true, proxyHost, proxyPort, proxyScheme);
}
/**
@@ -260,6 +290,19 @@ public WebClient(final BrowserVersion browserVersion, final String proxyHost, fi
*/
public WebClient(final BrowserVersion browserVersion, final boolean javaScriptEngineEnabled,
final String proxyHost, final int proxyPort) {
+ this(browserVersion, javaScriptEngineEnabled, proxyHost, proxyPort, null);
+ }
+
+ /**
+ * Creates an instance that will use the specified {@link BrowserVersion} and proxy server.
+ * @param browserVersion the browser version to simulate
+ * @param javaScriptEngineEnabled set to false if the simulated browser should not support javaScript
+ * @param proxyHost the server that will act as proxy or null for no proxy
+ * @param proxyPort the port to use on the proxy server
+ * @param proxyScheme the scheme http/https
+ */
+ public WebClient(final BrowserVersion browserVersion, final boolean javaScriptEngineEnabled,
+ final String proxyHost, final int proxyPort, final String proxyScheme) {
WebAssert.notNull("browserVersion", browserVersion);
browserVersion_ = browserVersion;
@@ -269,7 +312,7 @@ public WebClient(final BrowserVersion browserVersion, final boolean javaScriptEn
getOptions().setProxyConfig(new ProxyConfig());
}
else {
- getOptions().setProxyConfig(new ProxyConfig(proxyHost, proxyPort));
+ getOptions().setProxyConfig(new ProxyConfig(proxyHost, proxyPort, proxyScheme));
}
webConnection_ = new HttpWebConnection(this); // this has to be done after the browser version was set
@@ -467,28 +510,6 @@
P getPage(final WebWindow webWindow, final WebRequest webReques
return (P) webWindow.getEnclosedPage();
}
- /**
- * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
- *
- *
Open a new web window and populate it with a page loaded by
- * {@link #getPage(WebWindow,WebRequest)}
- *
- * @param opener the web window that initiated the request
- * @param target the name of the window to be opened (the name that will be passed into the
- * JavaScript open() method)
- * @param params any parameters
- * @param
the page type
- * @return the new page
- * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
- * {@link WebClientOptions#setThrowExceptionOnFailingStatusCode(boolean)} is set to true.
- * @throws IOException if an IO problem occurs
- */
- @SuppressWarnings("unchecked")
- public
P getPage(final WebWindow opener, final String target, final WebRequest params)
- throws FailingHttpStatusCodeException, IOException {
- return (P) getPage(openTargetWindow(opener, target, TARGET_SELF), params);
- }
-
/**
* Convenient method to build a URL and load it into the current WebWindow as it would be done
* by {@link #getPage(WebWindow, WebRequest)}.
@@ -560,7 +581,33 @@ public
P getPage(final WebRequest request) throws IOException,
*/
public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow webWindow)
throws IOException, FailingHttpStatusCodeException {
+ return loadWebResponseInto(webResponse, webWindow, false);
+ }
+ /**
+ * INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
+ *
+ *
Creates a page based on the specified response and inserts it into the specified window. All page
+ * initialization and event notification is handled here.
+ *
+ *
Note that if the page created is an attachment page, and an {@link AttachmentHandler} has been
+ * registered with this client, the page is not loaded into the specified window; in this case,
+ * the page is loaded into a new window, and attachment handling is delegated to the registered
+ * AttachmentHandler.
+ *
+ * @param webResponse the response that will be used to create the new page
+ * @param webWindow the window that the new page will be placed within
+ * @param forceAttachment handle this as attachment (is set to true if the call was triggered from
+ * anchor with download property set).
+ * @throws IOException if an IO error occurs
+ * @throws FailingHttpStatusCodeException if the server returns a failing status code AND the property
+ * {@link WebClientOptions#setThrowExceptionOnFailingStatusCode(boolean)} is set to true
+ * @return the newly created page
+ * @see #setAttachmentHandler(AttachmentHandler)
+ */
+ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow webWindow,
+ final boolean forceAttachment)
+ throws IOException, FailingHttpStatusCodeException {
WebAssert.notNull("webResponse", webResponse);
WebAssert.notNull("webWindow", webWindow);
@@ -573,7 +620,8 @@ public Page loadWebResponseInto(final WebResponse webResponse, final WebWindow w
return webWindow.getEnclosedPage();
}
- if (attachmentHandler_ != null && attachmentHandler_.isAttachment(webResponse)) {
+ if (attachmentHandler_ != null
+ && (forceAttachment || attachmentHandler_.isAttachment(webResponse))) {
if (attachmentHandler_.handleAttachment(webResponse)) {
// the handling is done by the attachment handler;
// do not open a new window
@@ -1024,8 +1072,7 @@ public WebWindow openWindow(final URL url, final String windowName, final WebWin
if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER)
&& openerPage != null
&& openerPage.getUrl() != null) {
- final String referer = openerPage.getUrl().toExternalForm();
- request.setAdditionalHeader(HttpHeader.REFERER, referer);
+ request.setRefererlHeader(openerPage.getUrl());
}
getPage(window, request);
}
@@ -1153,8 +1200,7 @@ public DialogWindow openDialogWindow(final URL url, final WebWindow opener, fina
request.setCharset(UTF_8);
if (getBrowserVersion().hasFeature(DIALOGWINDOW_REFERER) && openerPage != null) {
- final String referer = openerPage.getUrl().toExternalForm();
- request.setAdditionalHeader(HttpHeader.REFERER, referer);
+ request.setRefererlHeader(openerPage.getUrl());
}
getPage(window, request);
@@ -1303,11 +1349,16 @@ private WebResponse makeWebResponseForDataUrl(final WebRequest webRequest) throw
private static WebResponse makeWebResponseForAboutUrl(final WebRequest webRequest) throws MalformedURLException {
final URL url = webRequest.getUrl();
- final String urlWithoutQuery = StringUtils.substringBefore(url.toExternalForm(), "?");
- if (!"blank".equalsIgnoreCase(StringUtils.substringAfter(urlWithoutQuery, WebClient.ABOUT_SCHEME))) {
- throw new MalformedURLException(url + " is not supported, only about:blank is supported now.");
+ final String urlString = url.toExternalForm();
+ if (UrlUtils.ABOUT_BLANK.equalsIgnoreCase(urlString)) {
+ return new StringWebResponse("", UrlUtils.URL_ABOUT_BLANK);
+ }
+
+ final String urlWithoutQuery = StringUtils.substringBefore(urlString, "?");
+ if (!"blank".equalsIgnoreCase(StringUtils.substringAfter(urlWithoutQuery, UrlUtils.ABOUT_SCHEME))) {
+ throw new MalformedURLException(url + " is not supported, only about:blank is supported at the moment.");
}
- return new StringWebResponse("", URL_ABOUT_BLANK);
+ return new StringWebResponse("", url);
}
/**
@@ -1438,7 +1489,7 @@ private WebResponse makeWebResponseForJavaScriptUrl(final WebWindow webWindow, f
*/
public WebResponse loadWebResponse(final WebRequest webRequest) throws IOException {
switch (webRequest.getUrl().getProtocol()) {
- case "about":
+ case UrlUtils.ABOUT:
return makeWebResponseForAboutUrl(webRequest);
case "file":
@@ -1514,6 +1565,7 @@ else if (value.startsWith("SOCKS")) {
else if (!proxyConfig.shouldBypassProxy(webRequest.getUrl().getHost())) {
webRequest.setProxyHost(proxyConfig.getProxyHost());
webRequest.setProxyPort(proxyConfig.getProxyPort());
+ webRequest.setProxyScheme(proxyConfig.getProxyScheme());
webRequest.setSocksProxy(proxyConfig.isSocksProxy());
}
}
@@ -2037,7 +2089,7 @@ else if (window instanceof FrameWindow) {
final FrameWindow fw = (FrameWindow) window;
final String enclosingPageState = fw.getEnclosingPage().getDocumentElement().getReadyState();
final URL frameUrl = fw.getEnclosedPage().getUrl();
- if (!DomNode.READY_STATE_COMPLETE.equals(enclosingPageState) || frameUrl == URL_ABOUT_BLANK) {
+ if (!DomNode.READY_STATE_COMPLETE.equals(enclosingPageState) || frameUrl == UrlUtils.URL_ABOUT_BLANK) {
return;
}
@@ -2280,14 +2332,18 @@ private static class LoadJob {
private final WebResponse response_;
private final WeakReference originalPage_;
private final WebRequest request_;
+ private final boolean forceAttachment_;
- LoadJob(final WebRequest request, final WebWindow requestingWindow, final String target,
- final WebResponse response) {
+ // we can't us the WebRequest from the WebResponse because
+ // we need the original request e.g. after a redirect
+ LoadJob(final WebRequest request, final WebResponse response,
+ final WebWindow requestingWindow, final String target, final boolean forceAttachment) {
request_ = request;
requestingWindow_ = requestingWindow;
target_ = target;
response_ = response;
originalPage_ = new WeakReference<>(requestingWindow.getEnclosedPage());
+ forceAttachment_ = forceAttachment;
}
public boolean isOutdated() {
@@ -2318,10 +2374,14 @@ public boolean isOutdated() {
* @param request the request to perform
* @param checkHash if true check for hashChenage
* @param forceLoad if true always load the request even if there is already the same in the queue
+ * @param forceAttachment if true the AttachmentHandler isAttachment() method is not called, the
+ * response has to be handled as attachment in any case
* @param description information about the origin of the request. Useful for debugging.
*/
public void download(final WebWindow requestingWindow, final String target,
- final WebRequest request, final boolean checkHash, final boolean forceLoad, final String description) {
+ final WebRequest request, final boolean checkHash, final boolean forceLoad,
+ final boolean forceAttachment, final String description) {
+
final WebWindow targetWindow = resolveWindow(requestingWindow, target);
final URL url = request.getUrl();
boolean justHashJump = false;
@@ -2350,11 +2410,11 @@ public void download(final WebWindow requestingWindow, final String target,
synchronized (loadQueue_) {
// verify if this load job doesn't already exist
- for (final LoadJob loadJob : loadQueue_) {
- if (loadJob.response_ == null) {
+ for (final LoadJob otherLoadJob : loadQueue_) {
+ if (otherLoadJob.response_ == null) {
continue;
}
- final WebRequest otherRequest = loadJob.request_;
+ final WebRequest otherRequest = otherLoadJob.request_;
final URL otherUrl = otherRequest.getUrl();
// TODO: investigate but it seems that IE considers query string too but not FF
@@ -2378,7 +2438,7 @@ public void download(final WebWindow requestingWindow, final String target,
LOG.error("NoHttpResponseException while downloading; generating a NoHttpResponse", e);
response = new WebResponse(RESPONSE_DATA_NO_HTTP_RESPONSE, request, 0);
}
- loadJob = new LoadJob(request, requestingWindow, target, response);
+ loadJob = new LoadJob(request, response, requestingWindow, target, forceAttachment);
}
catch (final IOException e) {
throw new RuntimeException(e);
@@ -2428,9 +2488,9 @@ public void loadDownloadedResponses() throws FailingHttpStatusCodeException, IOE
continue;
}
- final WebWindow win = openTargetWindow(loadJob.requestingWindow_, loadJob.target_, "_self");
+ final WebWindow win = openTargetWindow(loadJob.requestingWindow_, loadJob.target_, TARGET_SELF);
final Page pageBeforeLoad = win.getEnclosedPage();
- loadWebResponseInto(loadJob.response_, win);
+ loadWebResponseInto(loadJob.response_, win, loadJob.forceAttachment_);
// start execution here.
if (scriptEngine_ != null) {
@@ -2605,4 +2665,46 @@ public boolean isJavaScriptEnabled() {
public boolean isJavaScriptEngineEnabled() {
return javaScriptEngineEnabled_;
}
+
+ /**
+ * Parses the given XHtml code string and loads the resulting XHtmlPage into
+ * the current window.
+ *
+ * @param htmlCode the html code as string
+ * @return the HtmlPage
+ * @throws IOException in case of error
+ */
+ public HtmlPage loadHtmlCodeIntoCurrentWindow(final String htmlCode) throws IOException {
+ final HTMLParser htmlParser = getPageCreator().getHtmlParser();
+ final WebWindow webWindow = getCurrentWindow();
+
+ final StringWebResponse webResponse =
+ new StringWebResponse(htmlCode, new URL("http://htmlunit.sourceforge.net/dummy.html"));
+ final HtmlPage page = new HtmlPage(webResponse, webWindow);
+ webWindow.setEnclosedPage(page);
+
+ htmlParser.parse(webResponse, page, true);
+ return page;
+ }
+
+ /**
+ * Parses the given XHtml code string and loads the resulting XHtmlPage into
+ * the current window.
+ *
+ * @param xhtmlCode the xhtml code as string
+ * @return the XHtmlPage
+ * @throws IOException in case of error
+ */
+ public XHtmlPage loadXHtmlCodeIntoCurrentWindow(final String xhtmlCode) throws IOException {
+ final HTMLParser htmlParser = getPageCreator().getHtmlParser();
+ final WebWindow webWindow = getCurrentWindow();
+
+ final StringWebResponse webResponse =
+ new StringWebResponse(xhtmlCode, new URL("http://htmlunit.sourceforge.net/dummy.html"));
+ final XHtmlPage page = new XHtmlPage(webResponse, webWindow);
+ webWindow.setEnclosedPage(page);
+
+ htmlParser.parse(webResponse, page, true);
+ return page;
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebClientInternals.java b/src/main/java/com/gargoylesoftware/htmlunit/WebClientInternals.java
index aff434436..247b5fda2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebClientInternals.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebClientInternals.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java b/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java
index cdd8de555..85cf8e8f2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebClientOptions.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebConnection.java b/src/main/java/com/gargoylesoftware/htmlunit/WebConnection.java
index b19e740a4..ba27691c4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebConnection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebConnection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebConsole.java b/src/main/java/com/gargoylesoftware/htmlunit/WebConsole.java
index 692f68c4e..c2e44ba2b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebConsole.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebConsole.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java b/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java
index 970b99300..864807331 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebRequest.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -21,6 +21,7 @@
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.net.IDN;
+import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.Charset;
import java.util.Collections;
@@ -63,6 +64,7 @@ public enum HttpHint {
private String url_; // String instead of java.net.URL because "about:blank" URLs don't serialize correctly
private String proxyHost_;
private int proxyPort_;
+ private String proxyScheme_;
private boolean isSocksProxy_;
private HttpMethod httpMethod_ = HttpMethod.GET;
private FormEncodingType encodingType_ = FormEncodingType.URL_ENCODED;
@@ -98,7 +100,7 @@ public WebRequest(final URL url, final String acceptHeader, final String acceptE
* @return a new request for about:blank
*/
public static WebRequest newAboutBlankRequest() {
- return new WebRequest(WebClient.URL_ABOUT_BLANK, "*/*", "gzip, deflate");
+ return new WebRequest(UrlUtils.URL_ABOUT_BLANK, "*/*", "gzip, deflate");
}
/**
@@ -246,6 +248,22 @@ public void setProxyPort(final int proxyPort) {
proxyPort_ = proxyPort;
}
+ /**
+ * Returns the proxy scheme to use.
+ * @return the proxy scheme to use
+ */
+ public String getProxyScheme() {
+ return proxyScheme_;
+ }
+
+ /**
+ * Sets the proxy scheme to use.
+ * @param proxyScheme the proxy scheme to use
+ */
+ public void setProxyScheme(final String proxyScheme) {
+ proxyScheme_ = proxyScheme;
+ }
+
/**
* Returns whether SOCKS proxy or not.
* @return whether SOCKS proxy or not
@@ -412,6 +430,23 @@ public String getAdditionalHeader(final String name) {
return additionalHeaders_.get(newKey);
}
+ /**
+ * Sets the referer HTTP header - only if the provided url is valid.
+ * @param url the url for the referer HTTP header
+ */
+ public void setRefererlHeader(final URL url) {
+ if (url == null || !url.getProtocol().startsWith("http")) {
+ return;
+ }
+
+ try {
+ setAdditionalHeader(HttpHeader.REFERER, UrlUtils.getUrlWithoutRef(url).toExternalForm());
+ }
+ catch (final MalformedURLException e) {
+ // bad luck us the whole url from the pager
+ }
+ }
+
/**
* Sets the specified name/value pair in the additional HTTP headers.
* @param name the name of the additional HTTP header
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java b/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java
index ec9fdf7d1..954776e1d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebResponse.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebResponseData.java b/src/main/java/com/gargoylesoftware/htmlunit/WebResponseData.java
index 4a5fbdddf..6c87c2c6a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebResponseData.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebResponseData.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebResponseFromCache.java b/src/main/java/com/gargoylesoftware/htmlunit/WebResponseFromCache.java
index ad00d818e..3c9c873ec 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebResponseFromCache.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebResponseFromCache.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindow.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindow.java
index 7297ee6e3..80fc5f434 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindow.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindow.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowAdapter.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowAdapter.java
index 5c02d4e72..ce5a9883a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowAdapter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowAdapter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowEvent.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowEvent.java
index fc47cd498..a56e66fb6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowEvent.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowEvent.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java
index b97b44076..d611f8cb7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowListener.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowListener.java
index 77187d0b8..8f83dc91e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowNotFoundException.java b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowNotFoundException.java
index 0ead570b1..dbc259a75 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/WebWindowNotFoundException.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/WebWindowNotFoundException.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java
index b5dca2613..28998f171 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLActiveXObjectFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java
index f64de59d7..bc8e37226 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLConfiguration.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java
index 5b326d1e9..833447b11 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLJavaScriptEnvironment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java
index e0e40c350..9e6c6b6a5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/MSXMLScriptable.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -104,7 +104,7 @@ public Scriptable getPrototype(final Class extends SimpleScriptable> javaScrip
@Override
protected boolean isReadOnlySettable(final String name, final Object value) {
- throw ScriptRuntime.typeError3("msg.set.prop.no.setter",
+ throw ScriptRuntime.typeErrorById("msg.set.prop.no.setter",
name, getClassName(), Context.toString(value));
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java
index e9f0940af..8b912d077 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMAttribute.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java
index 404efad42..41b4ddc32 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCDATASection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java
index a14f18293..dd950ff83 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMCharacterData.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java
index f7c4a508e..d44564fb4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMComment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java
index fa8388405..0ab9ba0ee 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocument.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java
index c12846dc3..05e7e8e84 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentFragment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java
index 874106a50..e78c1f164 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMDocumentType.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java
index 1753616ed..b5639dd37 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java
index 6b96e659c..55d5df33e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMImplementation.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java
index f26d10104..1f5afd32d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNamedNodeMap.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java
index b2233c82b..bbdb987f4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNode.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java
index 0ac66d2d3..ef612ba2e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMNodeList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java
index 975abf85e..17e7af622 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMParseError.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java
index b6c561357..884185883 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMProcessingInstruction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java
index ab46a08c5..2d2507da4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMSelection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java
index 07fddbf97..31d843555 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLDOMText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java
index b1cb11ffe..d98986341 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLHTTPRequest.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java
index a70d2af54..b262b1fa0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XMLSerializer.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java
index 2bda2e313..a91420e99 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java
index 2100081a1..720ee3793 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLTemplate.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package-info.java
index c4759053e..9a8ee21f0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/attachment/Attachment.java b/src/main/java/com/gargoylesoftware/htmlunit/attachment/Attachment.java
index ba70484c2..7c8d9f5b3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/attachment/Attachment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/attachment/Attachment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/attachment/AttachmentHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/attachment/AttachmentHandler.java
index a2f1f3d9a..d706a1813 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/attachment/AttachmentHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/attachment/AttachmentHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -48,9 +48,10 @@
public interface AttachmentHandler extends Serializable {
/**
- * Handles the specified attached page.
+ * Handles the specified attached page. This is some kind of information
+ * that the page was handled as attachment.
* This method will only be called if {@link #handleAttachment(WebResponse)}
- * has retund false for the response..
+ * has returned false for the response..
* @param page an attached page, which doesn't get loaded inline
*/
void handleAttachment(Page page);
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/attachment/CollectingAttachmentHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/attachment/CollectingAttachmentHandler.java
index bd0fc6774..57d506c75 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/attachment/CollectingAttachmentHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/attachment/CollectingAttachmentHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/attachment/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/attachment/package-info.java
index 9863db437..d85f333d1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/attachment/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/attachment/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/css/StyleElement.java b/src/main/java/com/gargoylesoftware/htmlunit/css/StyleElement.java
index 643bb04eb..424382dc9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/css/StyleElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/css/StyleElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/css/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/css/package-info.java
index 4a872fdc4..5b2ca3e8b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/css/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/css/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/AbstractDomNodeList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/AbstractDomNodeList.java
index f14ef81b9..481a59f56 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/AbstractDomNodeList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/AbstractDomNodeList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/BaseFrameElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/BaseFrameElement.java
index 764205cd4..031008f91 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/BaseFrameElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/BaseFrameElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -14,6 +14,7 @@
*/
package com.gargoylesoftware.htmlunit.html;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FRAME_LOCATION_ABOUT_BLANK_FOR_ABOUT_SCHEME;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MINIMAL_QUERY_ENCODING;
import java.io.IOException;
@@ -29,7 +30,6 @@
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.FrameContentHandler;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -80,7 +80,7 @@ protected BaseFrameElement(final String qualifiedName, final SgmlPage page,
// if created by the HTMLParser the src attribute is not set via setAttribute() or some other method but is
// part of the given attributes already.
final String src = getSrcAttribute();
- if (src != ATTRIBUTE_NOT_DEFINED && !WebClient.ABOUT_BLANK.equals(src)) {
+ if (src != ATTRIBUTE_NOT_DEFINED && !UrlUtils.ABOUT_BLANK.equals(src)) {
loadSrcWhenAddedToPage_ = true;
}
}
@@ -117,8 +117,12 @@ private void init() {
public void loadInnerPage() throws FailingHttpStatusCodeException {
String source = getSrcAttribute();
- if (source.isEmpty() || StringUtils.startsWithIgnoreCase(source, WebClient.ABOUT_SCHEME)) {
- source = WebClient.ABOUT_BLANK;
+ if (source.isEmpty()) {
+ source = UrlUtils.ABOUT_BLANK;
+ }
+ else if (StringUtils.startsWithIgnoreCase(source, UrlUtils.ABOUT_SCHEME)
+ && hasFeature(FRAME_LOCATION_ABOUT_BLANK_FOR_ABOUT_SCHEME)) {
+ source = UrlUtils.ABOUT_BLANK;
}
loadInnerPageIfPossible(source);
@@ -127,9 +131,9 @@ public void loadInnerPage() throws FailingHttpStatusCodeException {
if (enclosedPage != null && enclosedPage.isHtmlPage()) {
final HtmlPage htmlPage = (HtmlPage) enclosedPage;
- final AbstractJavaScriptEngine> jsEngine = getPage().getWebClient().getJavaScriptEngine();
+ final AbstractJavaScriptEngine> jsEngine = htmlPage.getWebClient().getJavaScriptEngine();
if (jsEngine != null && jsEngine.isScriptRunning()) {
- final PostponedAction action = new PostponedAction(getPage()) {
+ final PostponedAction action = new PostponedAction(getPage(), "BaseFrame.loadInnerPage") {
@Override
public void execute() throws Exception {
htmlPage.setReadyState(READY_STATE_COMPLETE);
@@ -173,7 +177,7 @@ private void loadInnerPageIfPossible(final String src) throws FailingHttpStatusC
final WebClient webClient = getPage().getWebClient();
final FrameContentHandler handler = webClient.getFrameContentHandler();
if (null != handler && !handler.loadFrameDocument(this)) {
- source = WebClient.ABOUT_BLANK;
+ source = UrlUtils.ABOUT_BLANK;
}
if (!source.isEmpty()) {
@@ -188,7 +192,7 @@ private void loadInnerPageIfPossible(final String src) throws FailingHttpStatusC
final WebRequest request = new WebRequest(url);
request.setCharset(getPage().getCharset());
- request.setAdditionalHeader(HttpHeader.REFERER, getPage().getUrl().toExternalForm());
+ request.setRefererlHeader(getPage().getUrl());
if (isAlreadyLoadedByAncestor(url, request.getCharset())) {
notifyIncorrectness("Recursive src attribute of " + getTagName() + ": url=[" + source + "]. Ignored.");
@@ -387,7 +391,7 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN
// do not use equals() here
// see HTMLIFrameElement2Test.documentCreateElement_onLoad_srcAboutBlank()
- if (SRC_ATTRIBUTE.equals(qualifiedName) && WebClient.ABOUT_BLANK != attributeValue) {
+ if (SRC_ATTRIBUTE.equals(qualifiedName) && UrlUtils.ABOUT_BLANK != attributeValue) {
if (isAttachedToPage()) {
loadSrc();
}
@@ -410,7 +414,7 @@ public Attr setAttributeNode(final Attr attribute) {
final Attr result = super.setAttributeNode(attribute);
- if (SRC_ATTRIBUTE.equals(qualifiedName) && !WebClient.ABOUT_BLANK.equals(attributeValue)) {
+ if (SRC_ATTRIBUTE.equals(qualifiedName) && !UrlUtils.ABOUT_BLANK.equals(attributeValue)) {
if (isAttachedToPage()) {
loadSrc();
}
@@ -426,6 +430,11 @@ private void loadSrc() {
loadSrcWhenAddedToPage_ = false;
final String src = getSrcAttribute();
+ // recreate a window if the old one was closed
+ if (enclosedWindow_.isClosed()) {
+ init();
+ }
+
final AbstractJavaScriptEngine> jsEngine = getPage().getWebClient().getJavaScriptEngine();
// When src is set from a script, loading is postponed until script finishes
// in fact this implementation is probably wrong: JavaScript URL should be
@@ -436,7 +445,7 @@ private void loadSrc() {
}
else {
final Page pageInFrame = getEnclosedPage();
- final PostponedAction action = new PostponedAction(getPage()) {
+ final PostponedAction action = new PostponedAction(getPage(), "BaseFrame.loadSrc") {
@Override
public void execute() throws Exception {
if (!src.isEmpty() && getSrcAttribute().equals(src)) {
@@ -454,15 +463,6 @@ public boolean isStillAlive() {
}
}
- @Override
- protected void onAddedToPage() {
- super.onAddedToPage();
-
- if (loadSrcWhenAddedToPage_) {
- loadSrc();
- }
- }
-
/**
* INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
*
@@ -505,13 +505,57 @@ public DomNode cloneNode(final boolean deep) {
return clone;
}
- /**
- * Remove our window also.
- * {@inheritDoc}
- */
+ @Override
+ protected void onAddedToPage() {
+ super.onAddedToPage();
+
+ if (loadSrcWhenAddedToPage_) {
+ loadSrc();
+ }
+ }
+
@Override
public void remove() {
super.remove();
+ loadSrcWhenAddedToPage_ = true;
getEnclosedWindow().close();
}
+
+ @Override
+ public final void removeAttribute(final String attributeName) {
+ super.removeAttribute(attributeName);
+
+ // TODO find a better implementation without all the code duplication
+ if (isAttachedToPage()) {
+ loadSrcWhenAddedToPage_ = false;
+ final String src = getSrcAttribute();
+
+ final AbstractJavaScriptEngine> jsEngine = getPage().getWebClient().getJavaScriptEngine();
+ // When src is set from a script, loading is postponed until script finishes
+ // in fact this implementation is probably wrong: JavaScript URL should be
+ // first evaluated and only loading, when any, should be postponed.
+ if (jsEngine == null || !jsEngine.isScriptRunning()) {
+ loadInnerPageIfPossible(src);
+ }
+ else {
+ final Page pageInFrame = getEnclosedPage();
+ final PostponedAction action = new PostponedAction(getPage(), "BaseFrame.removeAttribute") {
+ @Override
+ public void execute() throws Exception {
+ loadInnerPage();
+ }
+
+ @Override
+ public boolean isStillAlive() {
+ // skip if page in frame has already been changed
+ return super.isStillAlive() && pageInFrame == getEnclosedPage();
+ }
+ };
+ jsEngine.addPostponedAction(action);
+ }
+ }
+ else {
+ loadSrcWhenAddedToPage_ = true;
+ }
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeEvent.java b/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeEvent.java
index 49459aeda..6d577d8b3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeEvent.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeEvent.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeListener.java b/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeListener.java
index fc7bdf96d..daba9266f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/CharacterDataChangeListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java
index 495cdad4a..16aa57779 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DefaultElementFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -67,7 +67,7 @@ public class DefaultElementFactory implements ElementFactory {
HtmlBlink.TAG_NAME, HtmlBlockQuote.TAG_NAME, HtmlBody.TAG_NAME, HtmlBold.TAG_NAME,
HtmlBreak.TAG_NAME, HtmlButton.TAG_NAME, HtmlCanvas.TAG_NAME, HtmlCaption.TAG_NAME,
HtmlCenter.TAG_NAME, HtmlCitation.TAG_NAME, HtmlCode.TAG_NAME,
- HtmlCommand.TAG_NAME, HtmlContent.TAG_NAME, HtmlData.TAG_NAME, HtmlDataList.TAG_NAME,
+ HtmlCommand.TAG_NAME, HtmlData.TAG_NAME, HtmlDataList.TAG_NAME,
HtmlDefinition.TAG_NAME, HtmlDefinitionDescription.TAG_NAME,
HtmlDeletedText.TAG_NAME, HtmlDetails.TAG_NAME, HtmlDialog.TAG_NAME, HtmlDirectory.TAG_NAME,
HtmlDivision.TAG_NAME, HtmlDefinitionList.TAG_NAME,
@@ -285,10 +285,6 @@ public HtmlElement createElementNS(final SgmlPage page, final String namespaceUR
element = new HtmlCommand(qualifiedName, page, attributeMap);
break;
- case HtmlContent.TAG_NAME:
- element = new HtmlContent(qualifiedName, page, attributeMap);
- break;
-
case HtmlData.TAG_NAME:
element = new HtmlData(qualifiedName, page, attributeMap);
break;
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DisabledElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DisabledElement.java
index 65207cde3..1dc03b133 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DisabledElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DisabledElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DoTypeProcessor.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DoTypeProcessor.java
index 0c048381d..b55227231 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DoTypeProcessor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DoTypeProcessor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomAttr.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomAttr.java
index b9e72115c..5f56477b0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomAttr.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomAttr.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomCDataSection.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomCDataSection.java
index d7a8edddb..849ba323c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomCDataSection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomCDataSection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeEvent.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeEvent.java
index 64493ec4c..ad4e4d522 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeEvent.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeEvent.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeListener.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeListener.java
index 4d5fbde4b..976e3e5de 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomChangeListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java
index e98d9da92..91622b097 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomCharacterData.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomComment.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomComment.java
index 8ff812005..4be17cef2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomComment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomComment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentFragment.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentFragment.java
index b7f6003b5..2d557daf6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentFragment.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentFragment.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentType.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentType.java
index 17a1157e5..a89caa58a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentType.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomDocumentType.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
index b7b0c8b51..63dd41a18 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -850,7 +850,11 @@ public String toString() {
* 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.
+ * action listeners, etc.
+ * This only clicks the element if it is visible and enabled (isDisplayed() & !isDisabled()).
+ * In case the element is not visible and/or disabled, only a log output is generated.
+ *
+ * If you circumvent the visible/disabled check use click(shiftKey, ctrlKey, altKey, true, true, false)
*
* @param
the page type
* @return the page contained in the current window as returned by {@link WebClient#getCurrentWindow()}
@@ -864,7 +868,11 @@ public
P click() throws IOException {
* 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.
+ * action listeners, etc.
+ * This only clicks the element if it is visible and enabled (isDisplayed() & !isDisabled()).
+ * In case the element is not visible and/or disabled, only a log output is generated.
+ *
+ * If you circumvent the visible/disabled check use click(shiftKey, ctrlKey, altKey, true, true, false)
*
* @param shiftKey {@code true} if SHIFT is pressed during the click
* @param ctrlKey {@code true} if CTRL is pressed during the click
@@ -883,7 +891,11 @@ public
P click(final boolean shiftKey, final boolean ctrlKey, f
* 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.
+ * action listeners, etc.
+ * This only clicks the element if it is visible and enabled (isDisplayed() & !isDisabled()).
+ * In case the element is not visible and/or disabled, only a log output is generated.
+ *
+ * If you circumvent the visible/disabled check use click(shiftKey, ctrlKey, altKey, true, true, false)
*
* @param shiftKey {@code true} if SHIFT is pressed during the click
* @param ctrlKey {@code true} if CTRL is pressed during the click
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNamespaceNode.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNamespaceNode.java
index ec7a90e0c..ecc522e91 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNamespaceNode.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNamespaceNode.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
index 82bfe7fda..2f4727c8f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -55,6 +55,8 @@
import com.gargoylesoftware.htmlunit.WebAssert;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlElement.DisplayStyle;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerNormalizedText;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerVisibleText;
import com.gargoylesoftware.htmlunit.html.xpath.XPathHelper;
import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration;
@@ -788,6 +790,18 @@ public boolean mayBeDisplayed() {
return true;
}
+ /**
+ * Returns a normalized textual representation of this element that represents
+ * what would be visible to the user if this page was shown in a web browser.
+ * Whitespace is normalized like in the browser and block tags are separated by '\n'.
+ *
+ * @return a normalized textual representation of this element
+ */
+ public String asNormalizedText() {
+ final HtmlSerializerNormalizedText ser = new HtmlSerializerNormalizedText();
+ return ser.asText(this);
+ }
+
/**
* Returns a textual representation of this element that represents what would
* be visible to the user if this page was shown in a web browser. For example,
@@ -796,7 +810,10 @@ public boolean mayBeDisplayed() {
*
* @return a textual representation of this element that represents what would
* be visible to the user if this page was shown in a web browser
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
+ @Deprecated
public String asText() {
if (getPage() instanceof XmlPage) {
final XmlSerializer ser = new XmlSerializer();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java
index 747b5c628..0a65b86b0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeList.java
index 75e015ad1..5783fbe5d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomProcessingInstruction.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomProcessingInstruction.java
index 1f9bc6754..1adc34a68 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomProcessingInstruction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomProcessingInstruction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java
index df4a3756e..bb82ed079 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/DomTreeWalker.java b/src/main/java/com/gargoylesoftware/htmlunit/html/DomTreeWalker.java
index 4f585549d..c1fb6e742 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/DomTreeWalker.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/DomTreeWalker.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFactory.java
index a49de6088..35351e3e6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFromPointHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFromPointHandler.java
index d80ce95ce..3c6b052ca 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFromPointHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/ElementFromPointHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/FormFieldWithNameHistory.java b/src/main/java/com/gargoylesoftware/htmlunit/html/FormFieldWithNameHistory.java
index bdf441020..4aedfcc4e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/FormFieldWithNameHistory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/FormFieldWithNameHistory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/FrameWindow.java b/src/main/java/com/gargoylesoftware/htmlunit/html/FrameWindow.java
index 770018988..442df05d1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/FrameWindow.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/FrameWindow.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -87,7 +87,8 @@ public WebWindow getTopWindow() {
@Override
protected boolean isJavaScriptInitializationNeeded(final Page page) {
return getScriptableObject() == null
- || !(page.getWebResponse() instanceof StringWebResponse);
+ || !(page.getWebResponse() instanceof StringWebResponse
+ && ((StringWebResponse) page.getWebResponse()).isFromJavascript());
// TODO: find a better way to distinguish content written by document.open(),...
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/Html.java b/src/main/java/com/gargoylesoftware/htmlunit/html/Html.java
index b38242343..dcca95901 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/Html.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/Html.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java
index e4d6c7466..12a0507b4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAbbreviated.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java
index 019022ee7..bf9c0d3aa 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAcronym.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAddress.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAddress.java
index 40b1eb4cc..a2ff2eceb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAddress.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAddress.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java
index 4b990e760..01cec4364 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -31,6 +31,7 @@
import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
+import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.javascript.host.event.Event;
@@ -132,13 +133,14 @@ protected void doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey,
}
final String target;
- if (shiftKey || ctrlKey) {
- target = "_blank";
+ if (shiftKey || ctrlKey || ATTRIBUTE_NOT_DEFINED != getDownloadAttribute()) {
+ target = WebClient.TARGET_BLANK;
}
else {
target = page.getResolvedTarget(getTargetAttribute());
}
- final WebWindow win = page.getWebClient().openTargetWindow(page.getEnclosingWindow(), target, "_self");
+ final WebWindow win = page.getWebClient().openTargetWindow(page.getEnclosingWindow(),
+ target, WebClient.TARGET_SELF);
Page enclosedPage = win.getEnclosedPage();
if (enclosedPage == null) {
win.getWebClient().getPage(win, WebRequest.newAboutBlankRequest());
@@ -153,14 +155,15 @@ protected void doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey,
final URL url = getTargetUrl(href, page);
- final BrowserVersion browser = page.getWebClient().getBrowserVersion();
+ final WebClient webClient = page.getWebClient();
+ final BrowserVersion browser = webClient.getBrowserVersion();
if (ATTRIBUTE_NOT_DEFINED != getPingAttribute() && browser.hasFeature(ANCHOR_SEND_PING_REQUEST)) {
final URL pingUrl = getTargetUrl(getPingAttribute(), page);
final WebRequest pingRequest = new WebRequest(pingUrl, HttpMethod.POST);
pingRequest.setAdditionalHeader(HttpHeader.PING_FROM, page.getUrl().toExternalForm());
pingRequest.setAdditionalHeader(HttpHeader.PING_TO, url.toExternalForm());
pingRequest.setRequestBody("PING");
- page.getWebClient().loadWebResponse(pingRequest);
+ webClient.loadWebResponse(pingRequest);
}
final WebRequest webRequest = new WebRequest(url, browser.getHtmlAcceptHeader(),
@@ -168,7 +171,7 @@ protected void doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey,
// use the page encoding even if this is a GET requests
webRequest.setCharset(page.getCharset());
- webRequest.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ webRequest.setRefererlHeader(page.getUrl());
if (LOG.isDebugEnabled()) {
LOG.debug(
"Getting page for " + url.toExternalForm()
@@ -176,14 +179,18 @@ protected void doClickStateUpdate(final boolean shiftKey, final boolean ctrlKey,
+ "', using the originating URL "
+ page.getUrl());
}
+
final String target;
- if (shiftKey || ctrlKey) {
- target = "_blank";
+ if (shiftKey || ctrlKey
+ || (webClient.getAttachmentHandler() == null
+ && ATTRIBUTE_NOT_DEFINED != getDownloadAttribute())) {
+ target = WebClient.TARGET_BLANK;
}
else {
target = page.getResolvedTarget(getTargetAttribute());
}
- page.getWebClient().download(page.getEnclosingWindow(), target, webRequest, true, false, "Link click");
+ page.getWebClient().download(page.getEnclosingWindow(), target, webRequest,
+ true, false, ATTRIBUTE_NOT_DEFINED != getDownloadAttribute(), "Link click");
}
/**
@@ -427,4 +434,12 @@ public final String getPingAttribute() {
return getAttributeDirect("ping");
}
+ /**
+ * Returns the value of the attribute {@code download}.
+ *
+ * @return the value of the attribute {@code download}
+ */
+ public final String getDownloadAttribute() {
+ return getAttributeDirect("download");
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlApplet.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlApplet.java
index 6eb64b02e..bf128a9f8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlApplet.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlApplet.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java
index a2aaa2230..ca4ae25e7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArea.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -30,7 +30,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
@@ -97,12 +96,11 @@ protected boolean doClickStateUpdate(final boolean shiftKey, final boolean ctrlK
}
final WebRequest request = new WebRequest(url);
request.setCharset(page.getCharset());
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
final WebWindow webWindow = enclosingPage.getEnclosingWindow();
- webClient.getPage(
- webWindow,
- enclosingPage.getResolvedTarget(getTargetAttribute()),
- request);
+
+ final String target = enclosingPage.getResolvedTarget(getTargetAttribute());
+ webClient.getPage(webClient.openTargetWindow(webWindow, target, WebClient.TARGET_SELF), request);
}
return false;
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java
index 2aacbab15..2019a469f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlArticle.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java
index e82f70178..7208634ea 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAside.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeEvent.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeEvent.java
index b64b83652..c0c9d8913 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeEvent.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeEvent.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeListener.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeListener.java
index e912b73fd..ae4b4731b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAttributeChangeListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java
index a3cfb3bf4..5bde86e7a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlAudio.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSound.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSound.java
index a4ce99947..612f4a593 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSound.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBackgroundSound.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBase.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBase.java
index e900ebfb5..702065113 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBase.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBase.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBaseFont.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBaseFont.java
index 6cf96887b..03dd6ace1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBaseFont.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBaseFont.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalIsolation.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalIsolation.java
index c6cb6eeba..ffc4e9d82 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalIsolation.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalIsolation.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java
index b9b8c072f..0c5237c58 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBidirectionalOverride.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java
index 3caa42fe7..24be64407 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBig.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java
index d81e46f9f..54f4c295f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlink.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlockQuote.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlockQuote.java
index 7a94a6d5b..287a69158 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlockQuote.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBlockQuote.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBody.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBody.java
index cfffafec3..89f79dc22 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBody.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBody.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java
index a8c5535c4..c1c382922 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBold.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java
index 39419683c..19b9dd048 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlBreak.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java
index bd6c8b96c..aaa66c8e3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButton.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButtonInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButtonInput.java
index 5f5218476..fb7e0c7be 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButtonInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlButtonInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java
index e4084bbe3..fbfafef44 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCanvas.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java
index 1a5f089a0..fa634d730 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCaption.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCenter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCenter.java
index 7a77d7289..9a875d748 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCenter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCenter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java
index c25719824..4753bb35d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCheckBoxInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -125,9 +125,12 @@ public Page setChecked(final boolean isChecked) {
/**
* A checkbox does not have a textual representation,
* but we invent one for it because it is useful for testing.
+ *
* @return "checked" or "unchecked" according to the radio state
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return super.asText();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java
index 1b262a9c3..15eebe797 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCitation.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java
index 0a6290c4f..a685e5ae8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCode.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlColorInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlColorInput.java
index 06eeb39ab..26e25647e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlColorInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlColorInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCommand.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCommand.java
index aa8ee471d..d67d93673 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCommand.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlCommand.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlContent.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlContent.java
deleted file mode 100644
index e42059b1a..000000000
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlContent.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2002-2021 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.html;
-
-import java.util.Map;
-
-import com.gargoylesoftware.htmlunit.SgmlPage;
-
-/**
- * Wrapper for the HTML element "content".
- *
- * @author Ahmed Ashour
- * @author Ronald Brill
- */
-public class HtmlContent extends HtmlElement {
-
- /** The HTML tag represented by this element. */
- public static final String TAG_NAME = "content";
-
- /**
- * Creates a new instance.
- *
- * @param qualifiedName the qualified name of the element type to instantiate
- * @param page the page that contains this element
- * @param attributes the initial attributes
- */
- HtmlContent(final String qualifiedName, final SgmlPage page,
- final Map attributes) {
- super(qualifiedName, page, attributes);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public DisplayStyle getDefaultStyleDisplay() {
- return DisplayStyle.INLINE;
- }
-}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlData.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlData.java
index f99fca79b..8d42e9db3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlData.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlData.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java
index e7e52069d..56a6794a3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDataList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateInput.java
index caee4ea65..16f47458e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateTimeLocalInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateTimeLocalInput.java
index 24932a798..dbf4e0d65 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateTimeLocalInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDateTimeLocalInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java
index 817e8b18b..ca32262e5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinition.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionDescription.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionDescription.java
index c1a3d521d..1f0e3cb0b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionDescription.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionDescription.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionList.java
index d7b755b5f..3964b2839 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionTerm.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionTerm.java
index 74c13178e..1bcb750c0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionTerm.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDefinitionTerm.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java
index 9dc8cbda1..df0f72f64 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDeletedText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDetails.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDetails.java
index a9400a6ec..a4ff6efdb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDetails.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDetails.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -22,6 +22,7 @@
* Wrapper for the HTML element "details".
*
* @author Ahmed Ashour
+ * @author Ronald Brill
*/
public class HtmlDetails extends HtmlElement {
@@ -40,4 +41,11 @@ public class HtmlDetails extends HtmlElement {
super(qualifiedName, page, attributes);
}
+ /**
+ * Returns the {@code open} property.
+ * @return the {@code open} property
+ */
+ public boolean isOpen() {
+ return hasAttribute("open");
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDialog.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDialog.java
index cb4f4e13e..c71edbc48 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDialog.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDialog.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDirectory.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDirectory.java
index 15e80f235..4c4ff6a3d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDirectory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDirectory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDivision.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDivision.java
index 934b16271..7a4d9ffbd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDivision.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlDivision.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java
index d1ca48dec..97388b47d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -138,6 +138,8 @@ public String value() {
*/
public static final Short TAB_INDEX_OUT_OF_BOUNDS = new Short(Short.MIN_VALUE);
+ private static final String ATTRIBUTE_REQUIRED = "required";
+
/** The listeners which are to be notified of attribute changes. */
private Collection attributeListeners_;
@@ -310,7 +312,7 @@ public Attr setAttributeNode(final Attr attribute) {
* @param attributeName the attribute attributeName
*/
@Override
- public final void removeAttribute(final String attributeName) {
+ public void removeAttribute(final String attributeName) {
final String value = getAttribute(attributeName);
if (value == ATTRIBUTE_NOT_DEFINED) {
return;
@@ -1343,7 +1345,8 @@ public boolean isAltPressed() {
* @return whether this element satisfies all form validation constraints set
*/
public boolean isValid() {
- return !isRequiredSupported() || getAttributeDirect("required") == ATTRIBUTE_NOT_DEFINED
+ return !isRequiredSupported()
+ || getAttributeDirect(ATTRIBUTE_REQUIRED) == ATTRIBUTE_NOT_DEFINED
|| !getAttributeDirect("value").isEmpty();
}
@@ -1356,11 +1359,17 @@ protected boolean isRequiredSupported() {
}
/**
- * Returns the {@code required} attribute.
- * @return the {@code required} attribute
+ * @return the true if the required attribute is set
*/
public boolean isRequired() {
- return isRequiredSupported() && hasAttribute("required");
+ return isRequiredSupported() && hasAttribute(ATTRIBUTE_REQUIRED);
+ }
+
+ /**
+ * @return the true if the required attribute is supported and set
+ */
+ public boolean isOptional() {
+ return isRequiredSupported() && !hasAttribute(ATTRIBUTE_REQUIRED);
}
/**
@@ -1370,10 +1379,10 @@ public boolean isRequired() {
public void setRequired(final boolean required) {
if (isRequiredSupported()) {
if (required) {
- setAttribute("required", "required");
+ setAttribute(ATTRIBUTE_REQUIRED, ATTRIBUTE_REQUIRED);
}
else {
- removeAttribute("required");
+ removeAttribute(ATTRIBUTE_REQUIRED);
}
}
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmailInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmailInput.java
index 8c7aa48c9..4e6c1ca1f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmailInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmailInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java
index d125db480..c5727c52c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmbed.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -24,7 +24,6 @@
import org.apache.commons.io.IOUtils;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
@@ -66,7 +65,7 @@ public void saveAs(final File file) throws IOException {
final URL url = page.getFullyQualifiedUrl(getAttributeDirect(SRC_ATTRIBUTE));
final WebRequest request = new WebRequest(url);
request.setCharset(page.getCharset());
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
final WebResponse webResponse = webclient.loadWebResponse(request);
try (OutputStream fos = Files.newOutputStream(file.toPath());
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java
index e6f5bedff..1c9619730 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlEmphasis.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java
index 5ac022a4a..42388b033 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlExample.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFieldSet.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFieldSet.java
index c1f6b60c1..a32f92bd6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFieldSet.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFieldSet.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java
index 5052f6e6c..a6248fcbc 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigure.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java
index 9c8f3724f..8d80535d3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFigureCaption.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java
index 85106c308..3fb645deb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFileInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -19,9 +19,11 @@
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Map;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import com.gargoylesoftware.htmlunit.SgmlPage;
@@ -143,7 +145,10 @@ public String getContentType() {
/**
* {@inheritDoc}
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
+ @Deprecated
@Override
public String asText() {
return "";
@@ -166,8 +171,9 @@ public void setValueAttribute(final String newValue) {
*/
public void setFiles(final File... files) {
if (files.length > 1 && getAttributeDirect("multiple") == ATTRIBUTE_NOT_DEFINED) {
- throw new IllegalStateException("HtmlFileInput is not 'multiple'.");
+ throw new IllegalStateException("HtmlFileInput - 'multiple' is not set.");
}
+
for (int i = 0; i < files.length; i++) {
files[i] = normalizeFile(files[i]);
}
@@ -175,6 +181,39 @@ public void setFiles(final File... files) {
fireEvent(Event.TYPE_CHANGE);
}
+ /**
+ * Used to specify the upload directory.
+ *
+ * @param directory the directory to upload all files
+ */
+ public void setDirectory(final File directory) {
+ if (directory == null) {
+ return;
+ }
+
+ if (getAttributeDirect("webkitdirectory") == ATTRIBUTE_NOT_DEFINED) {
+ throw new IllegalStateException("HtmlFileInput - 'webkitdirectory' is not set.");
+ }
+
+ if (getAttributeDirect("multiple") == ATTRIBUTE_NOT_DEFINED) {
+ throw new IllegalStateException("HtmlFileInput - 'multiple' is not set.");
+ }
+
+ if (!directory.isDirectory()) {
+ throw new IllegalStateException("HtmlFileInput - the provided directory '"
+ + directory.getAbsolutePath() + "' is not a directory.");
+ }
+
+ final Collection fileColl = FileUtils.listFiles(directory, null, true);
+ final File[] files = new File[fileColl.size()];
+ int i = 0;
+ for (final File file : fileColl) {
+ files[i++] = normalizeFile(file);
+ }
+ files_ = files;
+ fireEvent(Event.TYPE_CHANGE);
+ }
+
/**
* To tolerate {@code file://}
*/
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java
index 6beae2001..7f9aee032 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFont.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java
index 866a6d0da..874ca83de 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFooter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java
index 6ed9567d1..64cbc09f0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -181,7 +181,7 @@ && getAttributeDirect("novalidate") != ATTRIBUTE_NOT_DEFINED) {
/** Calling form.submit() twice forces double download. */
final boolean checkHash =
!webClient.getBrowserVersion().hasFeature(FORM_SUBMISSION_DOWNLOWDS_ALSO_IF_ONLY_HASH_CHANGED);
- webClient.download(webWindow, target, request, checkHash, false, "JS form.submit()");
+ webClient.download(webWindow, target, request, checkHash, false, false, "JS form.submit()");
}
/**
@@ -310,17 +310,17 @@ public WebRequest getWebRequest(final SubmittableElement submitElement) {
}
if (HttpMethod.GET == method && browser.hasFeature(FORM_SUBMISSION_URL_WITHOUT_HASH)
- && WebClient.URL_ABOUT_BLANK != url) {
+ && UrlUtils.URL_ABOUT_BLANK != url) {
url = UrlUtils.getUrlWithNewRef(url, null);
}
else if (HttpMethod.POST == method
&& browser.hasFeature(FORM_SUBMISSION_URL_WITHOUT_HASH)
- && WebClient.URL_ABOUT_BLANK != url
+ && UrlUtils.URL_ABOUT_BLANK != url
&& StringUtils.isEmpty(actionUrl)) {
url = UrlUtils.getUrlWithNewRef(url, null);
}
else if (anchor != null
- && WebClient.URL_ABOUT_BLANK != url) {
+ && UrlUtils.URL_ABOUT_BLANK != url) {
url = UrlUtils.getUrlWithNewRef(url, anchor);
}
}
@@ -336,8 +336,7 @@ else if (anchor != null
request.setEncodingType(FormEncodingType.getInstance(getEnctypeAttribute()));
}
request.setCharset(enc);
-
- request.setAdditionalHeader(HttpHeader.REFERER, htmlPage.getUrl().toExternalForm());
+ request.setRefererlHeader(htmlPage.getUrl());
if (HttpMethod.POST == method
&& browser.hasFeature(FORM_SUBMISSION_HEADER_ORIGIN)) {
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrame.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrame.java
index 55b98920a..189207c0b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrame.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrame.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSet.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSet.java
index f84ba1597..a158dc48b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSet.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFrameSet.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHead.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHead.java
index 9fe224b94..a8a6cdc15 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHead.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHead.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java
index a82dec9b5..2c72a0a74 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeader.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading1.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading1.java
index e6bf44f33..13d6b56a3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading1.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading1.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading2.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading2.java
index 9bd6c6e5f..220af63b5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading2.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading2.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading3.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading3.java
index a86a35977..7864d3ee5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading3.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading3.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading4.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading4.java
index 3ab4a488c..047993355 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading4.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading4.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading5.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading5.java
index 145deed18..75099e55b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading5.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading5.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading6.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading6.java
index af3b39026..2381a8d95 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading6.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHeading6.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java
index 8f22f3f5c..920a60c67 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHiddenInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -60,8 +60,10 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN
/**
* @see com.gargoylesoftware.htmlunit.html.HtmlInput#asText()
* @return an empty string as hidden field is not visible
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return "";
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHorizontalRule.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHorizontalRule.java
index 57904cf2e..86e68991e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHorizontalRule.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHorizontalRule.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHtml.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHtml.java
index aecba5775..d85ae5412 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHtml.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlHtml.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java
index b1bf07032..8276f1f97 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -42,7 +42,6 @@
import org.apache.http.HttpStatus;
import com.gargoylesoftware.htmlunit.BrowserVersion;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -153,7 +152,7 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN
final String readyState = htmlPage.getReadyState();
if (READY_STATE_LOADING.equals(readyState)) {
- final PostponedAction action = new PostponedAction(getPage()) {
+ final PostponedAction action = new PostponedAction(getPage(), "HtmlImage.setAttributeNS") {
@Override
public void execute() throws Exception {
doOnLoad();
@@ -303,7 +302,7 @@ public void doOnLoad() {
}
if (READY_STATE_LOADING.equals(htmlPage.getReadyState())) {
- final PostponedAction action = new PostponedAction(getPage()) {
+ final PostponedAction action = new PostponedAction(getPage(), "HtmlImage.doOnLoad") {
@Override
public void execute() throws Exception {
HtmlImage.this.fireEvent(event);
@@ -546,7 +545,7 @@ private void downloadImageIfNeeded() throws IOException {
final WebRequest request = new WebRequest(url, browser.getImgAcceptHeader(),
browser.getAcceptEncodingHeader());
request.setCharset(page.getCharset());
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
imageWebResponse_ = webClient.loadWebResponse(request);
}
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java
index dfa3d653a..52c1deff8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlImageInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -14,7 +14,6 @@
*/
package com.gargoylesoftware.htmlunit.html;
-import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLIMAGE_BLANK_SRC_AS_EMPTY;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLIMAGE_NAME_VALUE_PARAMS;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IMAGE_COMPLETE_RETURNS_TRUE_FOR_NO_REQUEST;
@@ -22,16 +21,18 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -42,6 +43,7 @@
/**
* Wrapper for the HTML element "input".
+ * HtmlUnit does not download the associated image for performance reasons.
*
* @author Mike Bowler
* @author David K. Taylor
@@ -54,6 +56,8 @@
*/
public class HtmlImageInput extends HtmlInput implements LabelableElement {
+ private static final Log LOG = LogFactory.getLog(HtmlImageInput.class);
+
// For click with x, y position.
private boolean wasPositionSpecified_;
private int xPosition_;
@@ -207,6 +211,39 @@ protected boolean isRequiredSupported() {
return false;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final String getSrcAttribute() {
+ final String src = getSrcAttributeNormalized();
+ if (ATTRIBUTE_NOT_DEFINED == src) {
+ return src;
+ }
+
+ final HtmlPage page = getHtmlPageOrNull();
+ if (page != null) {
+ try {
+ return page.getFullyQualifiedUrl(src).toExternalForm();
+ }
+ catch (final MalformedURLException e) {
+ // Log the error and fall through to the return values below.
+ LOG.warn(e.getMessage(), e);
+ }
+ }
+ return src;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSrcAttribute(final String src) {
+ super.setSrcAttribute(src);
+ downloaded_ = false;
+ imageWebResponse_ = null;
+ }
+
/**
*
Downloads the image contained by this image element.
*
POTENTIAL PERFORMANCE KILLER - DOWNLOADS THE IMAGE - USE AT YOUR OWN RISK
@@ -216,19 +253,16 @@ protected boolean isRequiredSupported() {
*/
private void downloadImageIfNeeded() throws IOException {
if (!downloaded_) {
- // HTMLIMAGE_BLANK_SRC_AS_EMPTY
final String src = getSrcAttribute();
- if (!"".equals(src)
- && !(hasFeature(HTMLIMAGE_BLANK_SRC_AS_EMPTY) && StringUtils.isBlank(src))) {
+ if (!"".equals(src)) {
final HtmlPage page = (HtmlPage) getPage();
final WebClient webClient = page.getWebClient();
- final URL url = page.getFullyQualifiedUrl(src);
final BrowserVersion browser = webClient.getBrowserVersion();
- final WebRequest request = new WebRequest(url, browser.getImgAcceptHeader(),
+ final WebRequest request = new WebRequest(new URL(src), browser.getImgAcceptHeader(),
browser.getAcceptEncodingHeader());
request.setCharset(page.getCharset());
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
imageWebResponse_ = webClient.loadWebResponse(request);
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java
index 4beb205c3..90feb82e1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineFrame.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java
index c58e2adef..3fe0b7382 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInlineQuotation.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java
index d3d0ecd16..e73567cf7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -275,10 +275,19 @@ protected int getMinLength() {
* @return the value of the attribute {@code src}
* or an empty string if that attribute isn't defined.
*/
- public final String getSrcAttribute() {
+ public String getSrcAttribute() {
return getSrcAttributeNormalized();
}
+ /**
+ * Sets the {@code src} attribute.
+ *
+ * @param src the {@code src} attribute
+ */
+ public void setSrcAttribute(final String src) {
+ setAttribute(HtmlElement.SRC_ATTRIBUTE, src);
+ }
+
/**
* Returns the value of the attribute {@code alt}. Refer to the
* HTML 4.01
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java
index fcc78e816..d46e03587 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInsertedText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlIsIndex.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlIsIndex.java
index ec414d0b1..c90ddba9d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlIsIndex.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlIsIndex.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java
index f14f437c8..cc0b8fcd9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlItalic.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java
index 99ffa9ce5..cc82d3fb4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlKeyboard.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java
index 0466297e6..d356ad8bf 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLabel.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -109,17 +109,6 @@ public void focus() {
}
}
- /**
- * Gets the element referenced by this label. That is the element in the page which id is
- * equal to the value of the for attribute of this label.
- * @return the element, {@code null} if not found
- * @deprecated as of version 2.40; use {@link #getLabeledElement()} instead
- */
- @Deprecated
- public HtmlElement getReferencedElement() {
- return getLabeledElement();
- }
-
/**
* Gets the element labeled by this label. That is the labelable element in the page
* which id is equal to the value of the for attribute of this label or, if no for
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLayer.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLayer.java
index 830d51fa0..7394290a6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLayer.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLayer.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java
index fa79a6fa7..582119200 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLegend.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java
index a145a7dd8..a59430803 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlLink.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -26,7 +26,6 @@
import org.apache.http.HttpStatus;
import com.gargoylesoftware.htmlunit.BrowserVersion;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
@@ -233,8 +232,7 @@ public WebRequest getWebRequest() throws MalformedURLException {
final WebRequest request = new WebRequest(url, browser.getCssAcceptHeader(), browser.getAcceptEncodingHeader());
// use the page encoding even if this is a GET requests
request.setCharset(page.getCharset());
-
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
return request;
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java
index c4ef89348..4d6eef133 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListItem.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java
index 7f04f9f93..e35c0f438 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlListing.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMain.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMain.java
index f0d9af05a..95de784de 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMain.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMain.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java
index 2371dc005..fb17c6b49 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMap.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java
index 871edb0e3..24f0b3495 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMark.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMarquee.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMarquee.java
index d4a9980bc..5fb5aafbe 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMarquee.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMarquee.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMedia.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMedia.java
index 327ff98d6..a9bc90646 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMedia.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMedia.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenu.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenu.java
index 3a3bfd8bb..66d4c516a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenu.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenu.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenuItem.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenuItem.java
index d24a961ee..0d595feeb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenuItem.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMenuItem.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeta.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeta.java
index eb0af2842..fac79b61c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeta.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeta.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java
index 5cc84bb65..69cfa34ae 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMeter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMonthInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMonthInput.java
index 7c6fd8348..903f8a104 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMonthInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMonthInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java
index 6f2107819..9d73a9f3e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlMultiColumn.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java
index 8dd13ec10..22b21af27 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNav.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java
index bdd15648a..e7bbfcd21 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNextId.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java
index aa1cbe948..dd40cc1d0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoBreak.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoEmbed.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoEmbed.java
index 034b7fe9b..928073735 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoEmbed.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoEmbed.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoFrames.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoFrames.java
index b5ae1acc4..2b3bb9abd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoFrames.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoFrames.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoLayer.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoLayer.java
index 096e75a68..abef98fb7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoLayer.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoLayer.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java
index 4affa3af0..315b84a2c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNoScript.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNumberInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNumberInput.java
index 8dd15e8eb..229b01b78 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNumberInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlNumberInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -14,6 +14,8 @@
*/
package com.gargoylesoftware.htmlunit.html;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_NUMBER_ACCEPT_ALL;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_NUMBER_DOT_AT_END_IS_DOUBLE;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START;
import java.text.NumberFormat;
@@ -21,6 +23,8 @@
import java.util.Locale;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.html.impl.SelectableTextInput;
import com.gargoylesoftware.htmlunit.html.impl.SelectableTextSelectionDelegate;
@@ -32,9 +36,12 @@
* @author Ronald Brill
* @author Frank Danek
* @author Anton Demydenko
+ * @author Raik Bieniek
*/
public class HtmlNumberInput extends HtmlInput implements SelectableTextInput, LabelableElement {
+ private static final char[] VALID_INT_CHARS = new char[] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-'};
+
private SelectableTextSelectionDelegate selectionDelegate_ = new SelectableTextSelectionDelegate(this);
private DoTypeProcessor doTypeProcessor_ = new DoTypeProcessor(this);
@@ -48,6 +55,16 @@ public class HtmlNumberInput extends HtmlInput implements SelectableTextInput, L
HtmlNumberInput(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
+
+ final String value = getValueAttribute();
+ if (!value.isEmpty()) {
+ try {
+ Double.parseDouble(value.trim());
+ }
+ catch (final NumberFormatException e) {
+ setValueAttribute("");
+ }
+ }
}
/**
@@ -72,7 +89,30 @@ protected void doType(final int keyCode, final boolean lastType) {
@Override
protected void typeDone(final String newValue, final boolean notifyAttributeChangeListeners) {
if (newValue.length() <= getMaxLength()) {
- setAttributeNS(null, "value", newValue, notifyAttributeChangeListeners, false);
+ if (hasFeature(JS_INPUT_NUMBER_ACCEPT_ALL)) {
+ setAttributeNS(null, "value", newValue, notifyAttributeChangeListeners, false);
+ return;
+ }
+
+ if (StringUtils.isBlank(newValue) || "-".equals(newValue) || "+".equals(newValue)) {
+ setAttributeNS(null, "value", newValue, notifyAttributeChangeListeners, false);
+ return;
+ }
+
+ String parseValue = newValue;
+ final int lastPos = parseValue.length() - 1;
+ if (parseValue.charAt(lastPos) == '.') {
+ parseValue = parseValue.substring(0, lastPos);
+ }
+
+ try {
+ Double.parseDouble(parseValue);
+ setAttributeNS(null, "value", newValue, notifyAttributeChangeListeners, false);
+ }
+ catch (final NumberFormatException e) {
+ // ignore
+ }
+
}
}
@@ -231,46 +271,72 @@ public DomNode cloneNode(final boolean deep) {
*/
@Override
public boolean isValid() {
- return super.isValid() && isMaxValid() && isMinValid();
- }
+ if (!super.isValid()) {
+ return false;
+ }
- /**
- * Returns if the input element has a valid min value. Refer to the
- * HTML 5
- * documentation for details.
- *
- * @return if the input element has a valid min value
- */
- private boolean isMinValid() {
- if (!getValueAttribute().isEmpty() && !getMin().isEmpty()) {
- try {
- final Long value = Long.parseLong(getValueAttribute());
- final Long min = Long.parseLong(getMin());
- return min <= value;
+ final String valueAttr = getValueAttribute();
+ if (!valueAttr.isEmpty()) {
+ if ("-".equals(valueAttr) || "+".equals(valueAttr)) {
+ return false;
}
- catch (final NumberFormatException e) {
- // ignore
+
+ // if we have no step, the value has to be an integer
+ if (getStep().isEmpty()) {
+ String val = valueAttr;
+ final int lastPos = val.length() - 1;
+ if (lastPos >= 0 && val.charAt(lastPos) == '.') {
+ if (hasFeature(JS_INPUT_NUMBER_DOT_AT_END_IS_DOUBLE)) {
+ return false;
+ }
+ val = val.substring(0, lastPos);
+ }
+ if (!StringUtils.containsOnly(val, VALID_INT_CHARS)) {
+ return false;
+ }
}
- }
- return true;
- }
- /**
- * Returns if the input element has a valid max value. Refer to the
- * HTML 5
- * documentation for details.
- *
- * @return if the input element has a valid max value
- */
- private boolean isMaxValid() {
- if (!getValueAttribute().isEmpty() && !getMax().isEmpty()) {
+ double value = 0d;
try {
- final Long value = Long.parseLong(getValueAttribute());
- final Long max = Long.parseLong(getMax());
- return max >= value;
+ value = Double.parseDouble(valueAttr);
}
catch (final NumberFormatException e) {
- // ignore
+ return false;
+ }
+
+ if (!getMin().isEmpty()) {
+ try {
+ final double min = Double.parseDouble(getMin());
+ if (value < min) {
+ return false;
+ }
+
+ if (!getStep().isEmpty()) {
+ try {
+ final double step = Double.parseDouble(getStep());
+ if (Math.abs((value - min) % step) > 0.000001d) {
+ return false;
+ }
+ }
+ catch (final NumberFormatException e) {
+ // ignore
+ }
+ }
+ }
+ catch (final NumberFormatException e) {
+ // ignore
+ }
+ }
+ if (!getMax().isEmpty()) {
+ try {
+ final double max = Double.parseDouble(getMax());
+ if (value > max) {
+ return false;
+ }
+ }
+ catch (final NumberFormatException e) {
+ // ignore
+ }
}
}
return true;
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java
index 346069edd..9fe079110 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlObject.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java
index a1f3fd64d..7fe376332 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOption.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -375,8 +375,10 @@ void setSelectedInternal(final boolean selected) {
* {@inheritDoc}
* This implementation will show the label attribute before the
* content of the tag if the attribute exists.
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return super.asText();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOptionGroup.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOptionGroup.java
index 1b90595bd..3a63e81e2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOptionGroup.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOptionGroup.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedList.java
index d1cf01e2d..e7c4ab207 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOrderedList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java
index 9df4a47d7..341cd77d6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlOutput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
index ff654f277..ba1295dc1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -18,11 +18,11 @@
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_FOCUS_IN_FOCUS_OUT_BLUR;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_FOCUS_ON_LOAD;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.FOCUS_BODY_ELEMENT_AT_START;
-import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DEFERRED;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_EVENT_LOAD_SUPPRESSED_BY_CONTENT_SECURIRY_POLICY;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_IGNORES_UTF8_BOM_SOMETIMES;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.PAGE_SELECTION_RANGE_FROM_SELECTABLE_TEXT_INPUT;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.URL_MISSING_SLASHES;
+import static com.gargoylesoftware.htmlunit.html.DomElement.ATTRIBUTE_NOT_DEFINED;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import java.io.File;
@@ -233,7 +233,7 @@ public boolean hasCaseSensitiveTagNames() {
@Override
public void initialize() throws IOException, FailingHttpStatusCodeException {
final WebWindow enclosingWindow = getEnclosingWindow();
- final boolean isAboutBlank = getUrl() == WebClient.URL_ABOUT_BLANK;
+ final boolean isAboutBlank = getUrl() == UrlUtils.URL_ABOUT_BLANK;
if (isAboutBlank) {
// a frame contains first a faked "about:blank" before its real content specified by src gets loaded
if (enclosingWindow instanceof FrameWindow
@@ -256,6 +256,8 @@ public void initialize() throws IOException, FailingHttpStatusCodeException {
getDocumentElement().setReadyState(READY_STATE_INTERACTIVE);
}
+ executeDeferredScriptsIfNeeded();
+
executeEventHandlersIfNeeded(Event.TYPE_DOM_DOCUMENT_LOADED);
loadFrames();
@@ -270,9 +272,6 @@ public void initialize() throws IOException, FailingHttpStatusCodeException {
getDocumentElement().setReadyState(READY_STATE_COMPLETE);
}
- executeDeferredScriptsIfNeeded();
- setReadyStateOnDeferredScriptsIfNeeded();
-
// frame initialization has a different order
boolean isFrameWindow = enclosingWindow instanceof FrameWindow;
boolean isFirstPageInFrameWindow = false;
@@ -280,7 +279,7 @@ public void initialize() throws IOException, FailingHttpStatusCodeException {
isFrameWindow = ((FrameWindow) enclosingWindow).getFrameElement() instanceof HtmlFrame;
final History hist = enclosingWindow.getHistory();
- if (hist.getLength() > 0 && WebClient.URL_ABOUT_BLANK == hist.getUrl(0)) {
+ if (hist.getLength() > 0 && UrlUtils.URL_ABOUT_BLANK == hist.getUrl(0)) {
isFirstPageInFrameWindow = hist.getLength() <= 2;
}
else {
@@ -1047,7 +1046,7 @@ private Object loadJavaScriptFromUrl(final URL url, final Charset scriptCharset)
request.setAdditionalHeaders(new HashMap<>(referringRequest.getAdditionalHeaders()));
// at least overwrite this headers
request.setAdditionalHeader(HttpHeader.ACCEPT, client.getBrowserVersion().getScriptAcceptHeader());
- request.setAdditionalHeader(HttpHeader.REFERER, referringRequest.getUrl().toString());
+ request.setRefererlHeader(referringRequest.getUrl());
// our cache is a bit strange;
// loadWebResponse check the cache for the web response
@@ -1289,7 +1288,7 @@ private boolean executeEventHandlersIfNeeded(final String eventType) {
}
if (window.getScriptableObject() instanceof Window) {
final Event event;
- if (eventType.equals(Event.TYPE_BEFORE_UNLOAD)) {
+ if (Event.TYPE_BEFORE_UNLOAD.equals(eventType)) {
event = new BeforeUnloadEvent(frame, eventType);
}
else {
@@ -1466,32 +1465,13 @@ private void executeDeferredScriptsIfNeeded() {
if (!getWebClient().isJavaScriptEnabled()) {
return;
}
- if (hasFeature(JS_DEFERRED)) {
- final DomElement doc = getDocumentElement();
- final List elements = doc.getElementsByTagName("script");
- for (final HtmlElement e : elements) {
- if (e instanceof HtmlScript) {
- final HtmlScript script = (HtmlScript) e;
- if (script.isDeferred()) {
- ScriptElementSupport.executeScriptIfNeeded(script);
- }
- }
- }
- }
- }
-
- /**
- * Sets the ready state on any deferred scripts, if necessary.
- */
- private void setReadyStateOnDeferredScriptsIfNeeded() {
- if (getWebClient().isJavaScriptEnabled() && hasFeature(JS_DEFERRED)) {
- final List elements = getDocumentElement().getElementsByTagName("script");
- for (final HtmlElement e : elements) {
- if (e instanceof HtmlScript) {
- final HtmlScript script = (HtmlScript) e;
- if (script.isDeferred()) {
- script.setAndExecuteReadyState(READY_STATE_COMPLETE);
- }
+ final DomElement doc = getDocumentElement();
+ final List elements = new ArrayList(doc.getElementsByTagName("script"));
+ for (final HtmlElement e : elements) {
+ if (e instanceof HtmlScript) {
+ final HtmlScript script = (HtmlScript) e;
+ if (script.isDeferred() && ATTRIBUTE_NOT_DEFINED != script.getSrcAttribute()) {
+ ScriptElementSupport.executeScriptIfNeeded(script, true, true);
}
}
}
@@ -1939,7 +1919,7 @@ void loadFrames() throws FailingHttpStatusCodeException {
// if a script has already changed its content, it should be skipped
// use == and not equals(...) to identify initial content (versus URL set to "about:blank")
if (frame.getEnclosedWindow() != null
- && WebClient.URL_ABOUT_BLANK == frame.getEnclosedPage().getUrl()
+ && UrlUtils.URL_ABOUT_BLANK == frame.getEnclosedPage().getUrl()
&& !frame.isContentLoaded()) {
frame.loadInnerPage();
}
@@ -2340,7 +2320,7 @@ public URL getBaseURL() {
final WebWindow window = getEnclosingWindow();
final boolean frame = window != null && window != window.getTopWindow();
if (frame) {
- final boolean frameSrcIsNotSet = baseUrl == WebClient.URL_ABOUT_BLANK;
+ final boolean frameSrcIsNotSet = baseUrl == UrlUtils.URL_ABOUT_BLANK;
final boolean frameSrcIsJs = "javascript".equals(baseUrl.getProtocol());
if (frameSrcIsNotSet || frameSrcIsJs) {
baseUrl = ((HtmlPage) window.getTopWindow().getEnclosedPage()).getWebResponse()
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParagraph.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParagraph.java
index 634c5edd3..65e8112e9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParagraph.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParagraph.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParameter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParameter.java
index dbbedc8a2..132a07758 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParameter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlParameter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInput.java
index f1743f99a..a29ec810d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPicture.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPicture.java
index 70f4cbf17..8ac55f1e4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPicture.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPicture.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPlainText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPlainText.java
index fdaff1ba7..e9a8856bd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPlainText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPlainText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPreformattedText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPreformattedText.java
index 2fef08d62..db4209793 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPreformattedText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPreformattedText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java
index 8f578a9ea..6ec1eb15f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlProgress.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java
index eca082b1e..af80237e9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRadioButtonInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -230,8 +230,10 @@ protected void doClickFireChangeEvent() {
* A radio button does not have a textual representation,
* but we invent one for it because it is useful for testing.
* @return "checked" or "unchecked" according to the radio state
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return super.asText();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRangeInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRangeInput.java
index 05aad5615..54fedbc81 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRangeInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRangeInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlResetInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlResetInput.java
index cf95abb91..738eeff12 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlResetInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlResetInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -38,7 +38,7 @@ public class HtmlResetInput extends HtmlInput implements LabelableElement {
/**
* Value to use if no specified value attribute.
*/
- private static final String DEFAULT_VALUE = "Reset";
+ public static final String DEFAULT_VALUE = "Reset";
/**
* Creates an instance.
@@ -109,7 +109,10 @@ public void reset() {
/**
* {@inheritDoc} Returns "Reset" if value attribute is not defined.
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
+ @Deprecated
@Override
public String asText() {
String text = getValueAttribute();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRp.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRp.java
index 646957ac0..fb7fcaafa 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRp.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRp.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRt.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRt.java
index 342280197..16e60810a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRt.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRt.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRuby.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRuby.java
index 982579c31..d806903e1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRuby.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlRuby.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlS.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlS.java
index 6c20fc3b5..f49ea85ce 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlS.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlS.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSample.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSample.java
index 60dbd5037..ab885a91f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSample.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSample.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
index 285128e29..c5fc35554 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -135,10 +135,10 @@ public final String getDeferAttribute() {
}
/**
- * Returns {@code true} if this script is deferred.
- * @return {@code true} if this script is deferred
+ * {@inheritDoc}
*/
- protected boolean isDeferred() {
+ @Override
+ public boolean isDeferred() {
return getDeferAttribute() != ATTRIBUTE_NOT_DEFINED;
}
@@ -170,10 +170,10 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN
notifyMutationObservers);
if (isAttachedToPage() && oldValue.isEmpty() && getFirstChild() == null) {
- final PostponedAction action = new PostponedAction(getPage()) {
+ final PostponedAction action = new PostponedAction(getPage(), "HtmlScript.setAttributeNS") {
@Override
public void execute() {
- ScriptElementSupport.executeScriptIfNeeded(HtmlScript.this);
+ ScriptElementSupport.executeScriptIfNeeded(HtmlScript.this, false, false);
}
};
final AbstractJavaScriptEngine> engine = getPage().getWebClient().getJavaScriptEngine();
@@ -206,19 +206,14 @@ private String getScriptCode() {
return scriptCode.toString();
}
- /**
- * Sets the readyState to the specified state and executes the
- * onreadystatechange handler when simulating IE.
- * @param state this script ready state
- */
- protected void setAndExecuteReadyState(final String state) {
- }
-
/**
* @see com.gargoylesoftware.htmlunit.html.HtmlInput#asText()
+ *
* @return an empty string as the content of script is not visible by itself
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return "";
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSearchInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSearchInput.java
index 132aa7c1a..1deec1591 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSearchInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSearchInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java
index 94240f9c1..6aa951436 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java
index ad28a47c8..daa7d2ef3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSelect.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -554,8 +554,10 @@ public HtmlOption getOptionByText(final String text) throws ElementNotFoundExcep
* If the user can select multiple options, this method returns all options.
*
* @return the element as text
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
final List options;
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializer.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializer.java
index d55b8ad96..d9410a3c2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializer.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializer.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -22,6 +22,7 @@
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSerializer.HtmlSerializerTextBuilder.Mode;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerNormalizedText;
import com.gargoylesoftware.htmlunit.javascript.host.Element;
/**
@@ -31,7 +32,10 @@
* @author Ahmed Ashour
* @author Ronald Brill
* @author Rob Kodey
+ *
+ * @deprecated as of version 2.48.0; use {@link HtmlSerializerNormalizedText} instead
*/
+@Deprecated
public class HtmlSerializer {
private boolean ignoreMaskedElements_ = true;
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSlot.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSlot.java
index 1384ac98e..7cbca92a7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSlot.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSlot.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSmall.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSmall.java
index 6bdc3a66e..02ec98f57 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSmall.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSmall.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSource.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSource.java
index fbdde2fb6..b2d0209d9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSource.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSource.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpan.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpan.java
index 6506ba734..ecf8e9bae 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpan.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSpan.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrike.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrike.java
index 036c0d3cc..80b8052ad 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrike.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrike.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrong.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrong.java
index fc77222e2..ce5101606 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrong.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStrong.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStyle.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStyle.java
index ef1805ede..c00ff0f54 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStyle.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlStyle.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -89,8 +89,10 @@ public final String getTitleAttribute() {
/**
* @see com.gargoylesoftware.htmlunit.html.HtmlInput#asText()
* @return an empty string as the content of style is not visible by itself
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
- // we need to preserve this method as it is there since many versions with the above documentation.
+ @Deprecated
@Override
public String asText() {
return "";
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubmitInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubmitInput.java
index 0d00d4cb7..c07e86b0d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubmitInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubmitInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -42,7 +42,7 @@ public class HtmlSubmitInput extends HtmlInput implements LabelableElement {
/**
* Value to use if no specified value attribute.
*/
- private static final String DEFAULT_VALUE = "Submit Query";
+ public static final String DEFAULT_VALUE = "Submit Query";
/**
* Creates an instance.
@@ -113,7 +113,10 @@ public void reset() {
/**
* {@inheritDoc} Returns "Submit Query" if value attribute is not defined.
+ *
+ * @deprecated as of version 2.48.0; use asNormalizedText() instead
*/
+ @Deprecated
@Override
public String asText() {
String text = getValueAttribute();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubscript.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubscript.java
index 7a9131b64..e77ba3afb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubscript.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSubscript.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSummary.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSummary.java
index 386bd5dec..7c1735b63 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSummary.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSummary.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSuperscript.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSuperscript.java
index 8f9ce0163..a36fbed95 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSuperscript.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSuperscript.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSvg.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSvg.java
index e378307f7..5a317a380 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSvg.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSvg.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTable.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTable.java
index 23dc3dfa3..be322782c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTable.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTable.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableBody.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableBody.java
index 2d0809675..bd3ec4df0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableBody.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableBody.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableCell.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableCell.java
index 1e993103e..a827e5f65 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableCell.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableCell.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumn.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumn.java
index b27ac94a0..4be6aeae4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumn.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumn.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumnGroup.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumnGroup.java
index 0c6e0eb49..5183c7fb1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumnGroup.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableColumnGroup.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableDataCell.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableDataCell.java
index 70dcde250..523bff717 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableDataCell.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableDataCell.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableFooter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableFooter.java
index 2a63dfca8..66684c17d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableFooter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableFooter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeader.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeader.java
index d15c00cb9..411538235 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeader.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeader.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeaderCell.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeaderCell.java
index 81ddeb388..4e27a4696 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeaderCell.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableHeaderCell.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java
index 614c52b40..f89974af4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTelInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTelInput.java
index 71292e0b1..eee441f5b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTelInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTelInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTeletype.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTeletype.java
index 4258c3074..2fd85b166 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTeletype.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTeletype.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTemplate.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTemplate.java
index 3e0180370..494a55921 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTemplate.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTemplate.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java
index 80203c4b9..866d6b948 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextInput.java
index 655695161..387f6ab24 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTextInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java
index fa3df254a..8895c910c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTime.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTimeInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTimeInput.java
index bf9c15b1f..2e02cfe12 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTimeInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTimeInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTitle.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTitle.java
index e77c74a2e..2aa6ab38a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTitle.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTitle.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTrack.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTrack.java
index b1d84aec2..98517e678 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTrack.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlTrack.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnderlined.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnderlined.java
index ecf956b0d..f2c4092da 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnderlined.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnderlined.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnknownElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnknownElement.java
index f635c0b63..66e86211e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnknownElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnknownElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedList.java
index a23f273cb..13e6e1c07 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUnorderedList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUrlInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUrlInput.java
index 20b736bae..bda6048aa 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUrlInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlUrlInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVariable.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVariable.java
index 7822aeefe..470ac8e84 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVariable.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVariable.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVideo.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVideo.java
index 22a048b5b..bcb692e34 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVideo.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlVideo.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWeekInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWeekInput.java
index 380ce7505..4071f2fa6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWeekInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWeekInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreak.java b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreak.java
index abc4d3492..3609193a3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreak.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlWordBreak.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/Keyboard.java b/src/main/java/com/gargoylesoftware/htmlunit/html/Keyboard.java
index 3eb775feb..6a2d6631a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/Keyboard.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/Keyboard.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/LabelableElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/LabelableElement.java
index eece23281..ef37655f5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/LabelableElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/LabelableElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElement.java
index 89ac4b0d1..f8193221b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -27,6 +27,12 @@ public interface ScriptElement {
*/
boolean isExecuted();
+ /**
+ * Returns {@code true} if this script is deferred.
+ * @return {@code true} if this script is deferred
+ */
+ boolean isDeferred();
+
/**
* Sets if executed.
* @param executed if executed
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java b/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java
index 1fcad5ef4..b77cfc221 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -84,14 +84,20 @@ public static void onAllChildrenAddedToPage(final DomElement element, final bool
if (!element.getPage().getWebClient().isJavaScriptEngineEnabled()) {
if (LOG.isDebugEnabled()) {
- LOG.debug("SvgScript found but not executed because javascript engine is disabled");
+ LOG.debug("Script found but not executed because javascript engine is disabled");
}
return;
}
+ final ScriptElement script = (ScriptElement) element;
+ final String srcAttrib = script.getSrcAttribute();
+ if (ATTRIBUTE_NOT_DEFINED != srcAttrib
+ && script.isDeferred()) {
+ return;
+ }
+
final WebWindow webWindow = element.getPage().getEnclosingWindow();
if (webWindow != null) {
- final String srcAttrib = ((ScriptElement) element).getSrcAttribute();
final StringBuilder description = new StringBuilder()
.append("Execution of ")
.append(srcAttrib == ATTRIBUTE_NOT_DEFINED ? "inline " : "external ")
@@ -111,7 +117,7 @@ public void execute() {
&& srcAttrib != ATTRIBUTE_NOT_DEFINED);
}
try {
- executeScriptIfNeeded(element);
+ executeScriptIfNeeded(element, false, false);
}
finally {
if (jsDoc != null) {
@@ -151,9 +157,12 @@ else if (engine != null
*
* Executes this script node if necessary and/or possible.
* @param element the element
+ * @param ignoreAttachedToPage don't do the isAttachedToPage check
+ * @param ignorePageIsAncestor don't do the element.getPage().isAncestorOf(element) check
*/
- public static void executeScriptIfNeeded(final DomElement element) {
- if (!isExecutionNeeded(element)) {
+ public static void executeScriptIfNeeded(final DomElement element, final boolean ignoreAttachedToPage,
+ final boolean ignorePageIsAncestor) {
+ if (!isExecutionNeeded(element, ignoreAttachedToPage, ignorePageIsAncestor)) {
return;
}
@@ -234,14 +243,17 @@ else if (element.getFirstChild() != null) {
* Indicates if script execution is necessary and/or possible.
*
* @param element the element
+ * @param ignoreAttachedToPage don't do the isAttachedToPage check
+ * @param ignorePageIsAncestor don't do the element.getPage().isAncestorOf(element) check
* @return {@code true} if the script should be executed
*/
- private static boolean isExecutionNeeded(final DomElement element) {
+ private static boolean isExecutionNeeded(final DomElement element, final boolean ignoreAttachedToPage,
+ final boolean ignorePageIsAncestor) {
if (((ScriptElement) element).isExecuted()) {
return false;
}
- if (!element.isAttachedToPage()) {
+ if (!ignoreAttachedToPage && !element.isAttachedToPage()) {
return false;
}
@@ -285,7 +297,7 @@ private static boolean isExecutionNeeded(final DomElement element) {
// If the script's root ancestor node is not the page, then the script is not a part of the page.
// If it isn't yet part of the page, don't execute the script; it's probably just being cloned.
- return element.getPage().isAncestorOf(element);
+ return ignorePageIsAncestor || element.getPage().isAncestorOf(element);
}
/**
@@ -326,7 +338,7 @@ private static void executeEvent(final DomElement element, final String type) {
* Executes this script node as inline script if necessary and/or possible.
*/
private static void executeInlineScriptIfNeeded(final DomElement element) {
- if (!isExecutionNeeded(element)) {
+ if (!isExecutionNeeded(element, false, false)) {
return;
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/SiblingDomNodeList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/SiblingDomNodeList.java
index 95a694b2f..5209bc105 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/SiblingDomNodeList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/SiblingDomNodeList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/StaticDomNodeList.java b/src/main/java/com/gargoylesoftware/htmlunit/html/StaticDomNodeList.java
index b57abf922..cfef02387 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/StaticDomNodeList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/StaticDomNodeList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/SubmittableElement.java b/src/main/java/com/gargoylesoftware/htmlunit/html/SubmittableElement.java
index e752f1409..cf51d8c7f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/SubmittableElement.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/SubmittableElement.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/TableRowGroup.java b/src/main/java/com/gargoylesoftware/htmlunit/html/TableRowGroup.java
index c3afd951d..e217980fa 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/TableRowGroup.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/TableRowGroup.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/UnknownElementFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/html/UnknownElementFactory.java
index eb0bbb5e6..d137fb4cd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/UnknownElementFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/UnknownElementFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/XHtmlPage.java b/src/main/java/com/gargoylesoftware/htmlunit/html/XHtmlPage.java
index 730c82def..bf05e343b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/XHtmlPage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/XHtmlPage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java b/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java
index 9459230f0..d4a4b1fcc 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/XmlSerializer.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletClassLoader.java b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletClassLoader.java
index 723d18931..cf7d01f70 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletClassLoader.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletClassLoader.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletContextImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletContextImpl.java
index 009a6b0d7..ac0debe55 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletContextImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletContextImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletStubImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletStubImpl.java
index ca9e2161d..e9d7a24f7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletStubImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/AppletStubImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/package-info.java
index 236848555..115c110c5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/applets/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/applets/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextInput.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextInput.java
index 6213fcdf9..99a6be92f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextInput.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextInput.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextSelectionDelegate.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextSelectionDelegate.java
index 4177e6082..967ad66ce 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextSelectionDelegate.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectableTextSelectionDelegate.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectionDelegate.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectionDelegate.java
index 8e6bb4909..a2b52a3cd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectionDelegate.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SelectionDelegate.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleRange.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleRange.java
index 18a4560f6..3056392a4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleRange.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleRange.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleSelectionDelegate.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleSelectionDelegate.java
index 6d1f94e09..8c70f6d14 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleSelectionDelegate.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/SimpleSelectionDelegate.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/package-info.java
index a548c7b08..a466f30d8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/impl/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/impl/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/package-info.java
index d81a67c19..e2ef8d53d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParser.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParser.java
index 61b6ed116..ea0beb5b9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParser.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParser.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserDOMBuilder.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserDOMBuilder.java
index bed825fd5..aaffca689 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserDOMBuilder.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserDOMBuilder.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserListener.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserListener.java
index f39147d1c..7cc416f88 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/HTMLParserListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java
index 17a75c223..590ff6891 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java
index 6f04a34c1..f556c536e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/HtmlUnitNekoHtmlParser.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/package-info.java
index dcaf0be1a..bd4b5da42 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/neko/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/package-info.java
index 43b6bca56..2f9c4a729 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/parser/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/parser/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java
new file mode 100644
index 000000000..0bc76802a
--- /dev/null
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerInnerOuterText.java
@@ -0,0 +1,569 @@
+/*
+ * Copyright (c) 2002-2021 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
+ * https://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.html.serializer;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlBreak;
+import com.gargoylesoftware.htmlunit.html.HtmlDetails;
+import com.gargoylesoftware.htmlunit.html.HtmlListItem;
+import com.gargoylesoftware.htmlunit.html.HtmlNoFrames;
+import com.gargoylesoftware.htmlunit.html.HtmlParagraph;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import com.gargoylesoftware.htmlunit.html.HtmlStyle;
+import com.gargoylesoftware.htmlunit.html.HtmlSummary;
+import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
+import com.gargoylesoftware.htmlunit.html.HtmlTitle;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerInnerOuterText.HtmlSerializerTextBuilder.Mode;
+import com.gargoylesoftware.htmlunit.javascript.host.Element;
+import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration;
+import com.gargoylesoftware.htmlunit.javascript.host.css.StyleAttributes.Definition;
+import com.gargoylesoftware.htmlunit.javascript.host.dom.Node;
+
+/**
+ * Special serializer to generate the output we need
+ * for innerText and outerText.
+ *
+ * @author Ronald Brill
+ */
+public class HtmlSerializerInnerOuterText {
+
+ /**
+ * Converts an HTML node to text.
+ * @param node a node
+ * @return the text representation according to the setting of this serializer
+ */
+ public String asText(final DomNode node) {
+ if (node instanceof HtmlBreak) {
+ return "";
+ }
+ final HtmlSerializerTextBuilder builder = new HtmlSerializerTextBuilder();
+ appendNode(builder, node, whiteSpaceStyle(node, Mode.WHITE_SPACE_NORMAL));
+ return builder.getText();
+ }
+
+ /**
+ * Iterate over all Children and call appendNode() for every.
+ *
+ * @param builder the StringBuilder to add to
+ * @param node the node to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendChildren(final HtmlSerializerTextBuilder builder, final DomNode node, final Mode mode) {
+ for (final DomNode child : node.getChildren()) {
+ appendNode(builder, child, mode);
+ }
+ }
+
+ /**
+ * The core distribution method call the different appendXXX
+ * methods depending on the type of the given node.
+ *
+ * @param builder the StringBuilder to add to
+ * @param node the node to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendNode(final HtmlSerializerTextBuilder builder, final DomNode node, final Mode mode) {
+ if (node instanceof DomText) {
+ appendText(builder, (DomText) node, mode);
+ }
+ else if (node instanceof HtmlBreak) {
+ appendBreak(builder, (HtmlBreak) node);
+ }
+ else if (node instanceof HtmlParagraph) {
+ appendParagraph(builder, (HtmlParagraph) node, mode);
+ }
+ else if (node instanceof HtmlListItem) {
+ appendListItem(builder, (HtmlListItem) node, mode);
+ }
+ else if (node instanceof HtmlDetails) {
+ appendDetails(builder, (HtmlDetails) node, mode);
+ }
+ else if (node instanceof HtmlNoFrames) {
+ appendChildren(builder, node, Mode.PLAIN);
+ }
+ else if (node instanceof HtmlTextArea) {
+ //
+ }
+ else {
+ appendDomNode(builder, node, mode);
+ }
+ }
+
+ /**
+ * Process {@link DomNode}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param domNode the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendDomNode(final HtmlSerializerTextBuilder builder,
+ final DomNode domNode, final Mode mode) {
+// final boolean block;
+// final Object scriptableObject = domNode.getScriptableObject();
+// if (domNode instanceof HtmlBody) {
+// block = false;
+// }
+// else if (scriptableObject instanceof Element) {
+// final Element element = (Element) scriptableObject;
+// final String display = element.getWindow().getComputedStyle(element, null).getDisplay();
+// block = "block".equals(display);
+// }
+// else {
+// block = false;
+// }
+//
+// if (block) {
+// builder.appendBlockSeparator();
+// }
+ appendChildren(builder, domNode, mode);
+// if (block) {
+// builder.appendBlockSeparator();
+// }
+ }
+
+ /**
+ * Process {@link DomText}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param domText the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendText(final HtmlSerializerTextBuilder builder, final DomText domText, final Mode mode) {
+ final DomNode parent = domText.getParentNode();
+ if (parent instanceof HtmlTitle
+ || parent instanceof HtmlStyle
+ || parent instanceof HtmlScript) {
+ builder.append(domText.getData(), Mode.PLAIN);
+ return;
+ }
+
+ if (parent == null
+ || parent instanceof HtmlNoFrames
+ || parent.isDisplayed()) {
+ builder.append(domText.getData(), mode);
+ }
+ }
+
+ /**
+ * Process {@link HtmlBreak}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlBreak the target to process
+ */
+ protected void appendBreak(final HtmlSerializerTextBuilder builder,
+ final HtmlBreak htmlBreak) {
+ builder.appendRequiredLineBreak();
+ }
+
+ /**
+ * Process {@link HtmlListItem}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlParagraph the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendParagraph(final HtmlSerializerTextBuilder builder,
+ final HtmlParagraph htmlParagraph, final Mode mode) {
+ builder.appendRequiredLineBreak();
+ appendChildren(builder, htmlParagraph, mode);
+ builder.appendRequiredLineBreak();
+ }
+
+ /**
+ * Process {@link HtmlListItem}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlListItem the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendListItem(final HtmlSerializerTextBuilder builder,
+ final HtmlListItem htmlListItem, final Mode mode) {
+ builder.appendRequiredLineBreak();
+ appendChildren(builder, htmlListItem, mode);
+ builder.appendRequiredLineBreak();
+ }
+
+ /**
+ * Process {@link HtmlDetails}.
+ * @param builder the StringBuilder to add to
+ * @param htmlDetails the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendDetails(final HtmlSerializerTextBuilder builder,
+ final HtmlDetails htmlDetails, final Mode mode) {
+ if (htmlDetails.isOpen()) {
+ appendChildren(builder, htmlDetails, mode);
+ return;
+ }
+
+ for (final DomNode child : htmlDetails.getChildren()) {
+ if (child instanceof HtmlSummary) {
+ appendNode(builder, child, mode);
+ }
+ }
+ }
+
+ private Mode whiteSpaceStyle(final DomNode domNode, final Mode defaultMode) {
+ final Object scriptableObject = domNode.getScriptableObject();
+ if (scriptableObject instanceof Node) {
+ final Page page = domNode.getPage();
+ if (page != null && page.getEnclosingWindow().getWebClient().getOptions().isCssEnabled()) {
+ Node node = (Node) scriptableObject;
+
+ while (node != null) {
+ if (node instanceof Element) {
+ final ComputedCSSStyleDeclaration style = node.getWindow().getComputedStyle(node, null);
+ final String value = style.getStyleAttribute(Definition.WHITE_SPACE, false);
+ if (StringUtils.isNoneEmpty(value)) {
+ if ("normal".equalsIgnoreCase(value)) {
+ return Mode.WHITE_SPACE_NORMAL;
+ }
+ if ("nowrap".equalsIgnoreCase(value)) {
+ return Mode.WHITE_SPACE_NORMAL;
+ }
+ if ("pre".equalsIgnoreCase(value)) {
+ return Mode.WHITE_SPACE_PRE;
+ }
+ if ("pre-wrap".equalsIgnoreCase(value)) {
+ return Mode.WHITE_SPACE_PRE;
+ }
+ if ("pre-line".equalsIgnoreCase(value)) {
+ return Mode.WHITE_SPACE_PRE_LINE;
+ }
+ }
+ }
+ node = node.getParentElement();
+ }
+ }
+ }
+ return defaultMode;
+ }
+
+ protected static class HtmlSerializerTextBuilder {
+ /** Mode. */
+ protected enum Mode {
+ /**
+ * The mode for plain.
+ */
+ PLAIN,
+
+ /**
+ * Sequences of white space are collapsed. Newline characters
+ * in the source are handled the same as other white space.
+ * Lines are broken as necessary to fill line boxes.
+ */
+ WHITE_SPACE_NORMAL,
+
+ /**
+ * Sequences of white space are preserved. Lines are only broken
+ * at newline characters in the source and at elements.
+ */
+ WHITE_SPACE_PRE,
+
+ /**
+ * Sequences of white space are collapsed. Lines are broken
+ * at newline characters, at , and as necessary
+ * to fill line boxes.
+ */
+ WHITE_SPACE_PRE_LINE
+ }
+
+ private enum State {
+ DEFAULT,
+ EMPTY,
+ BLANK_AT_END,
+ BLANK_AT_END_AFTER_NEWLINE,
+ NEWLINE_AT_END,
+ BREAK_AT_END,
+ BLOCK_SEPARATOR_AT_END,
+ REQUIRED_LINE_BREAK_AT_END
+ }
+
+ private State state_;
+ private final StringBuilder builder_;
+ private int trimRightPos_;
+// private boolean contentAdded_;
+// private boolean ignoreHtmlBreaks_;
+
+ public HtmlSerializerTextBuilder() {
+ builder_ = new StringBuilder();
+ state_ = State.EMPTY;
+ trimRightPos_ = 0;
+ }
+
+ public void appendRequiredLineBreak() {
+ if (state_ == State.EMPTY) {
+ return;
+ }
+
+ // trimRight
+ builder_.setLength(trimRightPos_);
+ if (trimRightPos_ == 0) {
+ state_ = State.EMPTY;
+ }
+
+ builder_.append('\n');
+ state_ = State.REQUIRED_LINE_BREAK_AT_END;
+ }
+
+ // see https://drafts.csswg.org/css-text-3/#white-space
+ public void append(final String content, final Mode mode) {
+ int length = content.length();
+ if (length == 0) {
+ return;
+ }
+
+ if (mode == Mode.PLAIN) {
+ builder_.append(content);
+ state_ = State.DEFAULT;
+ trimRightPos_ = builder_.length();
+ return;
+ }
+
+ length--;
+ int i = -1;
+ for (char c : content.toCharArray()) {
+ i++;
+
+ // handle \r
+ if (c == '\r') {
+ if (length != i) {
+ continue;
+ }
+ c = '\n';
+ }
+
+ if (c == '\n') {
+ if (mode == Mode.WHITE_SPACE_PRE) {
+ switch (state_) {
+ case EMPTY:
+ case BLOCK_SEPARATOR_AT_END:
+ break;
+ default:
+ builder_.append('\n');
+ state_ = State.NEWLINE_AT_END;
+ trimRightPos_ = builder_.length();
+ break;
+ }
+ continue;
+ }
+
+ if (mode == Mode.WHITE_SPACE_PRE_LINE) {
+ switch (state_) {
+ case EMPTY:
+ case BLOCK_SEPARATOR_AT_END:
+ break;
+ case BLANK_AT_END:
+ builder_.setLength(trimRightPos_);
+ builder_.append('\n');
+ state_ = State.NEWLINE_AT_END;
+ trimRightPos_ = builder_.length();
+ break;
+ default:
+ builder_.append('\n');
+ state_ = State.NEWLINE_AT_END;
+ trimRightPos_ = builder_.length();
+ break;
+ }
+ continue;
+ }
+
+ switch (state_) {
+ case EMPTY:
+ case BLANK_AT_END:
+ case BLANK_AT_END_AFTER_NEWLINE:
+ case BLOCK_SEPARATOR_AT_END:
+ case NEWLINE_AT_END:
+ case BREAK_AT_END:
+ case REQUIRED_LINE_BREAK_AT_END:
+ break;
+ default:
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END;
+ break;
+ }
+ continue;
+ }
+
+ if (c == ' ' || c == '\t' || c == '\f') {
+ if (mode == Mode.WHITE_SPACE_PRE) {
+ if (c == '\t') {
+ builder_.append('\t');
+ state_ = State.BLANK_AT_END;
+ trimRightPos_ = builder_.length();
+ }
+ else {
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END;
+ trimRightPos_ = builder_.length();
+ }
+
+ continue;
+ }
+
+ if (mode == Mode.WHITE_SPACE_PRE_LINE) {
+ switch (state_) {
+ case EMPTY:
+ case BLANK_AT_END:
+ case BLANK_AT_END_AFTER_NEWLINE:
+ case BREAK_AT_END:
+ case NEWLINE_AT_END:
+ break;
+ default:
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END;
+ break;
+ }
+ continue;
+ }
+
+ switch (state_) {
+ case EMPTY:
+ case BLANK_AT_END:
+ case BLANK_AT_END_AFTER_NEWLINE:
+ case BLOCK_SEPARATOR_AT_END:
+ case NEWLINE_AT_END:
+ case BREAK_AT_END:
+ case REQUIRED_LINE_BREAK_AT_END:
+ break;
+ default:
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END;
+ break;
+ }
+ continue;
+ }
+
+// if (c == (char) 160) {
+// builder_.append(' ');
+// state = State.BLANK_AT_END;
+// trimRightPos = builder_.length();
+//
+// if (mode == Mode.WHITE_SPACE_NORMAL || mode == Mode.WHITE_SPACE_PRE_LINE) {
+// state = State.DEFAULT;
+// }
+// continue;
+// }
+ builder_.append(c);
+ state_ = State.DEFAULT;
+ trimRightPos_ = builder_.length();
+ // contentAdded_ = true;
+ }
+ }
+
+// public void appendBlockSeparator() {
+// switch (state_) {
+// case EMPTY:
+// break;
+// case BLANK_AT_END:
+// builder_.setLength(trimRightPos_);
+// if (builder_.length() == 0) {
+// state_ = State.EMPTY;
+// }
+// else {
+// builder_.append('\n');
+// state_ = State.BLOCK_SEPARATOR_AT_END;
+// }
+// break;
+// case BLANK_AT_END_AFTER_NEWLINE:
+// builder_.setLength(trimRightPos_ - 1);
+// if (builder_.length() == 0) {
+// state_ = State.EMPTY;
+// }
+// else {
+// builder_.append('\n');
+// state_ = State.BLOCK_SEPARATOR_AT_END;
+// }
+// break;
+// case BLOCK_SEPARATOR_AT_END:
+// break;
+// case NEWLINE_AT_END:
+// case BREAK_AT_END:
+// builder_.setLength(builder_.length() - 1);
+// trimRightPos_ = trimRightPos_ - 1;
+// if (builder_.length() == 0) {
+// state_ = State.EMPTY;
+// }
+// else {
+// builder_.append('\n');
+// state_ = State.BLOCK_SEPARATOR_AT_END;
+// }
+// break;
+// default:
+// builder_.append('\n');
+// state_ = State.BLOCK_SEPARATOR_AT_END;
+// break;
+// }
+// }
+
+// public void appendBreak(final Mode mode) {
+// if (ignoreHtmlBreaks_) {
+// return;
+// }
+//
+// builder_.setLength(trimRightPos_);
+//
+// builder_.append('\n');
+// state_ = State.BREAK_AT_END;
+// trimRightPos_ = builder_.length();
+// }
+
+// public void trimRight(final Mode mode) {
+// if (mode == Mode.PRE) {
+// switch (state_) {
+// case BLOCK_SEPARATOR_AT_END:
+// case NEWLINE_AT_END:
+// case BREAK_AT_END:
+// if (trimRightPos_ == builder_.length()) {
+// trimRightPos_--;
+// }
+// break;
+// default:
+// break;
+// }
+// }
+//
+// builder_.setLength(trimRightPos_);
+// state_ = State.DEFAULT;
+// if (builder_.length() == 0) {
+// state_ = State.EMPTY;
+// }
+// }
+
+// public boolean wasContentAdded() {
+// return contentAdded_;
+// }
+//
+// public void resetContentAdded() {
+// contentAdded_ = false;
+// }
+//
+// public void ignoreHtmlBreaks() {
+// ignoreHtmlBreaks_ = true;
+// }
+//
+// public void processHtmlBreaks() {
+// ignoreHtmlBreaks_ = false;
+// }
+
+ public String getText() {
+ return builder_.substring(0, trimRightPos_);
+ }
+ }
+}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerNormalizedText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerNormalizedText.java
new file mode 100644
index 000000000..0fbec0578
--- /dev/null
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerNormalizedText.java
@@ -0,0 +1,765 @@
+/*
+ * Copyright (c) 2002-2021 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
+ * https://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.html.serializer;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.SgmlPage;
+import com.gargoylesoftware.htmlunit.html.DomComment;
+import com.gargoylesoftware.htmlunit.html.DomElement;
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlApplet;
+import com.gargoylesoftware.htmlunit.html.HtmlBody;
+import com.gargoylesoftware.htmlunit.html.HtmlBreak;
+import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
+import com.gargoylesoftware.htmlunit.html.HtmlDetails;
+import com.gargoylesoftware.htmlunit.html.HtmlHiddenInput;
+import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlListItem;
+import com.gargoylesoftware.htmlunit.html.HtmlNoFrames;
+import com.gargoylesoftware.htmlunit.html.HtmlNoScript;
+import com.gargoylesoftware.htmlunit.html.HtmlNumberInput;
+import com.gargoylesoftware.htmlunit.html.HtmlOption;
+import com.gargoylesoftware.htmlunit.html.HtmlOrderedList;
+import com.gargoylesoftware.htmlunit.html.HtmlPreformattedText;
+import com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlResetInput;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import com.gargoylesoftware.htmlunit.html.HtmlSelect;
+import com.gargoylesoftware.htmlunit.html.HtmlStyle;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlSummary;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableFooter;
+import com.gargoylesoftware.htmlunit.html.HtmlTableHeader;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
+import com.gargoylesoftware.htmlunit.html.HtmlTitle;
+import com.gargoylesoftware.htmlunit.html.HtmlUnorderedList;
+import com.gargoylesoftware.htmlunit.html.TableRowGroup;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerNormalizedText.HtmlSerializerTextBuilder.Mode;
+import com.gargoylesoftware.htmlunit.javascript.host.Element;
+
+/**
+ * Utility to handle conversion from HTML code to string.
+ *
+ * @author Marc Guillemot
+ * @author Ahmed Ashour
+ * @author Ronald Brill
+ * @author Rob Kodey
+ */
+public class HtmlSerializerNormalizedText {
+
+ private boolean ignoreMaskedElements_ = true;
+
+ /**
+ * Converts an HTML node to text.
+ * @param node a node
+ * @return the text representation according to the setting of this serializer
+ */
+ public String asText(final DomNode node) {
+ final HtmlSerializerTextBuilder builder = new HtmlSerializerTextBuilder();
+ appendNode(builder, node);
+ return builder.getText();
+ }
+
+ /**
+ * Iterate over all Children and call appendNode() for every.
+ *
+ * @param builder the StringBuilder to add to
+ * @param node the node to process
+ */
+ protected void appendChildren(final HtmlSerializerTextBuilder builder, final DomNode node) {
+ for (final DomNode child : node.getChildren()) {
+ appendNode(builder, child);
+ }
+ }
+
+ /**
+ * The core distribution method call the different appendXXX
+ * methods depending on the type of the given node.
+ *
+ * @param builder the StringBuilder to add to
+ * @param node the node to process
+ */
+ protected void appendNode(final HtmlSerializerTextBuilder builder, final DomNode node) {
+ if (node instanceof DomText) {
+ appendText(builder, (DomText) node);
+ }
+ else if (node instanceof DomComment) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlApplet
+ && node.getPage().getWebClient().getOptions().isAppletEnabled()) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlBreak) {
+ appendBreak(builder, (HtmlBreak) node);
+ }
+ else if (node instanceof HtmlHiddenInput) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlScript) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlStyle) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlNoFrames) {
+ // nothing to do
+ }
+ else if (node instanceof HtmlTextArea) {
+ appendTextArea(builder, (HtmlTextArea) node);
+ }
+ else if (node instanceof HtmlTitle) {
+ appendTitle(builder, (HtmlTitle) node);
+ }
+ else if (node instanceof HtmlTableRow) {
+ appendTableRow(builder, (HtmlTableRow) node);
+ }
+ else if (node instanceof HtmlSelect) {
+ appendSelect(builder, (HtmlSelect) node);
+ }
+ else if (node instanceof HtmlSubmitInput) {
+ appendSubmitInput(builder, (HtmlSubmitInput) node);
+ }
+ else if (node instanceof HtmlResetInput) {
+ appendResetInput(builder, (HtmlResetInput) node);
+ }
+ else if (node instanceof HtmlCheckBoxInput) {
+ appendCheckBoxInput(builder, (HtmlCheckBoxInput) node);
+ }
+ else if (node instanceof HtmlRadioButtonInput) {
+ appendRadioButtonInput(builder, (HtmlRadioButtonInput) node);
+ }
+ else if (node instanceof HtmlNumberInput) {
+ appendNumberInput(builder, (HtmlNumberInput) node);
+ }
+ else if (node instanceof HtmlInput) {
+ appendInput(builder, (HtmlInput) node);
+ }
+ else if (node instanceof HtmlTable) {
+ appendTable(builder, (HtmlTable) node);
+ }
+ else if (node instanceof HtmlOrderedList) {
+ appendOrderedList(builder, (HtmlOrderedList) node);
+ }
+ else if (node instanceof HtmlUnorderedList) {
+ appendUnorderedList(builder, (HtmlUnorderedList) node);
+ }
+ else if (node instanceof HtmlPreformattedText) {
+ appendPreformattedText(builder, (HtmlPreformattedText) node);
+ }
+ else if (node instanceof HtmlInlineFrame) {
+ appendInlineFrame(builder, (HtmlInlineFrame) node);
+ }
+ else if (node instanceof HtmlDetails) {
+ appendDetails(builder, (HtmlDetails) node);
+ }
+ else if (node instanceof HtmlNoScript && node.getPage().getWebClient().isJavaScriptEnabled()) {
+ // nothing to do
+ }
+ else {
+ appendDomNode(builder, node);
+ }
+ }
+
+ /**
+ * Process {@link HtmlHiddenInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param domNode the target to process
+ */
+ protected void appendDomNode(final HtmlSerializerTextBuilder builder, final DomNode domNode) {
+ boolean block = false;
+ if (!(domNode instanceof HtmlBody)) {
+ final SgmlPage page = domNode.getPage();
+ if (page != null && page.getWebClient().isJavaScriptEngineEnabled()) {
+ final Object scriptableObject = domNode.getScriptableObject();
+ if (scriptableObject instanceof Element) {
+ final Element element = (Element) scriptableObject;
+ final String display = element.getWindow().getComputedStyle(element, null).getDisplay();
+ block = "block".equals(display);
+ }
+ }
+ }
+
+ if (block) {
+ builder.appendBlockSeparator();
+ }
+ appendChildren(builder, domNode);
+ if (block) {
+ builder.appendBlockSeparator();
+ }
+ }
+
+ /**
+ * Process {@link HtmlSubmitInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlSubmitInput the target to process
+ */
+ protected void appendSubmitInput(final HtmlSerializerTextBuilder builder, final HtmlSubmitInput htmlSubmitInput) {
+ String text = htmlSubmitInput.getValueAttribute();
+ if (text == DomElement.ATTRIBUTE_NOT_DEFINED) {
+ text = HtmlSubmitInput.DEFAULT_VALUE;
+ }
+
+ builder.append(text, Mode.NORMALIZE);
+ }
+
+ /**
+ * Process {@link HtmlInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlInput the target to process
+ */
+ protected void appendInput(final HtmlSerializerTextBuilder builder, final HtmlInput htmlInput) {
+ builder.append(" ", Mode.NORMALIZE);
+ builder.append(htmlInput.getValueAttribute(), Mode.NORMALIZE);
+ builder.append(" ", Mode.NORMALIZE);
+ }
+
+ /**
+ * Process {@link HtmlNumberInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlNumberInput the target to process
+ */
+ protected void appendNumberInput(final HtmlSerializerTextBuilder builder, final HtmlNumberInput htmlNumberInput) {
+ builder.append(" ", Mode.NORMALIZE);
+
+ String val = htmlNumberInput.getValueAttribute();
+ final int lastPos = val.length() - 1;
+ if (lastPos >= 0 && val.charAt(lastPos) == '.') {
+ val = val.substring(0, lastPos);
+ }
+ builder.append(val, Mode.NORMALIZE);
+
+ builder.append(" ", Mode.NORMALIZE);
+ }
+
+ /**
+ * Process {@link HtmlResetInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlResetInput the target to process
+ */
+ protected void appendResetInput(final HtmlSerializerTextBuilder builder, final HtmlResetInput htmlResetInput) {
+ String text = htmlResetInput.getValueAttribute();
+ if (text == DomElement.ATTRIBUTE_NOT_DEFINED) {
+ text = HtmlResetInput.DEFAULT_VALUE;
+ }
+
+ builder.append(text, Mode.NORMALIZE);
+ }
+
+ /**
+ * Process {@link HtmlUnorderedList}.
+ * @param builder the StringBuilder to add to
+ * @param htmlUnorderedList the target to process
+ */
+ protected void appendUnorderedList(final HtmlSerializerTextBuilder builder,
+ final HtmlUnorderedList htmlUnorderedList) {
+ builder.appendBlockSeparator();
+ boolean first = true;
+ for (final DomNode item : htmlUnorderedList.getChildren()) {
+ if (!first) {
+ builder.appendBlockSeparator();
+ }
+ first = false;
+ appendNode(builder, item);
+ }
+ builder.appendBlockSeparator();
+ }
+
+ /**
+ * Process {@link HtmlDetails}.
+ * @param builder the StringBuilder to add to
+ * @param htmlDetails the target to process
+ */
+ protected void appendDetails(final HtmlSerializerTextBuilder builder,
+ final HtmlDetails htmlDetails) {
+ if (htmlDetails.isOpen()) {
+ appendChildren(builder, htmlDetails);
+ return;
+ }
+
+ for (final DomNode child : htmlDetails.getChildren()) {
+ if (child instanceof HtmlSummary) {
+ appendNode(builder, child);
+ }
+ }
+ }
+
+ /**
+ * Process {@link HtmlTitle}.
+ * @param builder the StringBuilder to add to
+ * @param htmlTitle the target to process
+ */
+ protected void appendTitle(final HtmlSerializerTextBuilder builder, final HtmlTitle htmlTitle) {
+ // optimized version
+ // for the title there is no need to check the visibility
+ // of the containing dom text;
+ // this optimization defers the load of the style sheets
+ final DomNode child = htmlTitle.getFirstChild();
+ if (child instanceof DomText) {
+ builder.append(((DomText) child).getData(), Mode.NORMALIZE);
+ builder.appendBlockSeparator();
+ }
+ }
+
+ /**
+ * Process {@link HtmlTableRow}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlTableRow the target to process
+ */
+ protected void appendTableRow(final HtmlSerializerTextBuilder builder, final HtmlTableRow htmlTableRow) {
+ boolean first = true;
+ for (final HtmlTableCell cell : htmlTableRow.getCells()) {
+ if (!first) {
+ builder.appendTab();
+ }
+ else {
+ first = false;
+ }
+ appendChildren(builder, cell); // trim?
+ }
+ }
+
+ /**
+ * Process {@link HtmlTextArea}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlTextArea the target to process
+ */
+ protected void appendTextArea(final HtmlSerializerTextBuilder builder, final HtmlTextArea htmlTextArea) {
+ if (isVisible(htmlTextArea)) {
+ builder.append(htmlTextArea.getText(), Mode.PRESERVE_BLANK_NEWLINE);
+ }
+ }
+
+ /**
+ * Process {@link HtmlTable}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlTable the target to process
+ */
+ protected void appendTable(final HtmlSerializerTextBuilder builder, final HtmlTable htmlTable) {
+ builder.appendBlockSeparator();
+ final String caption = htmlTable.getCaptionText();
+ if (caption != null) {
+ builder.append(caption, Mode.NORMALIZE);
+ builder.appendBlockSeparator();
+ }
+
+ boolean first = true;
+
+ // first thead has to be displayed first and first tfoot has to be displayed last
+ final HtmlTableHeader tableHeader = htmlTable.getHeader();
+ if (tableHeader != null) {
+ first = appendTableRows(builder, tableHeader.getRows(), true, null, null);
+ }
+ final HtmlTableFooter tableFooter = htmlTable.getFooter();
+
+ final List tableRows = htmlTable.getRows();
+ first = appendTableRows(builder, tableRows, first, tableHeader, tableFooter);
+
+ if (tableFooter != null) {
+ first = appendTableRows(builder, tableFooter.getRows(), first, null, null);
+ }
+ else if (tableRows.isEmpty()) {
+ final DomNode firstChild = htmlTable.getFirstChild();
+ if (firstChild != null) {
+ appendNode(builder, firstChild);
+ }
+ }
+
+ builder.appendBlockSeparator();
+ }
+
+ /**
+ * Process {@link HtmlTableRow}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param rows the rows
+ * @param first if true this is the first one
+ * @param skipParent1 skip row if the parent is this
+ * @param skipParent2 skip row if the parent is this
+ * @return true if this was the first one
+ */
+ protected boolean appendTableRows(final HtmlSerializerTextBuilder builder,
+ final List rows, boolean first, final TableRowGroup skipParent1,
+ final TableRowGroup skipParent2) {
+ for (final HtmlTableRow row : rows) {
+ if (row.getParentNode() == skipParent1 || row.getParentNode() == skipParent2) {
+ continue;
+ }
+ if (!first) {
+ builder.appendBlockSeparator();
+ }
+ first = false;
+ appendTableRow(builder, row);
+ }
+ return first;
+ }
+
+ /**
+ * Process {@link HtmlSelect}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlSelect the target to process
+ */
+ protected void appendSelect(final HtmlSerializerTextBuilder builder, final HtmlSelect htmlSelect) {
+ final List options = htmlSelect.getSelectedOptions();
+
+ for (final Iterator i = options.iterator(); i.hasNext();) {
+ final HtmlOption currentOption = i.next();
+ appendChildren(builder, currentOption);
+ if (i.hasNext()) {
+ builder.appendBlockSeparator();
+ }
+ }
+ }
+
+ /**
+ * Process {@link HtmlOrderedList} taking care to numerate it.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlOrderedList the OL element
+ */
+ protected void appendOrderedList(final HtmlSerializerTextBuilder builder, final HtmlOrderedList htmlOrderedList) {
+ builder.appendBlockSeparator();
+ boolean first = true;
+ int i = 1;
+ for (final DomNode item : htmlOrderedList.getChildren()) {
+ if (!first) {
+ builder.appendBlockSeparator();
+ }
+ first = false;
+ if (item instanceof HtmlListItem) {
+ builder.append(Integer.toString(i++), Mode.NORMALIZE);
+ builder.append(". ", Mode.NORMALIZE);
+ appendChildren(builder, item);
+ }
+ else {
+ appendNode(builder, item);
+ }
+ }
+ builder.appendBlockSeparator();
+ }
+
+ /**
+ * Process {@link HtmlPreformattedText}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlPreformattedText the target to process
+ */
+ protected void appendPreformattedText(final HtmlSerializerTextBuilder builder,
+ final HtmlPreformattedText htmlPreformattedText) {
+ if (isVisible(htmlPreformattedText)) {
+ builder.appendBlockSeparator();
+ builder.append(htmlPreformattedText.getTextContent(), Mode.PRESERVE_BLANK_TAB_NEWLINE);
+ builder.appendBlockSeparator();
+ }
+ }
+
+ /**
+ * Process {@link HtmlInlineFrame}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlInlineFrame the target to process
+ */
+ protected void appendInlineFrame(final HtmlSerializerTextBuilder builder,
+ final HtmlInlineFrame htmlInlineFrame) {
+ if (isVisible(htmlInlineFrame)) {
+ builder.appendBlockSeparator();
+ final Page page = htmlInlineFrame.getEnclosedPage();
+ if (page instanceof SgmlPage) {
+ builder.append(((SgmlPage) page).asNormalizedText(), Mode.NORMALIZE);
+ }
+ builder.appendBlockSeparator();
+ }
+ }
+
+ /**
+ * Process {@link DomText}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param domText the target to process
+ */
+ protected void appendText(final HtmlSerializerTextBuilder builder, final DomText domText) {
+ final DomNode parent = domText.getParentNode();
+ if (parent == null || parent instanceof HtmlTitle || isVisible(parent)) {
+ builder.append(domText.getData(), Mode.NORMALIZE);
+ }
+ }
+
+ /**
+ * Process {@link HtmlBreak}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlBreak the target to process
+ */
+ protected void appendBreak(final HtmlSerializerTextBuilder builder, final HtmlBreak htmlBreak) {
+ builder.appendNewLine();
+ }
+
+ /**
+ * Process {@link HtmlCheckBoxInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlCheckBoxInput the target to process
+ */
+ protected void appendCheckBoxInput(final HtmlSerializerTextBuilder builder,
+ final HtmlCheckBoxInput htmlCheckBoxInput) {
+ if (htmlCheckBoxInput.isChecked()) {
+ builder.append("checked", Mode.NORMALIZE);
+ }
+ else {
+ builder.append("unchecked", Mode.NORMALIZE);
+ }
+ }
+
+ /**
+ * Process {@link HtmlRadioButtonInput}.
+ *
+ * @param builder the StringBuilder to add to
+ * @param htmlRadioButtonInput the target to process
+ */
+ protected void appendRadioButtonInput(final HtmlSerializerTextBuilder builder,
+ final HtmlRadioButtonInput htmlRadioButtonInput) {
+ if (htmlRadioButtonInput.isChecked()) {
+ builder.append("checked", Mode.NORMALIZE);
+ }
+ else {
+ builder.append("unchecked", Mode.NORMALIZE);
+ }
+ }
+
+ private boolean isVisible(final DomNode node) {
+ return !ignoreMaskedElements_ || node.isDisplayed();
+ }
+
+ /**
+ * Indicates if element that are not displayed due to style settings
+ * (visibility or display) should be visible in generated text.
+ * @param ignore indicates if masked elements should be ignored or not
+ */
+ public void setIgnoreMaskedElements(final boolean ignore) {
+ ignoreMaskedElements_ = ignore;
+ }
+
+ protected static class HtmlSerializerTextBuilder {
+ /** Mode. */
+ protected enum Mode {
+ /** Collapse whitespace. */
+ NORMALIZE,
+
+ /** Preserve tab, blank, newline. */
+ PRESERVE_BLANK_TAB_NEWLINE,
+
+ /** Preserve blank, newline. */
+ PRESERVE_BLANK_NEWLINE
+ }
+
+ private enum State {
+ DEFAULT,
+ EMPTY,
+ TRIM,
+ BLANK_AT_END,
+ BLANK_AT_END_AFTER_NEWLINE,
+ NEWLINE_AT_END,
+ BLOCK_SEPARATOR_AT_END
+ }
+
+ private static final String LINE_SEPARATOR = "\n";
+ private static final int LINE_SEPARATOR_LENGTH = LINE_SEPARATOR.length();
+
+ private State state_;
+ private final StringBuilder builder_;
+ private int trimRightPos_;
+
+ public HtmlSerializerTextBuilder() {
+ builder_ = new StringBuilder();
+ state_ = State.EMPTY;
+ trimRightPos_ = builder_.length();
+ }
+
+ public void append(final String content, final Mode mode) {
+ final int length = content.length();
+ if (length == 0) {
+ return;
+ }
+
+ String text = content;
+ if (mode == Mode.PRESERVE_BLANK_NEWLINE) {
+ text = StringUtils.stripEnd(text, null);
+ }
+
+ boolean crFound = false;
+ for (final char c : text.toCharArray()) {
+ if (mode == Mode.NORMALIZE) {
+ if (isSpace(c)) {
+ switch (state_) {
+ case EMPTY:
+ case TRIM:
+ case BLANK_AT_END:
+ case BLANK_AT_END_AFTER_NEWLINE:
+ case BLOCK_SEPARATOR_AT_END:
+ break;
+ case NEWLINE_AT_END:
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END_AFTER_NEWLINE;
+ break;
+ default:
+ builder_.append(' ');
+ state_ = State.BLANK_AT_END;
+ break;
+ }
+ }
+ else if (c == (char) 160) {
+ builder_.append(' ');
+ state_ = State.DEFAULT;
+ trimRightPos_ = builder_.length();
+ }
+ else {
+ builder_.append(c);
+ state_ = State.DEFAULT;
+ trimRightPos_ = builder_.length();
+ }
+ continue;
+ }
+
+ // preserve mode
+ if (c == '\n') {
+ appendNewLine();
+ crFound = false;
+ }
+ else {
+ if (crFound) {
+ appendNewLine();
+ }
+ crFound = c == '\r';
+
+ if (c == '\t') {
+ if (mode == Mode.PRESERVE_BLANK_TAB_NEWLINE) {
+ appendTab();
+ }
+ else if (state_ != State.BLOCK_SEPARATOR_AT_END) {
+ builder_.append(' ');
+ }
+ }
+ else if (c == (char) 160) {
+ appendBlank();
+ }
+ else if (c == ' ') {
+ appendBlank();
+ }
+ else {
+ builder_.append(c);
+ }
+ trimRightPos_ = builder_.length();
+ }
+ }
+
+ if (crFound) {
+ appendNewLine();
+ }
+
+ if (mode != Mode.NORMALIZE) {
+ // reset state to empty to restart whitespace normalization afterwards
+ state_ = State.TRIM;
+ }
+ }
+
+ public void appendBlockSeparator() {
+ switch (state_) {
+ case EMPTY:
+ break;
+ case BLANK_AT_END:
+ builder_.setLength(trimRightPos_);
+ if (builder_.length() == 0) {
+ state_ = State.EMPTY;
+ }
+ else {
+ builder_.append(LINE_SEPARATOR);
+ state_ = State.BLOCK_SEPARATOR_AT_END;
+ }
+ break;
+ case BLANK_AT_END_AFTER_NEWLINE:
+ builder_.setLength(trimRightPos_ - LINE_SEPARATOR_LENGTH);
+ trimRightPos_ = trimRightPos_ - LINE_SEPARATOR_LENGTH;
+ if (builder_.length() == 0) {
+ state_ = State.EMPTY;
+ }
+ else {
+ builder_.append(LINE_SEPARATOR);
+ state_ = State.BLOCK_SEPARATOR_AT_END;
+ }
+ break;
+ case BLOCK_SEPARATOR_AT_END:
+ break;
+ case NEWLINE_AT_END:
+ builder_.setLength(builder_.length() - LINE_SEPARATOR_LENGTH);
+ trimRightPos_ = trimRightPos_ - LINE_SEPARATOR_LENGTH;
+ if (builder_.length() == 0) {
+ state_ = State.EMPTY;
+ }
+ else {
+ builder_.append(LINE_SEPARATOR);
+ state_ = State.BLOCK_SEPARATOR_AT_END;
+ }
+ break;
+ default:
+ builder_.append(LINE_SEPARATOR);
+ state_ = State.BLOCK_SEPARATOR_AT_END;
+ break;
+ }
+ }
+
+ public void appendNewLine() {
+ builder_.append(LINE_SEPARATOR);
+ state_ = State.NEWLINE_AT_END;
+ trimRightPos_ = builder_.length();
+ }
+
+ public void appendTab() {
+ builder_.append('\t');
+ trimRightPos_ = builder_.length();
+ }
+
+ private void appendBlank() {
+ builder_.append(' ');
+ trimRightPos_ = builder_.length();
+ }
+
+ public String getText() {
+ return builder_.substring(0, trimRightPos_);
+ }
+
+ private static boolean isSpace(final char ch) {
+ return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\f' || ch == '\r';
+ }
+ }
+}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializerVisibleText.java b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerVisibleText.java
similarity index 89%
rename from src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializerVisibleText.java
rename to src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerVisibleText.java
index 8ee3593f7..7668e3a43 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlSerializerVisibleText.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/HtmlSerializerVisibleText.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.gargoylesoftware.htmlunit.html;
+package com.gargoylesoftware.htmlunit.html.serializer;
import java.util.List;
@@ -20,7 +20,40 @@
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.SgmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSerializerVisibleText.HtmlSerializerTextBuilder.Mode;
+import com.gargoylesoftware.htmlunit.html.DomComment;
+import com.gargoylesoftware.htmlunit.html.DomNode;
+import com.gargoylesoftware.htmlunit.html.DomText;
+import com.gargoylesoftware.htmlunit.html.HtmlApplet;
+import com.gargoylesoftware.htmlunit.html.HtmlBody;
+import com.gargoylesoftware.htmlunit.html.HtmlBreak;
+import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
+import com.gargoylesoftware.htmlunit.html.HtmlDetails;
+import com.gargoylesoftware.htmlunit.html.HtmlHiddenInput;
+import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlMenu;
+import com.gargoylesoftware.htmlunit.html.HtmlNoFrames;
+import com.gargoylesoftware.htmlunit.html.HtmlNoScript;
+import com.gargoylesoftware.htmlunit.html.HtmlOption;
+import com.gargoylesoftware.htmlunit.html.HtmlOrderedList;
+import com.gargoylesoftware.htmlunit.html.HtmlPreformattedText;
+import com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlResetInput;
+import com.gargoylesoftware.htmlunit.html.HtmlScript;
+import com.gargoylesoftware.htmlunit.html.HtmlSelect;
+import com.gargoylesoftware.htmlunit.html.HtmlStyle;
+import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
+import com.gargoylesoftware.htmlunit.html.HtmlSummary;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
+import com.gargoylesoftware.htmlunit.html.HtmlTableFooter;
+import com.gargoylesoftware.htmlunit.html.HtmlTableHeader;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
+import com.gargoylesoftware.htmlunit.html.HtmlTitle;
+import com.gargoylesoftware.htmlunit.html.HtmlUnorderedList;
+import com.gargoylesoftware.htmlunit.html.TableRowGroup;
+import com.gargoylesoftware.htmlunit.html.serializer.HtmlSerializerVisibleText.HtmlSerializerTextBuilder.Mode;
import com.gargoylesoftware.htmlunit.javascript.host.Element;
import com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration;
import com.gargoylesoftware.htmlunit.javascript.host.css.StyleAttributes.Definition;
@@ -117,10 +150,10 @@ else if (node instanceof HtmlResetInput) {
appendResetInput(builder, (HtmlResetInput) node, mode);
}
else if (node instanceof HtmlCheckBoxInput) {
- doAppendCheckBoxInput(builder, (HtmlCheckBoxInput) node, mode);
+ appendCheckBoxInput(builder, (HtmlCheckBoxInput) node, mode);
}
else if (node instanceof HtmlRadioButtonInput) {
- doAppendRadioButtonInput(builder, (HtmlRadioButtonInput) node, mode);
+ appendRadioButtonInput(builder, (HtmlRadioButtonInput) node, mode);
}
else if (node instanceof HtmlInput) {
// nothing
@@ -143,6 +176,9 @@ else if (node instanceof HtmlInlineFrame) {
else if (node instanceof HtmlMenu) {
appendMenu(builder, (HtmlMenu) node, mode);
}
+ else if (node instanceof HtmlDetails) {
+ appendDetails(builder, (HtmlDetails) node, mode);
+ }
else if (node instanceof HtmlNoScript && node.getPage().getWebClient().isJavaScriptEnabled()) {
appendNoScript(builder, (HtmlNoScript) node, mode);
}
@@ -152,7 +188,7 @@ else if (node instanceof HtmlNoScript && node.getPage().getWebClient().isJavaScr
}
/**
- * Process {@link HtmlHiddenInput}.
+ * Process {@link DomNode}.
*
* @param builder the StringBuilder to add to
* @param domNode the target to process
@@ -299,6 +335,26 @@ protected void appendMenu(final HtmlSerializerTextBuilder builder,
builder.appendBlockSeparator();
}
+ /**
+ * Process {@link HtmlDetails}.
+ * @param builder the StringBuilder to add to
+ * @param htmlDetails the target to process
+ * @param mode the {@link Mode} to use for processing
+ */
+ protected void appendDetails(final HtmlSerializerTextBuilder builder,
+ final HtmlDetails htmlDetails, final Mode mode) {
+ if (htmlDetails.isOpen()) {
+ appendChildren(builder, htmlDetails, mode);
+ return;
+ }
+
+ for (final DomNode child : htmlDetails.getChildren()) {
+ if (child instanceof HtmlSummary) {
+ appendNode(builder, child, mode);
+ }
+ }
+ }
+
/**
* Process {@link HtmlTitle}.
* @param builder the StringBuilder to add to
@@ -340,7 +396,7 @@ protected void appendTableRow(final HtmlSerializerTextBuilder builder,
*/
protected void appendTextArea(final HtmlSerializerTextBuilder builder,
final HtmlTextArea htmlTextArea, final Mode mode) {
- if (isVisible(htmlTextArea)) {
+ if (htmlTextArea.isDisplayed()) {
builder.append(htmlTextArea.getDefaultValue(), whiteSpaceStyle(htmlTextArea, Mode.PRE));
builder.trimRight(Mode.PRE);
}
@@ -517,7 +573,7 @@ protected void appendUnorderedList(final HtmlSerializerTextBuilder builder,
*/
protected void appendPreformattedText(final HtmlSerializerTextBuilder builder,
final HtmlPreformattedText htmlPreformattedText, final Mode mode) {
- if (isVisible(htmlPreformattedText)) {
+ if (htmlPreformattedText.isDisplayed()) {
builder.appendBlockSeparator();
appendChildren(builder, htmlPreformattedText, whiteSpaceStyle(htmlPreformattedText, Mode.PRE));
builder.appendBlockSeparator();
@@ -533,7 +589,7 @@ protected void appendPreformattedText(final HtmlSerializerTextBuilder builder,
*/
protected void appendInlineFrame(final HtmlSerializerTextBuilder builder,
final HtmlInlineFrame htmlInlineFrame, final Mode mode) {
- if (isVisible(htmlInlineFrame)) {
+ if (htmlInlineFrame.isDisplayed()) {
builder.appendBlockSeparator();
final Page page = htmlInlineFrame.getEnclosedPage();
if (page instanceof SgmlPage) {
@@ -552,7 +608,15 @@ protected void appendInlineFrame(final HtmlSerializerTextBuilder builder,
*/
protected void appendText(final HtmlSerializerTextBuilder builder, final DomText domText, final Mode mode) {
final DomNode parent = domText.getParentNode();
- if (parent == null || parent instanceof HtmlTitle || isVisible(parent)) {
+ if (parent instanceof HtmlTitle
+ || parent instanceof HtmlScript) {
+ builder.append(domText.getData(), Mode.WHITE_SPACE_PRE_LINE);
+ }
+
+ if (parent == null
+ || parent instanceof HtmlTitle
+ || parent instanceof HtmlScript
+ || parent.isDisplayed()) {
builder.append(domText.getData(), mode);
}
}
@@ -600,7 +664,7 @@ protected void appendBreak(final HtmlSerializerTextBuilder builder,
* @param htmlCheckBoxInput the target to process
* @param mode the {@link Mode} to use for processing
*/
- protected void doAppendCheckBoxInput(final HtmlSerializerTextBuilder builder,
+ protected void appendCheckBoxInput(final HtmlSerializerTextBuilder builder,
final HtmlCheckBoxInput htmlCheckBoxInput, final Mode mode) {
// nothing to do
}
@@ -612,15 +676,11 @@ protected void doAppendCheckBoxInput(final HtmlSerializerTextBuilder builder,
* @param htmlRadioButtonInput the target to process
* @param mode the {@link Mode} to use for processing
*/
- protected void doAppendRadioButtonInput(final HtmlSerializerTextBuilder builder,
+ protected void appendRadioButtonInput(final HtmlSerializerTextBuilder builder,
final HtmlRadioButtonInput htmlRadioButtonInput, final Mode mode) {
// nothing to do
}
- private boolean isVisible(final DomNode node) {
- return node.isDisplayed();
- }
-
private Mode whiteSpaceStyle(final DomNode domNode, final Mode defaultMode) {
final Object scriptableObject = domNode.getScriptableObject();
if (scriptableObject instanceof Node) {
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/package-info.java
new file mode 100644
index 000000000..6b4b655ef
--- /dev/null
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/serializer/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2002-2021 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
+ * https://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.
+ */
+
+/**
+ * Contains the html serializer implementations.
+ */
+package com.gargoylesoftware.htmlunit.html.serializer;
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitPrefixResolver.java b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitPrefixResolver.java
index 186184984..a8bc09d8a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitPrefixResolver.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/HtmlUnitPrefixResolver.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/LowerCaseFunction.java b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/LowerCaseFunction.java
index 0373f590a..221c0ed3c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/LowerCaseFunction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/LowerCaseFunction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathAdapter.java b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathAdapter.java
index d6006806a..5b35a139d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathAdapter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathAdapter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathHelper.java b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathHelper.java
index 6beec437b..6d2c451e3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathHelper.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/XPathHelper.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/package-info.java
index a0191f836..73d7723c8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/html/xpath/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieHeaderValueFormatter.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieHeaderValueFormatter.java
index 48226e8c8..4c45b3a42 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieHeaderValueFormatter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieHeaderValueFormatter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java
index 9bed30dae..09f0a4934 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitBrowserCompatCookieSpec.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -103,7 +103,8 @@ public HtmlUnitBrowserCompatCookieSpec(final BrowserVersion browserVersion) {
new BasicSecureHandler(),
new BasicCommentHandler(),
new HtmlUnitExpiresHandler(browserVersion),
- new HtmlUnitHttpOnlyHandler());
+ new HtmlUnitHttpOnlyHandler(),
+ new HtmlUnitSameSiteHandler());
}
/**
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieSpecProvider.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieSpecProvider.java
index 190bbef4a..93dbb2224 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieSpecProvider.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieSpecProvider.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieStore.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieStore.java
index c776e0c74..1c6087903 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieStore.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitCookieStore.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitDomainHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitDomainHandler.java
index 659d3601f..70fd8cbff 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitDomainHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitDomainHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitExpiresHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitExpiresHandler.java
index 9fe2e8255..32262239c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitExpiresHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitExpiresHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -18,9 +18,7 @@
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTTP_COOKIE_EXTENDED_DATE_PATTERNS_2;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTTP_COOKIE_START_DATE_1970;
-import java.util.Calendar;
import java.util.Date;
-import java.util.Locale;
import org.apache.http.client.utils.DateUtils;
import org.apache.http.cookie.MalformedCookieException;
@@ -108,12 +106,6 @@ public void parse(final SetCookie cookie, String value) throws MalformedCookieEx
}
if (browserVersion_.hasFeature(HTTP_COOKIE_EXTENDED_DATE_PATTERNS_2)) {
- final Calendar calendar = Calendar.getInstance(Locale.ROOT);
- calendar.setTimeZone(DateUtils.GMT);
- calendar.set(1969, Calendar.JANUARY, 1, 0, 0, 0);
- calendar.set(Calendar.MILLISECOND, 0);
- startDate = calendar.getTime();
-
datePatterns = EXTENDED_DATE_PATTERNS_2;
}
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitHttpOnlyHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitHttpOnlyHandler.java
index 78c1a5257..9c70672b2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitHttpOnlyHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitHttpOnlyHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitPathHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitPathHandler.java
index 3d0a54f6d..d0bb4205b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitPathHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitPathHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitRedirectStrategie.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitRedirectStrategie.java
index 6e307d6fd..2f8dbb302 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitRedirectStrategie.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitRedirectStrategie.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java
index 47995bceb..0741ebdc6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSSLConnectionSocketFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSameSiteHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSameSiteHandler.java
new file mode 100644
index 000000000..c0ca3c74d
--- /dev/null
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitSameSiteHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2002-2021 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
+ * https://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.httpclient;
+
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * Customized CookieAttributeHandler for handling of the samesite attribute.
+ *
+ * @author Ronald Brill
+ */
+import org.apache.http.cookie.CommonCookieAttributeHandler;
+import org.apache.http.cookie.Cookie;
+import org.apache.http.cookie.CookieOrigin;
+import org.apache.http.cookie.MalformedCookieException;
+import org.apache.http.cookie.SetCookie;
+import org.apache.http.impl.cookie.BasicClientCookie;
+
+final class HtmlUnitSameSiteHandler implements CommonCookieAttributeHandler {
+
+ private static final String SAMESITE_ATTR = "samesite";
+
+ @Override
+ public void validate(final Cookie cookie, final CookieOrigin origin) throws MalformedCookieException {
+ // nothing
+ }
+
+ @Override
+ public void parse(final SetCookie cookie, final String value) throws MalformedCookieException {
+ ((BasicClientCookie) cookie).setAttribute(SAMESITE_ATTR, StringUtils.toRootLowerCase(value));
+ }
+
+ @Override
+ public boolean match(final Cookie cookie, final CookieOrigin origin) {
+ return true;
+ }
+
+ @Override
+ public String getAttributeName() {
+ return SAMESITE_ATTR;
+ }
+}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitVersionAttributeHandler.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitVersionAttributeHandler.java
index 913843cf6..a9d9517ec 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitVersionAttributeHandler.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/HtmlUnitVersionAttributeHandler.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/SocksConnectionSocketFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/SocksConnectionSocketFactory.java
index 18bc0e5b4..989590f9f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/SocksConnectionSocketFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/SocksConnectionSocketFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/package-info.java
index 602cec1f2..c92c8efd3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/httpclient/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/httpclient/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/AbstractJavaScriptEngine.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/AbstractJavaScriptEngine.java
index 4e5d530d5..fdcfd32ba 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/AbstractJavaScriptEngine.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/AbstractJavaScriptEngine.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameAdapter.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameAdapter.java
index 49a37058f..636f399a3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameAdapter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameAdapter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameImpl.java
index ffbd5cbd7..b9fc570a4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebugFrameImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerAdapter.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerAdapter.java
index 8bd9dcb97..b002ef248 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerAdapter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerAdapter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerImpl.java
index 55974108a..733475552 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DebuggerImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DefaultJavaScriptErrorListener.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DefaultJavaScriptErrorListener.java
index 6010c1b7f..a282707d4 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/DefaultJavaScriptErrorListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/DefaultJavaScriptErrorListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/FunctionWrapper.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/FunctionWrapper.java
index 46ead12a7..69dd99fb5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/FunctionWrapper.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/FunctionWrapper.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HiddenFunctionObject.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HiddenFunctionObject.java
index d0e5ac58b..5ba17b170 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HiddenFunctionObject.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HiddenFunctionObject.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java
index 688d2d4c1..102375bbd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitContextFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java
index 15d721847..4691ba240 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitScriptable.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitWrapFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitWrapFactory.java
index 660b3510b..5cc15b618 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitWrapFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/HtmlUnitWrapFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java
index 34548c917..9ecdd7010 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -82,6 +82,7 @@
import net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime;
import net.sourceforge.htmlunit.corejs.javascript.Scriptable;
import net.sourceforge.htmlunit.corejs.javascript.ScriptableObject;
+import net.sourceforge.htmlunit.corejs.javascript.StackStyle;
import net.sourceforge.htmlunit.corejs.javascript.Symbol;
import net.sourceforge.htmlunit.corejs.javascript.UniqueTag;
@@ -151,7 +152,7 @@ public JavaScriptEngine(final WebClient webClient) {
initTransientFields();
jsConfig_ = JavaScriptConfiguration.getInstance(webClient.getBrowserVersion());
- RhinoException.useMozillaStackStyle(true);
+ RhinoException.setStackStyle(StackStyle.MOZILLA_LF);
}
/**
@@ -225,8 +226,7 @@ private void init(final WebWindow webWindow, final Page page, final Context cont
}
// remove some objects, that Rhino defines in top scope but that we don't want
- deleteProperties(window, "Continuation");
- deleteProperties(window, "Iterator", "StopIteration");
+ deleteProperties(window, "Continuation", "Iterator", "StopIteration", "BigInt");
if (!browserVersion.hasFeature(JS_SYMBOL)) {
deleteProperties(window, "Symbol");
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java
index 8e0b82622..958d432e2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptErrorListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/MethodWrapper.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/MethodWrapper.java
index fca7419b5..af4cf3ec9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/MethodWrapper.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/MethodWrapper.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java
index af543ba56..b70761861 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/NamedNodeMap.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/NativeFunctionToStringFunction.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/NativeFunctionToStringFunction.java
index 0f41e1e5f..7b5806d1e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/NativeFunctionToStringFunction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/NativeFunctionToStringFunction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/PostponedAction.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/PostponedAction.java
index 12fd59cf8..4fd7f4605 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/PostponedAction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/PostponedAction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -22,21 +22,15 @@
* An action triggered by a script execution but that should be executed first when the script is finished.
* Example: when a script sets the source of an (i)frame, the request to the specified page will be first
* triggered after the script execution.
+ *
* @author Marc Guillemot
+ * @author Ronald Brill
*/
public abstract class PostponedAction {
private final WeakReference owningPageRef_; // as weak ref in case it may allow page to be GCed
private final String description_;
- /**
- * C'tor.
- * @param owningPage the page that initiates this action
- */
- public PostponedAction(final Page owningPage) {
- this(owningPage, null);
- }
-
/**
* C'tor.
* @param owningPage the page that initiates this action
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/RecursiveFunctionObject.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/RecursiveFunctionObject.java
index 50ef42771..e82949613 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/RecursiveFunctionObject.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/RecursiveFunctionObject.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/ScriptableWrapper.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/ScriptableWrapper.java
index 67cff2f5d..1ab8a333d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/ScriptableWrapper.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/ScriptableWrapper.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SilentJavaScriptErrorListener.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SilentJavaScriptErrorListener.java
index aad6b2a66..f8e85327d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SilentJavaScriptErrorListener.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SilentJavaScriptErrorListener.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptable.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptable.java
index b95cebcc3..7eaf43b67 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptable.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptable.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableProxy.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableProxy.java
index 28a147e2d..41d366174 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableProxy.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/SimpleScriptableProxy.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/TimeoutError.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/TimeoutError.java
index b162b40c2..25ba3dbae 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/TimeoutError.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/TimeoutError.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BackgroundJavaScriptFactory.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BackgroundJavaScriptFactory.java
index a126ea22c..0d8c0c11e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BackgroundJavaScriptFactory.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BackgroundJavaScriptFactory.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BasicJavaScriptJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BasicJavaScriptJob.java
index 33db1cd2f..df12ee249 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BasicJavaScriptJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/BasicJavaScriptJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DefaultJavaScriptExecutor.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DefaultJavaScriptExecutor.java
index 59196ad4f..79198131e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DefaultJavaScriptExecutor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DefaultJavaScriptExecutor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DownloadBehaviorJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DownloadBehaviorJob.java
index af5c717d2..8a6c00fdf 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DownloadBehaviorJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/DownloadBehaviorJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutionJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutionJob.java
index c5154a1af..acc437fbc 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutionJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutionJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutor.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutor.java
index 7aafc9d6f..8fcfedc1b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptExecutor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptFunctionJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptFunctionJob.java
index 87ee36a0b..f7354a9af 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptFunctionJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptFunctionJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJob.java
index 6200f2fce..26242a94e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManager.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManager.java
index 183013c6f..03b63d313 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManager.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManager.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManagerImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManagerImpl.java
index 6ffa7e8c0..e8b38cb3f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManagerImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptJobManagerImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptStringJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptStringJob.java
index 0298cf4a9..0ba728560 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptStringJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavaScriptStringJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavascriptXMLHttpRequestJob.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavascriptXMLHttpRequestJob.java
index 0a4f47cf1..053fb53eb 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavascriptXMLHttpRequestJob.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/JavascriptXMLHttpRequestJob.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/package-info.java
index 471f7430c..14434519b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/background/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java
index 3cd54298b..4e10477e6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/BrowserFeature.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/BrowserFeature.java
index d20cac36a..464452a88 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/BrowserFeature.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/BrowserFeature.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/ClassConfiguration.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/ClassConfiguration.java
index a6e542eb6..776850fa1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/ClassConfiguration.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/ClassConfiguration.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java
index 5f57a6208..4b60504db 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JavaScriptConfiguration.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -441,7 +441,7 @@ public final class JavaScriptConfiguration extends AbstractJavaScriptConfigurati
HTMLAnchorElement.class, HTMLAppletElement.class, HTMLAreaElement.class, HTMLAudioElement.class,
HTMLBaseElement.class, HTMLBaseFontElement.class, HTMLBGSoundElement.class, HTMLBlockElement.class,
HTMLBodyElement.class, HTMLBRElement.class, HTMLButtonElement.class,
- HTMLCanvasElement.class, HTMLCollection.class, HTMLContentElement.class,
+ HTMLCanvasElement.class, HTMLCollection.class,
HTMLDataElement.class, HTMLDataListElement.class,
HTMLDDElement.class, HTMLDetailsElement.class, HTMLDialogElement.class, HTMLDirectoryElement.class,
HTMLDivElement.class, HTMLDListElement.class, HTMLDocument.class, HTMLDTElement.class, HTMLElement.class,
@@ -459,7 +459,7 @@ public final class JavaScriptConfiguration extends AbstractJavaScriptConfigurati
HTMLOptionElement.class, HTMLOptionsCollection.class, HTMLOutputElement.class,
HTMLParagraphElement.class, HTMLParamElement.class, HTMLPhraseElement.class, HTMLPictureElement.class,
HTMLPreElement.class, HTMLProgressElement.class, HTMLQuoteElement.class, HTMLScriptElement.class,
- HTMLSelectElement.class, HTMLShadowElement.class, HTMLSlotElement.class, HTMLSourceElement.class,
+ HTMLSelectElement.class, HTMLSlotElement.class, HTMLSourceElement.class,
HTMLSpanElement.class,
HTMLStyleElement.class, HTMLTableCaptionElement.class, HTMLTableCellElement.class, HTMLTableColElement.class,
HTMLTableComponent.class, HTMLTableDataCellElement.class, HTMLTableElement.class,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClass.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClass.java
index 4c6b33e08..eca75c091 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClass.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClass.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClasses.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClasses.java
index 395ac16d3..03e6effc3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClasses.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxClasses.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstant.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstant.java
index c0c4f2e60..579cac830 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstant.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstant.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstructor.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstructor.java
index e7849358d..2be31fcd2 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstructor.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxConstructor.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxFunction.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxFunction.java
index f024a75a9..69939a160 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxFunction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxFunction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxGetter.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxGetter.java
index f3100fe5a..48b896f04 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxGetter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxGetter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSetter.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSetter.java
index 14543bdbc..1646f200d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSetter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSetter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticFunction.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticFunction.java
index 14a4874ec..6ed39acf8 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticFunction.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticFunction.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticGetter.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticGetter.java
index 0c48a3ae0..f0352b2b9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticGetter.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxStaticGetter.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSymbol.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSymbol.java
index c1dc429bf..bfcdcc1f6 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSymbol.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/JsxSymbol.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/SupportedBrowser.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/SupportedBrowser.java
index 578394aef..563763e35 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/SupportedBrowser.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/SupportedBrowser.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/package-info.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/package-info.java
index 0ae695a54..9e146578f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/package-info.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/configuration/package-info.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java
index c60d67b3d..d39e57b0e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObject.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObjectImpl.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObjectImpl.java
index 0c3e2aade..7aa856bce 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObjectImpl.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ActiveXObjectImpl.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java
index f0e352255..ab5e6ef6e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ApplicationCache.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -153,7 +153,7 @@ public void setOndownloading(final Object o) {
*/
@JsxGetter
public Object getOnprogress() {
- return getHandlerForJavaScript("progress");
+ return getHandlerForJavaScript(Event.TYPE_PROGRESS);
}
/**
@@ -162,7 +162,7 @@ public Object getOnprogress() {
*/
@JsxSetter
public void setOnprogress(final Object o) {
- setHandlerForJavaScript("progress", o);
+ setHandlerForJavaScript(Event.TYPE_PROGRESS, o);
}
/**
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/AudioScheduledSourceNode.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/AudioScheduledSourceNode.java
index 0bb93e7a9..afbd0b241 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/AudioScheduledSourceNode.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/AudioScheduledSourceNode.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BarProp.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BarProp.java
index 96b60defd..7a92a6f22 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BarProp.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BarProp.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BatteryManager.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BatteryManager.java
index fce6b9378..7579a0047 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BatteryManager.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BatteryManager.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BroadcastChannel.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BroadcastChannel.java
index 9a4fad297..e6e2ee08b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BroadcastChannel.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/BroadcastChannel.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Cache.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Cache.java
index cff2eec68..11bc7a806 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Cache.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Cache.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CacheStorage.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CacheStorage.java
index 8b66f3939..c6c8852f1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CacheStorage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/CacheStorage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java
index 4f930651b..a12de990d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRect.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java
index 755ff90a9..e0e6fd928 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ClientRectList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Console.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Console.java
index 65ee439f3..0cdc2de00 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Console.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Console.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java
index bcd83dc45..cc7c14953 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/DateCustom.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java
index ca170b131..41f0b572f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -64,6 +64,7 @@
import com.gargoylesoftware.htmlunit.javascript.host.dom.Node;
import com.gargoylesoftware.htmlunit.javascript.host.dom.NodeList;
import com.gargoylesoftware.htmlunit.javascript.host.dom.TextRange;
+import com.gargoylesoftware.htmlunit.javascript.host.event.Event;
import com.gargoylesoftware.htmlunit.javascript.host.event.EventHandler;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument;
@@ -71,6 +72,7 @@
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.ProxyDomNode;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLScriptElement;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLStyleElement;
+import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLTemplateElement;
import net.sourceforge.htmlunit.corejs.javascript.BaseFunction;
import net.sourceforge.htmlunit.corejs.javascript.Context;
@@ -907,15 +909,17 @@ private static void parseHtmlSnippet(final DomNode target, final String source)
*/
@JsxGetter({CHROME, EDGE, FF, FF78})
public String getInnerHTML() {
- final DomNode domNode;
try {
- domNode = getDomNodeOrDie();
+ DomNode domNode = getDomNodeOrDie();
+ if (this instanceof HTMLTemplateElement) {
+ domNode = ((HtmlTemplate) getDomNodeOrDie()).getContent();
+ }
+ return getInnerHTML(domNode);
}
catch (final IllegalStateException e) {
Context.throwAsScriptRuntimeEx(e);
return "";
}
- return getInnerHTML(domNode);
}
/**
@@ -1308,7 +1312,7 @@ public Object getNamespaceURI() {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnbeforecopy() {
- return getEventHandler("beforecopy");
+ return getEventHandler(Event.TYPE_BEFORECOPY);
}
/**
@@ -1317,7 +1321,7 @@ public Function getOnbeforecopy() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnbeforecopy(final Object onbeforecopy) {
- setEventHandler("beforecopy", onbeforecopy);
+ setEventHandler(Event.TYPE_BEFORECOPY, onbeforecopy);
}
/**
@@ -1326,7 +1330,7 @@ public void setOnbeforecopy(final Object onbeforecopy) {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnbeforecut() {
- return getEventHandler("beforecut");
+ return getEventHandler(Event.TYPE_BEFORECUT);
}
/**
@@ -1335,7 +1339,7 @@ public Function getOnbeforecut() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnbeforecut(final Object onbeforecut) {
- setEventHandler("beforecut", onbeforecut);
+ setEventHandler(Event.TYPE_BEFORECUT, onbeforecut);
}
/**
@@ -1344,7 +1348,7 @@ public void setOnbeforecut(final Object onbeforecut) {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnbeforepaste() {
- return getEventHandler("beforepaste");
+ return getEventHandler(Event.TYPE_BEFOREPASTE);
}
/**
@@ -1353,61 +1357,7 @@ public Function getOnbeforepaste() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnbeforepaste(final Object onbeforepaste) {
- setEventHandler("beforepaste", onbeforepaste);
- }
-
- /**
- * Returns the {@code oncopy} event handler for this element.
- * @return the {@code oncopy} event handler for this element
- */
- @JsxGetter({CHROME, EDGE})
- public Function getOncopy() {
- return getEventHandler("copy");
- }
-
- /**
- * Sets the {@code oncopy} event handler for this element.
- * @param oncopy the {@code oncopy} event handler for this element
- */
- @JsxSetter({CHROME, EDGE})
- public void setOncopy(final Object oncopy) {
- setEventHandler("copy", oncopy);
- }
-
- /**
- * Returns the {@code oncut} event handler for this element.
- * @return the {@code oncut} event handler for this element
- */
- @JsxGetter({CHROME, EDGE})
- public Function getOncut() {
- return getEventHandler("cut");
- }
-
- /**
- * Sets the {@code oncut} event handler for this element.
- * @param oncut the {@code oncut} event handler for this element
- */
- @JsxSetter({CHROME, EDGE})
- public void setOncut(final Object oncut) {
- setEventHandler("cut", oncut);
- }
-
- /**
- * Returns the {@code onpaste} event handler for this element.
- * @return the {@code onpaste} event handler for this element
- */
- @JsxGetter({CHROME, EDGE})
- public Function getOnpaste() {
- return getEventHandler("paste");
- }
-
- /**
- * Sets the {@code onpaste} event handler for this element.
- * @param onpaste the {@code onpaste} event handler for this element
- */
- @JsxSetter({CHROME, EDGE})
- public void setOnpaste(final Object onpaste) {
- setEventHandler("paste", onpaste);
+ setEventHandler(Event.TYPE_BEFOREPASTE, onbeforepaste);
}
/**
@@ -1416,7 +1366,7 @@ public void setOnpaste(final Object onpaste) {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnsearch() {
- return getEventHandler("search");
+ return getEventHandler(Event.TYPE_SEARCH);
}
/**
@@ -1425,25 +1375,7 @@ public Function getOnsearch() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnsearch(final Object onsearch) {
- setEventHandler("search", onsearch);
- }
-
- /**
- * Returns the {@code onselectstart} event handler for this element.
- * @return the {@code onselectstart} event handler for this element
- */
- @JsxGetter({CHROME, EDGE})
- public Function getOnselectstart() {
- return getEventHandler("selectstart");
- }
-
- /**
- * Sets the {@code onselectstart} event handler for this element.
- * @param onselectstart the {@code onselectstart} event handler for this element
- */
- @JsxSetter({CHROME, EDGE})
- public void setOnselectstart(final Object onselectstart) {
- setEventHandler("selectstart", onselectstart);
+ setEventHandler(Event.TYPE_SEARCH, onsearch);
}
/**
@@ -1452,7 +1384,7 @@ public void setOnselectstart(final Object onselectstart) {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnwebkitfullscreenchange() {
- return getEventHandler("webkitfullscreenchange");
+ return getEventHandler(Event.TYPE_WEBKITFULLSCREENCHANGE);
}
/**
@@ -1461,7 +1393,7 @@ public Function getOnwebkitfullscreenchange() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnwebkitfullscreenchange(final Object onwebkitfullscreenchange) {
- setEventHandler("webkitfullscreenchange", onwebkitfullscreenchange);
+ setEventHandler(Event.TYPE_WEBKITFULLSCREENCHANGE, onwebkitfullscreenchange);
}
/**
@@ -1470,7 +1402,7 @@ public void setOnwebkitfullscreenchange(final Object onwebkitfullscreenchange) {
*/
@JsxGetter({CHROME, EDGE})
public Function getOnwebkitfullscreenerror() {
- return getEventHandler("webkitfullscreenerror");
+ return getEventHandler(Event.TYPE_WEBKITFULLSCREENERROR);
}
/**
@@ -1479,7 +1411,7 @@ public Function getOnwebkitfullscreenerror() {
*/
@JsxSetter({CHROME, EDGE})
public void setOnwebkitfullscreenerror(final Object onwebkitfullscreenerror) {
- setEventHandler("webkitfullscreenerror", onwebkitfullscreenerror);
+ setEventHandler(Event.TYPE_WEBKITFULLSCREENERROR, onwebkitfullscreenerror);
}
/**
@@ -1487,7 +1419,7 @@ public void setOnwebkitfullscreenerror(final Object onwebkitfullscreenerror) {
* @return the {@code onwheel} event handler for this element
*/
public Function getOnwheel() {
- return getEventHandler("wheel");
+ return getEventHandler(Event.TYPE_WHEEL);
}
/**
@@ -1495,7 +1427,7 @@ public Function getOnwheel() {
* @param onwheel the {@code onwheel} event handler for this element
*/
public void setOnwheel(final Object onwheel) {
- setEventHandler("wheel", onwheel);
+ setEventHandler(Event.TYPE_WHEEL, onwheel);
}
/**
@@ -1504,7 +1436,7 @@ public void setOnwheel(final Object onwheel) {
*/
@JsxGetter(IE)
public Function getOngotpointercapture() {
- return getEventHandler("gotpointercapture");
+ return getEventHandler(Event.TYPE_GOTPOINTERCAPTURE);
}
/**
@@ -1513,7 +1445,7 @@ public Function getOngotpointercapture() {
*/
@JsxSetter(IE)
public void setOngotpointercapture(final Object ongotpointercapture) {
- setEventHandler("gotpointercapture", ongotpointercapture);
+ setEventHandler(Event.TYPE_GOTPOINTERCAPTURE, ongotpointercapture);
}
/**
@@ -1522,7 +1454,7 @@ public void setOngotpointercapture(final Object ongotpointercapture) {
*/
@JsxGetter(IE)
public Function getOnlostpointercapture() {
- return getEventHandler("lostpointercapture");
+ return getEventHandler(Event.TYPE_LOSTPOINTERCAPTURE);
}
/**
@@ -1531,7 +1463,7 @@ public Function getOnlostpointercapture() {
*/
@JsxSetter(IE)
public void setOnlostpointercapture(final Object onlostpointercapture) {
- setEventHandler("lostpointercapture", onlostpointercapture);
+ setEventHandler(Event.TYPE_LOSTPOINTERCAPTURE, onlostpointercapture);
}
/**
@@ -1540,7 +1472,7 @@ public void setOnlostpointercapture(final Object onlostpointercapture) {
*/
@JsxGetter(IE)
public Function getOnmsgesturechange() {
- return getEventHandler("msgesturechange");
+ return getEventHandler(Event.TYPE_MSGESTURECHANGE);
}
/**
@@ -1549,7 +1481,7 @@ public Function getOnmsgesturechange() {
*/
@JsxSetter(IE)
public void setOnmsgesturechange(final Object onmsgesturechange) {
- setEventHandler("msgesturechange", onmsgesturechange);
+ setEventHandler(Event.TYPE_MSGESTURECHANGE, onmsgesturechange);
}
/**
@@ -1558,7 +1490,7 @@ public void setOnmsgesturechange(final Object onmsgesturechange) {
*/
@JsxGetter(IE)
public Function getOnmsgesturedoubletap() {
- return getEventHandler("msgesturedoubletap");
+ return getEventHandler(Event.TYPE_MSGESTUREDOUBLETAP);
}
/**
@@ -1567,7 +1499,7 @@ public Function getOnmsgesturedoubletap() {
*/
@JsxSetter(IE)
public void setOnmsgesturedoubletap(final Object onmsgesturedoubletap) {
- setEventHandler("msgesturedoubletap", onmsgesturedoubletap);
+ setEventHandler(Event.TYPE_MSGESTUREDOUBLETAP, onmsgesturedoubletap);
}
/**
@@ -1576,7 +1508,7 @@ public void setOnmsgesturedoubletap(final Object onmsgesturedoubletap) {
*/
@JsxGetter(IE)
public Function getOnmsgestureend() {
- return getEventHandler("msgestureend");
+ return getEventHandler(Event.TYPE_MSGESTUREEND);
}
/**
@@ -1585,7 +1517,7 @@ public Function getOnmsgestureend() {
*/
@JsxSetter(IE)
public void setOnmsgestureend(final Object onmsgestureend) {
- setEventHandler("msgestureend", onmsgestureend);
+ setEventHandler(Event.TYPE_MSGESTUREEND, onmsgestureend);
}
/**
@@ -1594,7 +1526,7 @@ public void setOnmsgestureend(final Object onmsgestureend) {
*/
@JsxGetter(IE)
public Function getOnmsgesturehold() {
- return getEventHandler("msgesturehold");
+ return getEventHandler(Event.TYPE_MSGESTUREHOLD);
}
/**
@@ -1603,7 +1535,7 @@ public Function getOnmsgesturehold() {
*/
@JsxSetter(IE)
public void setOnmsgesturehold(final Object onmsgesturehold) {
- setEventHandler("msgesturehold", onmsgesturehold);
+ setEventHandler(Event.TYPE_MSGESTUREHOLD, onmsgesturehold);
}
/**
@@ -1612,7 +1544,7 @@ public void setOnmsgesturehold(final Object onmsgesturehold) {
*/
@JsxGetter(IE)
public Function getOnmsgesturestart() {
- return getEventHandler("msgesturestart");
+ return getEventHandler(Event.TYPE_MSGESTURESTART);
}
/**
@@ -1621,7 +1553,7 @@ public Function getOnmsgesturestart() {
*/
@JsxSetter(IE)
public void setOnmsgesturestart(final Object onmsgesturestart) {
- setEventHandler("msgesturestart", onmsgesturestart);
+ setEventHandler(Event.TYPE_MSGESTURESTART, onmsgesturestart);
}
/**
@@ -1630,7 +1562,7 @@ public void setOnmsgesturestart(final Object onmsgesturestart) {
*/
@JsxGetter(IE)
public Function getOnmsgesturetap() {
- return getEventHandler("msgesturetap");
+ return getEventHandler(Event.TYPE_MSGESTURETAP);
}
/**
@@ -1639,7 +1571,7 @@ public Function getOnmsgesturetap() {
*/
@JsxSetter(IE)
public void setOnmsgesturetap(final Object onmsgesturetap) {
- setEventHandler("msgesturetap", onmsgesturetap);
+ setEventHandler(Event.TYPE_MSGESTURETAP, onmsgesturetap);
}
/**
@@ -1648,7 +1580,7 @@ public void setOnmsgesturetap(final Object onmsgesturetap) {
*/
@JsxGetter(IE)
public Function getOnmsgotpointercapture() {
- return getEventHandler("msgotpointercapture");
+ return getEventHandler(Event.TYPE_MSGOTPOINTERCAPTURE);
}
/**
@@ -1657,7 +1589,7 @@ public Function getOnmsgotpointercapture() {
*/
@JsxSetter(IE)
public void setOnmsgotpointercapture(final Object onmsgotpointercapture) {
- setEventHandler("msgotpointercapture", onmsgotpointercapture);
+ setEventHandler(Event.TYPE_MSGOTPOINTERCAPTURE, onmsgotpointercapture);
}
/**
@@ -1666,7 +1598,7 @@ public void setOnmsgotpointercapture(final Object onmsgotpointercapture) {
*/
@JsxGetter(IE)
public Function getOnmsinertiastart() {
- return getEventHandler("msinertiastart");
+ return getEventHandler(Event.TYPE_MSINERTIASTART);
}
/**
@@ -1675,7 +1607,7 @@ public Function getOnmsinertiastart() {
*/
@JsxSetter(IE)
public void setOnmsinertiastart(final Object onmsinertiastart) {
- setEventHandler("msinertiastart", onmsinertiastart);
+ setEventHandler(Event.TYPE_MSINERTIASTART, onmsinertiastart);
}
/**
@@ -1684,7 +1616,7 @@ public void setOnmsinertiastart(final Object onmsinertiastart) {
*/
@JsxGetter(IE)
public Function getOnmslostpointercapture() {
- return getEventHandler("mslostpointercapture");
+ return getEventHandler(Event.TYPE_MSLOSTPOINTERCAPTURE);
}
/**
@@ -1693,7 +1625,7 @@ public Function getOnmslostpointercapture() {
*/
@JsxSetter(IE)
public void setOnmslostpointercapture(final Object onmslostpointercapture) {
- setEventHandler("mslostpointercapture", onmslostpointercapture);
+ setEventHandler(Event.TYPE_MSLOSTPOINTERCAPTURE, onmslostpointercapture);
}
/**
@@ -1702,7 +1634,7 @@ public void setOnmslostpointercapture(final Object onmslostpointercapture) {
*/
@JsxGetter(IE)
public Function getOnmspointercancel() {
- return getEventHandler("mspointercancel");
+ return getEventHandler(Event.TYPE_MSPOINTERCANCEL);
}
/**
@@ -1711,7 +1643,7 @@ public Function getOnmspointercancel() {
*/
@JsxSetter(IE)
public void setOnmspointercancel(final Object onmspointercancel) {
- setEventHandler("mspointercancel", onmspointercancel);
+ setEventHandler(Event.TYPE_MSPOINTERCANCEL, onmspointercancel);
}
/**
@@ -1720,7 +1652,7 @@ public void setOnmspointercancel(final Object onmspointercancel) {
*/
@JsxGetter(IE)
public Function getOnmspointerdown() {
- return getEventHandler("mspointerdown");
+ return getEventHandler(Event.TYPE_MSPOINTERDOWN);
}
/**
@@ -1729,7 +1661,7 @@ public Function getOnmspointerdown() {
*/
@JsxSetter(IE)
public void setOnmspointerdown(final Object onmspointerdown) {
- setEventHandler("mspointerdown", onmspointerdown);
+ setEventHandler(Event.TYPE_MSPOINTERDOWN, onmspointerdown);
}
/**
@@ -1738,7 +1670,7 @@ public void setOnmspointerdown(final Object onmspointerdown) {
*/
@JsxGetter(IE)
public Function getOnmspointerenter() {
- return getEventHandler("mspointerenter");
+ return getEventHandler(Event.TYPE_MSPOINTENTER);
}
/**
@@ -1747,7 +1679,7 @@ public Function getOnmspointerenter() {
*/
@JsxSetter(IE)
public void setOnmspointerenter(final Object onmspointerenter) {
- setEventHandler("mspointerenter", onmspointerenter);
+ setEventHandler(Event.TYPE_MSPOINTENTER, onmspointerenter);
}
/**
@@ -1756,7 +1688,7 @@ public void setOnmspointerenter(final Object onmspointerenter) {
*/
@JsxGetter(IE)
public Function getOnmspointerleave() {
- return getEventHandler("mspointerleave");
+ return getEventHandler(Event.TYPE_MSPOINTERLEAVE);
}
/**
@@ -1765,7 +1697,7 @@ public Function getOnmspointerleave() {
*/
@JsxSetter(IE)
public void setOnmspointerleave(final Object onmspointerleave) {
- setEventHandler("mspointerleave", onmspointerleave);
+ setEventHandler(Event.TYPE_MSPOINTERLEAVE, onmspointerleave);
}
/**
@@ -1774,7 +1706,7 @@ public void setOnmspointerleave(final Object onmspointerleave) {
*/
@JsxGetter(IE)
public Function getOnmspointermove() {
- return getEventHandler("mspointermove");
+ return getEventHandler(Event.TYPE_MSPOINTERMOVE);
}
/**
@@ -1783,7 +1715,7 @@ public Function getOnmspointermove() {
*/
@JsxSetter(IE)
public void setOnmspointermove(final Object onmspointermove) {
- setEventHandler("mspointermove", onmspointermove);
+ setEventHandler(Event.TYPE_MSPOINTERMOVE, onmspointermove);
}
/**
@@ -1792,7 +1724,7 @@ public void setOnmspointermove(final Object onmspointermove) {
*/
@JsxGetter(IE)
public Function getOnmspointerout() {
- return getEventHandler("mspointerout");
+ return getEventHandler(Event.TYPE_MSPOINTEROUT);
}
/**
@@ -1801,7 +1733,7 @@ public Function getOnmspointerout() {
*/
@JsxSetter(IE)
public void setOnmspointerout(final Object onmspointerout) {
- setEventHandler("mspointerout", onmspointerout);
+ setEventHandler(Event.TYPE_MSPOINTEROUT, onmspointerout);
}
/**
@@ -1810,7 +1742,7 @@ public void setOnmspointerout(final Object onmspointerout) {
*/
@JsxGetter(IE)
public Function getOnmspointerover() {
- return getEventHandler("mspointerover");
+ return getEventHandler(Event.TYPE_MSPOINTEROVER);
}
/**
@@ -1819,7 +1751,7 @@ public Function getOnmspointerover() {
*/
@JsxSetter(IE)
public void setOnmspointerover(final Object onmspointerover) {
- setEventHandler("mspointerover", onmspointerover);
+ setEventHandler(Event.TYPE_MSPOINTEROVER, onmspointerover);
}
/**
@@ -1828,7 +1760,7 @@ public void setOnmspointerover(final Object onmspointerover) {
*/
@JsxGetter(IE)
public Function getOnmspointerup() {
- return getEventHandler("mspointerup");
+ return getEventHandler(Event.TYPE_MSPOINTERUP);
}
/**
@@ -1837,7 +1769,7 @@ public Function getOnmspointerup() {
*/
@JsxSetter(IE)
public void setOnmspointerup(final Object onmspointerup) {
- setEventHandler("mspointerup", onmspointerup);
+ setEventHandler(Event.TYPE_MSPOINTERUP, onmspointerup);
}
/**
@@ -1846,7 +1778,7 @@ public void setOnmspointerup(final Object onmspointerup) {
*/
@JsxGetter(IE)
public Function getOnpointercancel() {
- return getEventHandler("pointercancel");
+ return getEventHandler(Event.TYPE_POINTERCANCEL);
}
/**
@@ -1855,7 +1787,7 @@ public Function getOnpointercancel() {
*/
@JsxSetter(IE)
public void setOnpointercancel(final Object onpointercancel) {
- setEventHandler("pointercancel", onpointercancel);
+ setEventHandler(Event.TYPE_POINTERCANCEL, onpointercancel);
}
/**
@@ -1864,7 +1796,7 @@ public void setOnpointercancel(final Object onpointercancel) {
*/
@JsxGetter(IE)
public Function getOnpointerdown() {
- return getEventHandler("pointerdown");
+ return getEventHandler(Event.TYPE_POINTERDOWN);
}
/**
@@ -1873,7 +1805,7 @@ public Function getOnpointerdown() {
*/
@JsxSetter(IE)
public void setOnpointerdown(final Object onpointerdown) {
- setEventHandler("pointerdown", onpointerdown);
+ setEventHandler(Event.TYPE_POINTERDOWN, onpointerdown);
}
/**
@@ -1882,7 +1814,7 @@ public void setOnpointerdown(final Object onpointerdown) {
*/
@JsxGetter(IE)
public Function getOnpointerenter() {
- return getEventHandler("pointerenter");
+ return getEventHandler(Event.TYPE_POINTERENTER);
}
/**
@@ -1891,7 +1823,7 @@ public Function getOnpointerenter() {
*/
@JsxSetter(IE)
public void setOnpointerenter(final Object onpointerenter) {
- setEventHandler("pointerenter", onpointerenter);
+ setEventHandler(Event.TYPE_POINTERENTER, onpointerenter);
}
/**
@@ -1900,7 +1832,7 @@ public void setOnpointerenter(final Object onpointerenter) {
*/
@JsxGetter(IE)
public Function getOnpointerleave() {
- return getEventHandler("pointerleave");
+ return getEventHandler(Event.TYPE_POINTERLEAVE);
}
/**
@@ -1909,7 +1841,7 @@ public Function getOnpointerleave() {
*/
@JsxSetter(IE)
public void setOnpointerleave(final Object onpointerleave) {
- setEventHandler("pointerleave", onpointerleave);
+ setEventHandler(Event.TYPE_POINTERLEAVE, onpointerleave);
}
/**
@@ -1918,7 +1850,7 @@ public void setOnpointerleave(final Object onpointerleave) {
*/
@JsxGetter(IE)
public Function getOnpointermove() {
- return getEventHandler("pointermove");
+ return getEventHandler(Event.TYPE_POINTERMOVE);
}
/**
@@ -1927,7 +1859,7 @@ public Function getOnpointermove() {
*/
@JsxSetter(IE)
public void setOnpointermove(final Object onpointermove) {
- setEventHandler("pointermove", onpointermove);
+ setEventHandler(Event.TYPE_POINTERMOVE, onpointermove);
}
/**
@@ -1936,7 +1868,7 @@ public void setOnpointermove(final Object onpointermove) {
*/
@JsxGetter(IE)
public Function getOnpointerout() {
- return getEventHandler("pointerout");
+ return getEventHandler(Event.TYPE_POINTEROUT);
}
/**
@@ -1945,7 +1877,7 @@ public Function getOnpointerout() {
*/
@JsxSetter(IE)
public void setOnpointerout(final Object onpointerout) {
- setEventHandler("pointerout", onpointerout);
+ setEventHandler(Event.TYPE_POINTEROUT, onpointerout);
}
/**
@@ -1954,7 +1886,7 @@ public void setOnpointerout(final Object onpointerout) {
*/
@JsxGetter(IE)
public Function getOnpointerover() {
- return getEventHandler("pointerover");
+ return getEventHandler(Event.TYPE_POINTEROVER);
}
/**
@@ -1963,7 +1895,7 @@ public Function getOnpointerover() {
*/
@JsxSetter(IE)
public void setOnpointerover(final Object onpointerover) {
- setEventHandler("pointerover", onpointerover);
+ setEventHandler(Event.TYPE_POINTEROVER, onpointerover);
}
/**
@@ -1972,7 +1904,7 @@ public void setOnpointerover(final Object onpointerover) {
*/
@JsxGetter(IE)
public Function getOnpointerup() {
- return getEventHandler("pointerup");
+ return getEventHandler(Event.TYPE_POINTERUP);
}
/**
@@ -1981,7 +1913,7 @@ public Function getOnpointerup() {
*/
@JsxSetter(IE)
public void setOnpointerup(final Object onpointerup) {
- setEventHandler("pointerup", onpointerup);
+ setEventHandler(Event.TYPE_POINTERUP, onpointerup);
}
/**
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/External.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/External.java
index 48aa8f71f..f476ac4b7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/External.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/External.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFace.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFace.java
index 98ea1a718..7e66c6aa5 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFace.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFace.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFaceSet.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFaceSet.java
index 0daea88eb..25d5c2428 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFaceSet.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/FontFaceSet.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Gamepad.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Gamepad.java
index 7157b355a..de3f05f7c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Gamepad.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Gamepad.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/GamepadButton.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/GamepadButton.java
index 7b59797fe..15846ae62 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/GamepadButton.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/GamepadButton.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/History.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/History.java
index 3adcb89b4..f1c6ff711 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/History.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/History.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ImageBitmap.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ImageBitmap.java
index ed24b76a8..d6e5a88d9 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ImageBitmap.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ImageBitmap.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/InstallTrigger.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/InstallTrigger.java
index 8509c30dc..b8ed7c7ab 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/InstallTrigger.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/InstallTrigger.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java
index dcb19acb9..f1971a315 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Location.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -35,9 +35,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import com.gargoylesoftware.htmlunit.HttpHeader;
import com.gargoylesoftware.htmlunit.Page;
-import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -65,6 +63,7 @@
* @author Ronald Brill
* @author Frank Danek
* @author Adam Afeltowicz
+ * @author Atsushi Nakagawa
*
* @see MSDN Documentation
*/
@@ -138,16 +137,15 @@ public void assign(final String url) throws IOException {
*/
@JsxFunction
public void reload(final boolean force) throws IOException {
- final HtmlPage htmlPage = (HtmlPage) getWindow(getStartingScope()).getWebWindow().getEnclosedPage();
+ final HtmlPage htmlPage = (HtmlPage) window_.getWebWindow().getEnclosedPage();
final WebRequest request = htmlPage.getWebResponse().getWebRequest();
if (getBrowserVersion().hasFeature(JS_LOCATION_RELOAD_REFERRER)) {
- final String referer = htmlPage.getUrl().toExternalForm();
- request.setAdditionalHeader(HttpHeader.REFERER, referer);
+ request.setRefererlHeader(htmlPage.getUrl());
}
final WebWindow webWindow = window_.getWebWindow();
- webWindow.getWebClient().download(webWindow, "", request, true, false, "JS location.reload");
+ webWindow.getWebClient().download(webWindow, "", request, true, false, false, "JS location.reload");
}
/**
@@ -166,9 +164,8 @@ public void replace(final String url) throws IOException {
* Returns the location URL.
* @return the location URL
*/
- @Override
- @JsxFunction
- public String toString() {
+ @JsxFunction(functionName = "toString")
+ public String jsToString() {
if (window_ != null) {
return getHref();
}
@@ -202,7 +199,9 @@ public String getHref() {
return s;
}
catch (final MalformedURLException e) {
- LOG.error(e.getMessage(), e);
+ if (LOG.isErrorEnabled()) {
+ LOG.error(e.getMessage(), e);
+ }
return page.getUrl().toExternalForm();
}
}
@@ -239,10 +238,10 @@ public void setHref(final String newLocation) throws IOException {
}
final WebRequest request = new WebRequest(url);
- request.setAdditionalHeader(HttpHeader.REFERER, page.getUrl().toExternalForm());
+ request.setRefererlHeader(page.getUrl());
final WebWindow webWindow = window_.getWebWindow();
- webWindow.getWebClient().download(webWindow, "", request, true, false, "JS set location");
+ webWindow.getWebClient().download(webWindow, "", request, true, false, false, "JS set location");
}
catch (final MalformedURLException e) {
if (LOG.isErrorEnabled()) {
@@ -434,7 +433,7 @@ public void setHost(final String host) throws Exception {
*/
@JsxGetter
public String getPathname() {
- if (WebClient.URL_ABOUT_BLANK == getUrl()) {
+ if (UrlUtils.URL_ABOUT_BLANK == getUrl()) {
if (getBrowserVersion().hasFeature(URL_ABOUT_BLANK_HAS_BLANK_PATH)) {
return "blank";
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessageChannel.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessageChannel.java
index fb600c1fa..8704fc569 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessageChannel.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessageChannel.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessagePort.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessagePort.java
index feae67cff..42fb624b0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessagePort.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MessagePort.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -21,6 +21,8 @@
import java.net.URL;
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebWindow;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.javascript.PostponedAction;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
@@ -96,16 +98,17 @@ private void setHandlerForJavaScript(final String eventName, final Object handle
public void postMessage(final String message, final Object transfer) {
if (port1_ != null) {
final Window w = getWindow();
- final URL currentURL = w.getWebWindow().getEnclosedPage().getUrl();
+ final WebWindow webWindow = w.getWebWindow();
+ final Page page = webWindow.getEnclosedPage();
+ final URL currentURL = page.getUrl();
final MessageEvent event = new MessageEvent();
final String origin = currentURL.getProtocol() + "://" + currentURL.getHost() + ':' + currentURL.getPort();
event.initMessageEvent(Event.TYPE_MESSAGE, false, false, message, origin, "", w, transfer);
event.setParentScope(port1_);
event.setPrototype(getPrototype(event.getClass()));
- final JavaScriptEngine jsEngine
- = (JavaScriptEngine) w.getWebWindow().getWebClient().getJavaScriptEngine();
- final PostponedAction action = new PostponedAction(w.getWebWindow().getEnclosedPage()) {
+ final JavaScriptEngine jsEngine = (JavaScriptEngine) webWindow.getWebClient().getJavaScriptEngine();
+ final PostponedAction action = new PostponedAction(page, "MessagePort.postMessage") {
@Override
public void execute() throws Exception {
final ContextFactory cf = jsEngine.getContextFactory();
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeType.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeType.java
index 68c734c34..f82f5df52 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeType.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeType.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeTypeArray.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeTypeArray.java
index 784a26dc3..90560d715 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeTypeArray.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/MimeTypeArray.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java
index 3fe56155d..23f7609f1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Namespace.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NamespaceCollection.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NamespaceCollection.java
index 182f786b4..448b42bd3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NamespaceCollection.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NamespaceCollection.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NativeFunctionPrefixResolver.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NativeFunctionPrefixResolver.java
index 379d6ba5d..89c884457 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NativeFunctionPrefixResolver.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NativeFunctionPrefixResolver.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java
index e9fa8ecce..97d72fb72 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Navigator.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -29,6 +29,7 @@
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter;
import com.gargoylesoftware.htmlunit.javascript.host.geo.Geolocation;
+import com.gargoylesoftware.htmlunit.javascript.host.media.MediaDevices;
import com.gargoylesoftware.htmlunit.javascript.host.network.NetworkInformation;
/**
@@ -40,6 +41,7 @@
* @author Ahmed Ashour
* @author Marc Guillemot
* @author Frank Danek
+ * @author Ronald Brill
*
* @see MSDN documentation
*/
@@ -48,6 +50,7 @@ public class Navigator extends SimpleScriptable {
private PluginArray plugins_;
private MimeTypeArray mimeTypes_;
+ private MediaDevices mediaDevices_;
/**
* Creates an instance.
@@ -335,4 +338,18 @@ public NetworkInformation getConnection() {
networkInformation.setParentScope(getParentScope());
return networkInformation;
}
+
+ /**
+ * Returns the {@code mimeTypes} property.
+ * @return the {@code mimeTypes} property
+ */
+ @JsxGetter({CHROME, EDGE, FF, FF78})
+ public MediaDevices getMediaDevices() {
+ if (mediaDevices_ == null) {
+ mediaDevices_ = new MediaDevices();
+ mediaDevices_.setPrototype(getPrototype(mediaDevices_.getClass()));
+ mediaDevices_.setParentScope(getParentScope());
+ }
+ return mediaDevices_;
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Netscape.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Netscape.java
index 299b7634b..12b117227 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Netscape.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Netscape.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Notification.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Notification.java
index 8523f6904..03b999380 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Notification.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Notification.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java
index 30fa2f974..65f88550a 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/NumberCustom.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserver.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserver.java
index 3cd1d53af..617443dd0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserver.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserver.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserverEntryList.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserverEntryList.java
index 825f623b4..c32af2c2f 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserverEntryList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PerformanceObserverEntryList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PermissionStatus.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PermissionStatus.java
index f9d0c2c3c..2b8bd5d3c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PermissionStatus.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PermissionStatus.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Permissions.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Permissions.java
index 05e9fedde..a2ab5aee0 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Permissions.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Permissions.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Plugin.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Plugin.java
index ba8d191bd..c44be519b 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Plugin.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Plugin.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PluginArray.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PluginArray.java
index ef671d540..59d2f6036 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PluginArray.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PluginArray.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Promise.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Promise.java
index e7d6461c9..bfee752cd 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Promise.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Promise.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushManager.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushManager.java
index fa0212c4e..865c61c63 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushManager.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushManager.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscription.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscription.java
index 36b50bdc8..a4794bb43 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscription.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscription.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscriptionOptions.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscriptionOptions.java
index 8d59eab6b..99e8cef05 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscriptionOptions.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/PushSubscriptionOptions.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ReadableStream.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ReadableStream.java
index c19997969..6f954ac9c 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ReadableStream.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ReadableStream.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Reflect.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Reflect.java
index fef028cc2..e6ab5bc2e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Reflect.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Reflect.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java
index 3c1420849..7d4d92b9d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Screen.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ScreenOrientation.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ScreenOrientation.java
index 571af2562..bb08af2bf 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ScreenOrientation.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/ScreenOrientation.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SharedWorker.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SharedWorker.java
index 6b28cde6c..bf0b3977d 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SharedWorker.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SharedWorker.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SimpleArray.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SimpleArray.java
index 353cb3e32..9c1a0cb00 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SimpleArray.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/SimpleArray.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java
index e300fe36c..962883d56 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Storage.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StorageManager.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StorageManager.java
index 467513ecf..7207906d1 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StorageManager.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/StorageManager.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextDecoder.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextDecoder.java
index ce1e0eb3d..165d07647 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextDecoder.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextDecoder.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextEncoder.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextEncoder.java
index cb2b6391e..9adede6c7 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextEncoder.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TextEncoder.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Touch.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Touch.java
index ba936a72a..1ecfca56e 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Touch.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Touch.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TouchList.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TouchList.java
index 10d3c9298..3a45dac38 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TouchList.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/TouchList.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java
index 2c8374dd4..23dd665f3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URL.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -14,6 +14,7 @@
*/
package com.gargoylesoftware.htmlunit.javascript.host;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ANCHOR_HOSTNAME_IGNORE_BLANK;
import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF;
@@ -26,7 +27,9 @@
import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
+import com.gargoylesoftware.htmlunit.javascript.configuration.JsxFunction;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter;
+import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxStaticFunction;
import com.gargoylesoftware.htmlunit.javascript.host.file.File;
import com.gargoylesoftware.htmlunit.util.UrlUtils;
@@ -75,6 +78,7 @@ public URL(final String url, final Object base) {
final java.net.URL baseUrl = UrlUtils.toUrlUnsafe(baseStr);
url_ = new java.net.URL(baseUrl, url);
}
+ checkRemoveRedundantPort();
}
catch (final MalformedURLException e) {
throw ScriptRuntime.typeError(e.toString());
@@ -108,6 +112,145 @@ public static String createObjectURL(final Object fileOrBlob) {
public static void revokeObjectURL(final Object objectURL) {
}
+ /**
+ * @return hash property of the URL containing a '#' followed by the fragment identifier of the URL.
+ */
+ @JsxGetter
+ public String getHash() {
+ if (url_ == null) {
+ return null;
+ }
+ final String ref = url_.getRef();
+ return ref == null ? "" : "#" + ref;
+ }
+
+ @JsxSetter
+ public void setHash(final String fragment) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+ url_ = UrlUtils.getUrlWithNewRef(url_, StringUtils.isEmpty(fragment) ? null : fragment);
+ }
+
+ /**
+ * @return the host, that is the hostname, and then, if the port of the URL is nonempty,
+ * a ':', followed by the port of the URL.
+ */
+ @JsxGetter
+ public String getHost() {
+ if (url_ == null) {
+ return null;
+ }
+ final int port = url_.getPort();
+ return url_.getHost() + (port > 0 ? ":" + port : "");
+ }
+
+ @JsxSetter
+ public void setHost(final String host) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+
+ String newHost = StringUtils.substringBefore(host, ':');
+ if (StringUtils.isEmpty(newHost)) {
+ return;
+ }
+
+ try {
+ int ip = Integer.parseInt(newHost);
+ final StringBuilder ipString = new StringBuilder();
+ ipString.insert(0, Integer.toString(ip % 256));
+ ipString.insert(0, '.');
+
+ ip = ip / 256;
+ ipString.insert(0, Integer.toString(ip % 256));
+ ipString.insert(0, '.');
+
+ ip = ip / 256;
+ ipString.insert(0, Integer.toString(ip % 256));
+ ipString.insert(0, '.');
+ ip = ip / 256;
+ ipString.insert(0, Integer.toString(ip % 256));
+
+ newHost = ipString.toString();
+ }
+ catch (final Exception e) {
+ // back to string
+ }
+
+ url_ = UrlUtils.getUrlWithNewHost(url_, newHost);
+
+ final String newPort = StringUtils.substringAfter(host, ':');
+ if (StringUtils.isNotBlank(newHost)) {
+ try {
+ url_ = UrlUtils.getUrlWithNewHostAndPort(url_, newHost, Integer.parseInt(newPort));
+ }
+ catch (final Exception e) {
+ // back to string
+ }
+ }
+ else {
+ url_ = UrlUtils.getUrlWithNewHost(url_, newHost);
+ }
+
+ checkRemoveRedundantPort();
+ }
+
+ /** Removes port if it can be deduced from protocol */
+ private void checkRemoveRedundantPort() throws MalformedURLException {
+ if (("https".equals(url_.getProtocol()) && url_.getPort() == 443)
+ || ("http".equals(url_.getProtocol()) && url_.getPort() == 80)) {
+ url_ = UrlUtils.getUrlWithNewPort(url_, -1);
+ }
+ }
+
+ /**
+ * @return the host, that is the hostname, and then, if the port of the URL is nonempty,
+ * a ':', followed by the port of the URL.
+ */
+ @JsxGetter
+ public String getHostname() {
+ if (url_ == null) {
+ return null;
+ }
+
+ return UrlUtils.encodeAnchor(url_.getHost());
+ }
+
+ @JsxSetter
+ public void setHostname(final String hostname) throws MalformedURLException {
+ if (getBrowserVersion().hasFeature(JS_ANCHOR_HOSTNAME_IGNORE_BLANK)) {
+ if (!StringUtils.isBlank(hostname)) {
+ url_ = UrlUtils.getUrlWithNewHost(url_, hostname);
+ }
+ }
+ else if (!StringUtils.isEmpty(hostname)) {
+ url_ = UrlUtils.getUrlWithNewHost(url_, hostname);
+ }
+ }
+
+ /**
+ * @return whole URL
+ */
+ @JsxGetter
+ public String getHref() {
+ if (url_ == null) {
+ return null;
+ }
+
+ return jsToString();
+ }
+
+ @JsxSetter
+ public void setHref(final String href) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+
+ url_ = UrlUtils.toUrlUnsafe(href);
+ checkRemoveRedundantPort();
+ }
+
/**
* @return the origin
*/
@@ -121,7 +264,7 @@ public Object getOrigin() {
}
/**
- * @return the origin
+ * @return a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.
*/
@JsxGetter
public URLSearchParams getSearchParams() {
@@ -132,6 +275,159 @@ public URLSearchParams getSearchParams() {
return new URLSearchParams(url_.getQuery());
}
+ /**
+ * @return the password specified before the domain name.
+ */
+ @JsxGetter
+ public String getPassword() {
+ if (url_ == null) {
+ return null;
+ }
+
+ final String userInfo = url_.getUserInfo();
+ final int idx = userInfo == null ? -1 : userInfo.indexOf(':');
+ return idx == -1 ? "" : userInfo.substring(idx + 1);
+ }
+
+ @JsxSetter
+ public void setPassword(final String password) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+
+ url_ = UrlUtils.getUrlWithNewUserPassword(url_, password.isEmpty() ? null : password);
+ }
+
+ /**
+ * @return a URLSearchParams object allowing access to the GET decoded query arguments contained in the URL.
+ */
+ @JsxGetter
+ public String getPathname() {
+ if (url_ == null) {
+ return null;
+ }
+
+ final String path = url_.getPath();
+ return path.isEmpty() ? "/" : path;
+ }
+
+ @JsxSetter
+ public void setPathname(final String path) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+
+ url_ = UrlUtils.getUrlWithNewPath(url_, path.startsWith("/") ? path : "/" + path);
+ }
+
+ /**
+ * @return the port number of the URL. If the URL does not contain an explicit port number,
+ * it will be set to ''
+ */
+ @JsxGetter
+ public String getPort() {
+ if (url_ == null) {
+ return null;
+ }
+
+ final int port = url_.getPort();
+ return port == -1 ? "" : Integer.toString(port);
+ }
+
+ @JsxSetter
+ public void setPort(final String port) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+ final int portInt = port.isEmpty() ? -1 : Integer.parseInt(port);
+ url_ = UrlUtils.getUrlWithNewPort(url_, portInt);
+ checkRemoveRedundantPort();
+ }
+
+ /**
+ * @return the protocol scheme of the URL, including the final ':'.
+ */
+ @JsxGetter
+ public String getProtocol() {
+ if (url_ == null) {
+ return null;
+ }
+ final String protocol = url_.getProtocol();
+ return protocol.isEmpty() ? "" : (protocol + ":");
+ }
+
+ @JsxSetter
+ public void setProtocol(final String protocol) throws MalformedURLException {
+ if (url_ == null || protocol.isEmpty() || !UrlUtils.isValidScheme(protocol)) {
+ return;
+ }
+
+ try {
+ url_ = UrlUtils.getUrlWithNewProtocol(url_, protocol);
+ checkRemoveRedundantPort();
+ }
+ catch (final MalformedURLException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * @return the query string containing a '?' followed by the parameters of the URL
+ */
+ @JsxGetter
+ public String getSearch() {
+ if (url_ == null) {
+ return null;
+ }
+ final String search = url_.getQuery();
+ return search == null ? "" : "?" + search;
+ }
+
+ @JsxSetter
+ public void setSearch(final String search) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+
+ final String query;
+ if (search == null || "?".equals(search) || "".equals(search)) {
+ query = null;
+ }
+ else if (search.charAt(0) == '?') {
+ query = search.substring(1);
+ }
+ else {
+ query = search;
+ }
+
+ url_ = UrlUtils.getUrlWithNewQuery(url_, query);
+ }
+
+ /**
+ * @return the username specified before the domain name.
+ */
+ @JsxGetter
+ public String getUsername() {
+ if (url_ == null) {
+ return null;
+ }
+
+ final String userInfo = url_.getUserInfo();
+ if (userInfo == null) {
+ return "";
+ }
+
+ return StringUtils.substringBefore(userInfo, ':');
+ }
+
+ @JsxSetter
+ public void setUsername(final String username) throws MalformedURLException {
+ if (url_ == null) {
+ return;
+ }
+ url_ = UrlUtils.getUrlWithNewUserName(url_, username.isEmpty() ? null : username);
+ }
+
/**
* Calls for instance for implicit conversion to string.
* @see com.gargoylesoftware.htmlunit.javascript.SimpleScriptable#getDefaultValue(java.lang.Class)
@@ -149,4 +445,30 @@ public Object getDefaultValue(final Class> hint) {
}
return url_.toExternalForm();
}
+
+ /**
+ * @return a serialized version of the URL,
+ * although in practice it seems to have the same effect as URL.toString().
+ */
+ @JsxFunction
+ public String toJSON() {
+ return jsToString();
+ }
+
+ /**
+ * Returns the text of the URL.
+ * @return the text
+ */
+ @JsxFunction(functionName = "toString")
+ public String jsToString() {
+ if (StringUtils.isEmpty(url_.getPath())) {
+ try {
+ return UrlUtils.getUrlWithNewPath(url_, "/").toExternalForm();
+ }
+ catch (final MalformedURLException e) {
+ return url_.toExternalForm();
+ }
+ }
+ return url_.toExternalForm();
+ }
}
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URLSearchParams.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URLSearchParams.java
index 572e3f8ca..26c801232 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URLSearchParams.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/URLSearchParams.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -328,6 +328,15 @@ public Object values() {
"URLSearchParams Iterator", NativeParamsIterator.Type.VALUES, params_.iterator());
}
+ /**
+ * Returns the text of the Range.
+ * @return the text
+ */
+ @JsxFunction(functionName = "toString")
+ public String jsToString() {
+ return URLEncodedUtils.format(NameValuePair.toHttpClient(params_), "UTF-8");
+ }
+
/**
* Calls for instance for implicit conversion to string.
* @see com.gargoylesoftware.htmlunit.javascript.SimpleScriptable#getDefaultValue(java.lang.Class)
@@ -336,7 +345,7 @@ public Object values() {
*/
@Override
public Object getDefaultValue(final Class> hint) {
- return URLEncodedUtils.format(NameValuePair.toHttpClient(params_), "UTF-8");
+ return jsToString();
}
/**
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocket.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocket.java
index 6f4763d24..a38284da3 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocket.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/WebSocket.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -402,7 +402,7 @@ public void close(final Object code, final Object reason) {
}
try {
- webSocketImpl_.closeClinet();
+ webSocketImpl_.closeClient();
}
catch (final Exception e) {
throw new RuntimeException(e);
diff --git a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java
index 2e341c525..99819b057 100644
--- a/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java
@@ -4,7 +4,7 @@
* 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
+ * https://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,
@@ -110,13 +110,13 @@
import com.gargoylesoftware.htmlunit.javascript.host.event.MouseEvent;
import com.gargoylesoftware.htmlunit.javascript.host.html.DataTransfer;
import com.gargoylesoftware.htmlunit.javascript.host.html.DocumentProxy;
-import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLBodyElement;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLCollection;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLDocument;
import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement;
import com.gargoylesoftware.htmlunit.javascript.host.performance.Performance;
import com.gargoylesoftware.htmlunit.javascript.host.speech.SpeechSynthesis;
import com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument;
+import com.gargoylesoftware.htmlunit.util.UrlUtils;
import com.gargoylesoftware.htmlunit.xml.XmlPage;
import net.sourceforge.htmlunit.corejs.javascript.Context;
@@ -556,7 +556,7 @@ public WindowProxy open(final Object url, final Object name, final Object featur
private URL makeUrlForOpenWindow(final String urlString) {
if (urlString.isEmpty()) {
- return WebClient.URL_ABOUT_BLANK;
+ return UrlUtils.URL_ABOUT_BLANK;
}
try {
@@ -1206,6 +1206,9 @@ public void scrollBy(final int x, final int y) {
if (body != null) {
body.setScrollLeft(body.getScrollLeft() + x);
body.setScrollTop(body.getScrollTop() + y);
+
+ final Event event = new Event(body, Event.TYPE_SCROLL);
+ body.fireEvent(event);
}
}
@@ -1218,6 +1221,9 @@ public void scrollByLines(final int lines) {
final HTMLElement body = ((HTMLDocument) document_).getBody();
if (body != null) {
body.setScrollTop(body.getScrollTop() + (19 * lines));
+
+ final Event event = new Event(body, Event.TYPE_SCROLL);
+ body.fireEvent(event);
}
}
@@ -1230,6 +1236,9 @@ public void scrollByPages(final int pages) {
final HTMLElement body = ((HTMLDocument) document_).getBody();
if (body != null) {
body.setScrollTop(body.getScrollTop() + (getInnerHeight() * pages));
+
+ final Event event = new Event(body, Event.TYPE_SCROLL);
+ body.fireEvent(event);
}
}
@@ -1244,6 +1253,9 @@ public void scrollTo(final int x, final int y) {
if (body != null) {
body.setScrollLeft(x);
body.setScrollTop(y);
+
+ final Event event = new Event(body, Event.TYPE_SCROLL);
+ body.fireEvent(event);
}
}
@@ -1253,17 +1265,7 @@ public void scrollTo(final int x, final int y) {
*/
@JsxGetter
public Object getOnload() {
- final Object onload = getEventHandler(Event.TYPE_LOAD);
- if (onload == null) {
- final HtmlPage page = (HtmlPage) getWebWindow().getEnclosedPage();
- final HtmlElement body = page.getBody();
- if (body != null) {
- final HTMLBodyElement b = body.getScriptableObject();
- return b.getEventHandler("onload");
- }
- return null;
- }
- return onload;
+ return getEventHandler(Event.TYPE_LOAD);
}
/**
@@ -2237,7 +2239,8 @@ public void setOnsubmit(final Object onsubmit) {
*/
@JsxFunction
public void postMessage(final String message, final String targetOrigin, final Object transfer) {
- final Page page = getWebWindow().getEnclosedPage();
+ final WebWindow webWindow = getWebWindow();
+ final Page page = webWindow.getEnclosedPage();
final URL currentURL = page.getUrl();
if (!"*".equals(targetOrigin) && !"/".equals(targetOrigin)) {
@@ -2269,8 +2272,8 @@ public void postMessage(final String message, final String targetOrigin, final O
event.setParentScope(this);
event.setPrototype(getPrototype(event.getClass()));
- final JavaScriptEngine jsEngine = (JavaScriptEngine) getWebWindow().getWebClient().getJavaScriptEngine();
- final PostponedAction action = new PostponedAction(page) {
+ final JavaScriptEngine jsEngine = (JavaScriptEngine) webWindow.getWebClient().getJavaScriptEngine();
+ final PostponedAction action = new PostponedAction(page, "Window.postMessage") {
@Override
public void execute() throws Exception {
final ContextAction