Skip to content

Commit 51b1480

Browse files
committed
remove deprecated stuff
1 parent ed0ca2e commit 51b1480

7 files changed

Lines changed: 22 additions & 202 deletions

File tree

src/changes/changes.xml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@
77
</properties>
88

99
<body>
10-
<release version="4.17.0" date="September xx, 2025" description="Chrome/Edge 140, Firefox 142, css :has(), :is(), :where(), BroadcastChannel, Bugfixes">
10+
<release version="4.17.0" date="October xx, 2025" description="Chrome/Edge 140, Firefox 142, css :has(), :is(), :where(), BroadcastChannel, Bugfixes">
11+
<action type="remove" dev="rbri">
12+
Deprecated methods HTMLParser.parse(WebResponse, HtmlPage, boolean, boolean),
13+
HTMLParser.parseFragment(DomNode, DomNode, String, boolean),
14+
and HTMLParser.parseFragment(DomNode, String) removed.
15+
</action>
16+
<action type="remove" dev="rbri">
17+
Deprecated method UrlUtils.decodeDataUrl(byte[]) removed.
18+
</action>
19+
<action type="remove" dev="rbri">
20+
Deprecated method AbstractJavaScriptConfiguration.isCompatible(SupportedBrowser, SupportedBrowser) removed.
21+
</action>
22+
<action type="remove" dev="rbri">
23+
Deprecated class org.htmlunit.html.DomNode.DescendantElementsIterator removed.
24+
</action>
1125
<action type="update" dev="Rene Schwietzke">
1226
Use a new HTMLElementsWithCache object for each neko parser run to avoid race conditions under load.
1327
</action>

src/main/java/org/htmlunit/html/DomNode.java

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,120 +1397,6 @@ public final Iterable<DomElement> getDomElementDescendants() {
13971397
return () -> new DescendantDomElementsIterator();
13981398
}
13991399

1400-
/**
1401-
* Iterates over all descendants of a specific type, in document order.
1402-
* @param <T> the type of nodes over which to iterate
1403-
*
1404-
* @deprecated as of version 4.7.0; use {@link DescendantDomNodesIterator},
1405-
* {@link DescendantDomElementsIterator}, or {@link DescendantHtmlElementsIterator} instead.
1406-
*/
1407-
@Deprecated
1408-
protected class DescendantElementsIterator<T extends DomNode> implements Iterator<T> {
1409-
1410-
private DomNode currentNode_;
1411-
private DomNode nextNode_;
1412-
private final Class<T> type_;
1413-
1414-
/**
1415-
* Creates a new instance which iterates over the specified node type.
1416-
* @param type the type of nodes over which to iterate
1417-
*/
1418-
public DescendantElementsIterator(final Class<T> type) {
1419-
type_ = type;
1420-
nextNode_ = getFirstChildElement(DomNode.this);
1421-
}
1422-
1423-
/** {@inheritDoc} */
1424-
@Override
1425-
public boolean hasNext() {
1426-
return nextNode_ != null;
1427-
}
1428-
1429-
/** {@inheritDoc} */
1430-
@Override
1431-
public T next() {
1432-
return nextNode();
1433-
}
1434-
1435-
/** {@inheritDoc} */
1436-
@Override
1437-
public void remove() {
1438-
if (currentNode_ == null) {
1439-
throw new IllegalStateException("Unable to remove current node, because there is no current node.");
1440-
}
1441-
final DomNode current = currentNode_;
1442-
while (nextNode_ != null && current.isAncestorOf(nextNode_)) {
1443-
next();
1444-
}
1445-
current.remove();
1446-
}
1447-
1448-
/**
1449-
* @return the next node, if there is one
1450-
*/
1451-
@SuppressWarnings("unchecked")
1452-
public T nextNode() {
1453-
currentNode_ = nextNode_;
1454-
setNextElement();
1455-
return (T) currentNode_;
1456-
}
1457-
1458-
private void setNextElement() {
1459-
DomNode next = getFirstChildElement(nextNode_);
1460-
if (next == null) {
1461-
next = getNextDomSibling(nextNode_);
1462-
}
1463-
if (next == null) {
1464-
next = getNextElementUpwards(nextNode_);
1465-
}
1466-
nextNode_ = next;
1467-
}
1468-
1469-
private DomNode getNextElementUpwards(final DomNode startingNode) {
1470-
if (startingNode == DomNode.this) {
1471-
return null;
1472-
}
1473-
1474-
DomNode parent = startingNode.getParentNode();
1475-
while (parent != null && parent != DomNode.this) {
1476-
DomNode next = parent.getNextSibling();
1477-
while (next != null && !isAccepted(next)) {
1478-
next = next.getNextSibling();
1479-
}
1480-
if (next != null) {
1481-
return next;
1482-
}
1483-
parent = parent.getParentNode();
1484-
}
1485-
return null;
1486-
}
1487-
1488-
private DomNode getFirstChildElement(final DomNode parent) {
1489-
DomNode node = parent.getFirstChild();
1490-
while (node != null && !isAccepted(node)) {
1491-
node = node.getNextSibling();
1492-
}
1493-
return node;
1494-
}
1495-
1496-
/**
1497-
* Indicates if the node is accepted. If not it won't be explored at all.
1498-
* @param node the node to test
1499-
* @return {@code true} if accepted
1500-
*/
1501-
protected boolean isAccepted(final DomNode node) {
1502-
return type_.isAssignableFrom(node.getClass());
1503-
}
1504-
1505-
private DomNode getNextDomSibling(final DomNode element) {
1506-
DomNode node = element.getNextSibling();
1507-
while (node != null && !isAccepted(node)) {
1508-
node = node.getNextSibling();
1509-
}
1510-
return node;
1511-
}
1512-
}
1513-
15141400
/**
15151401
* Iterates over all descendants DomNodes, in document order.
15161402
*/

src/main/java/org/htmlunit/html/parser/HTMLParser.java

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,6 @@ public interface HTMLParser {
6969
ElementFactory getElementFactory(SgmlPage page, String namespaceURI,
7070
String qualifiedName, boolean insideSvg, boolean svgSupport);
7171

72-
/**
73-
* Parses the HTML content from the given string into an object tree representation.
74-
*
75-
* @param parent the parent for the new nodes
76-
* @param source the (X)HTML to be parsed
77-
* @throws SAXException if a SAX error occurs
78-
* @throws IOException if an IO error occurs
79-
*
80-
* @deprecated as of version 4.12.0; use
81-
* {@link #parseFragment(WebClient, DomNode, DomNode, String, boolean)} instead.
82-
*/
83-
@Deprecated
84-
default void parseFragment(final DomNode parent, final String source) throws SAXException, IOException {
85-
parseFragment(null, parent, parent, source, false);
86-
}
87-
8872
/**
8973
* Parses the HTML content from the given string into an object tree representation.
9074
*
@@ -99,25 +83,6 @@ default void parseFragment(final DomNode parent, final String source) throws SAX
9983
void parseFragment(WebClient webClient, DomNode parent, DomNode context, String source,
10084
boolean createdByJavascript) throws SAXException, IOException;
10185

102-
/**
103-
* Parses the HTML content from the given string into an object tree representation.
104-
*
105-
* @param parent where the new parsed nodes will be added to
106-
* @param context the context to build the fragment context stack
107-
* @param source the (X)HTML to be parsed
108-
* @param createdByJavascript if true the (script) tag was created by javascript
109-
* @throws SAXException if a SAX error occurs
110-
* @throws IOException if an IO error occurs
111-
*
112-
* @deprecated as of version 4.12.0; use
113-
* {@link #parseFragment(WebClient, DomNode, DomNode, String, boolean)} instead.
114-
*/
115-
@Deprecated
116-
default void parseFragment(final DomNode parent, final DomNode context, final String source,
117-
final boolean createdByJavascript) throws SAXException, IOException {
118-
parseFragment(null, parent, context, source, createdByJavascript);
119-
}
120-
12186
/**
12287
* Parses the WebResponse into an object tree representation.
12388
*
@@ -130,22 +95,4 @@ default void parseFragment(final DomNode parent, final DomNode context, final St
13095
*/
13196
void parse(WebClient webClient, WebResponse webResponse, HtmlPage page,
13297
boolean xhtml, boolean createdByJavascript) throws IOException;
133-
134-
/**
135-
* Parses the WebResponse into an object tree representation.
136-
*
137-
* @param webResponse the response data
138-
* @param page the HtmlPage to add the nodes
139-
* @param xhtml if true use the XHtml parser
140-
* @param createdByJavascript if true the (script) tag was created by javascript
141-
* @throws IOException if there is an IO error
142-
*
143-
* @deprecated as of version 4.12.0; use
144-
* {@link #parse(WebClient, WebResponse, HtmlPage, boolean, boolean)} instead.
145-
*/
146-
@Deprecated
147-
default void parse(final WebResponse webResponse, final HtmlPage page, final boolean xhtml,
148-
final boolean createdByJavascript) throws IOException {
149-
parse(null, webResponse, page, xhtml, createdByJavascript);
150-
}
15198
}

src/main/java/org/htmlunit/javascript/configuration/AbstractJavaScriptConfiguration.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,19 +372,6 @@ private static boolean isSupported(final SupportedBrowser[] browsers, final Supp
372372
return false;
373373
}
374374

375-
/**
376-
* Returns whether the two {@link SupportedBrowser} are compatible or not.
377-
* @param browser1 the first {@link SupportedBrowser}
378-
* @param browser2 the second {@link SupportedBrowser}
379-
* @return whether the two {@link SupportedBrowser} are compatible or not
380-
*
381-
* @deprecated as of version 4.8.0; will be removed without replacement
382-
*/
383-
@Deprecated
384-
public static boolean isCompatible(final SupportedBrowser browser1, final SupportedBrowser browser2) {
385-
return browser1 == browser2;
386-
}
387-
388375
/**
389376
* Returns an immutable map containing the DOM to JavaScript mappings. Keys are
390377
* java classes for the various DOM classes (e.g. HtmlInput.class) and the values

src/main/java/org/htmlunit/util/UrlUtils.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,20 +1378,6 @@ public static URL removeRedundantPort(final URL url) throws MalformedURLExceptio
13781378
return url;
13791379
}
13801380

1381-
/**
1382-
* Decodes an array of URL safe 7-bit characters into an array of original bytes.
1383-
* Escaped characters are converted back to their original representation.
1384-
* @param bytes array of URL safe characters
1385-
* @return array of original bytes
1386-
* @throws IllegalArgumentException in case of error
1387-
*
1388-
* @deprecated as of version 4.11.0; use {@link #decodeDataUrl(byte[], boolean)} instead
1389-
*/
1390-
@Deprecated
1391-
public static byte[] decodeDataUrl(final byte[] bytes) throws IllegalArgumentException {
1392-
return decodeDataUrl(bytes, false);
1393-
}
1394-
13951381
/**
13961382
* Decodes an array of URL safe 7-bit characters into an array of original bytes.
13971383
* Escaped characters are converted back to their original representation.

src/test/java/org/htmlunit/BrowserVersionFeaturesTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
import java.util.List;
2828

2929
import org.apache.commons.io.FileUtils;
30-
import org.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration;
3130
import org.htmlunit.javascript.configuration.BrowserFeature;
3231
import org.htmlunit.javascript.configuration.SupportedBrowser;
3332
import org.junit.jupiter.api.Test;
3433

34+
import com.tngtech.archunit.thirdparty.com.google.common.base.Objects;
35+
3536
/**
3637
* Tests for {@link BrowserVersionFeatures}.
3738
*
@@ -88,9 +89,8 @@ public void unusedFeatures() throws Exception {
8889
if (browserFeature != null) {
8990
for (final SupportedBrowser annotatedBrowser : browserFeature.value()) {
9091
boolean inUse = false;
91-
for (final BrowserVersion supportedBrowser : browsers) {
92-
if (AbstractJavaScriptConfiguration.isCompatible(expectedBrowserName(supportedBrowser),
93-
annotatedBrowser)) {
92+
for (final BrowserVersion supportedBrowserVersion : browsers) {
93+
if (Objects.equal(supportedBrowser(supportedBrowserVersion), annotatedBrowser)) {
9494
inUse = true;
9595
continue;
9696
}
@@ -104,7 +104,7 @@ public void unusedFeatures() throws Exception {
104104
}
105105
}
106106

107-
private static SupportedBrowser expectedBrowserName(final BrowserVersion browser) {
107+
private static SupportedBrowser supportedBrowser(final BrowserVersion browser) {
108108
if (browser == BrowserVersion.EDGE) {
109109
return SupportedBrowser.EDGE;
110110
}

src/test/java/org/htmlunit/html/parser/HTMLParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void simpleHTMLString() throws Exception {
5353
final HtmlPage page = new HtmlPage(webResponse, webClient.getCurrentWindow());
5454
webClient.getCurrentWindow().setEnclosedPage(page);
5555

56-
webClient.getPageCreator().getHtmlParser().parse(webResponse, page, false, false);
56+
webClient.getPageCreator().getHtmlParser().parse(null, webResponse, page, false, false);
5757

5858
final String stringVal = page.<HtmlDivision>getFirstByXPath("//div").getFirstChild().getNodeValue();
5959
assertEquals("TEST", stringVal);
@@ -139,7 +139,7 @@ public void tableWithoutColgroup() throws Exception {
139139
final XHtmlPage page = new XHtmlPage(webResponse, webClient.getCurrentWindow());
140140
webClient.getCurrentWindow().setEnclosedPage(page);
141141

142-
webClient.getPageCreator().getHtmlParser().parse(webResponse, page, true, false);
142+
webClient.getPageCreator().getHtmlParser().parse(null, webResponse, page, true, false);
143143

144144
final DomElement col = page.getElementsByTagName("col").get(0);
145145
assertEquals(col.getParentNode().getNodeName(), HtmlTableColumnGroup.TAG_NAME);

0 commit comments

Comments
 (0)