Skip to content

Commit a01b719

Browse files
committed
Chrome/Edge 141, Firefox 143, FirefoxESR 140
1 parent e0d92fc commit a01b719

File tree

6 files changed

+21
-56
lines changed

6 files changed

+21
-56
lines changed

src/main/java/org/htmlunit/BrowserVersionFeatures.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,12 @@ public enum BrowserVersionFeatures {
122122
@BrowserFeature({CHROME, EDGE})
123123
HTMLCOLLECTION_NAMED_ITEM_ID_FIRST,
124124

125-
/** Calling cookies setter with blank string does not reset the cookies. */
126-
@BrowserFeature({CHROME, EDGE, FF})
127-
HTMLDOCUMENT_COOKIES_IGNORE_BLANK,
128-
129125
/**
130126
/** {@code document.getElementsByName} returns an empty list if called with the empty string.
131127
*/
132128
@BrowserFeature({FF, FF_ESR})
133129
HTMLDOCUMENT_ELEMENTS_BY_NAME_EMPTY,
134130

135-
/** Calls to <code>document.XYZ</code> also looks at frames. */
136-
@BrowserFeature({CHROME, EDGE, FF})
137-
HTMLDOCUMENT_GET_ALSO_FRAMES,
138-
139131
/** Removing the active element from the dom tree triggers the onblur event. */
140132
@BrowserFeature({CHROME, EDGE})
141133
HTMLELEMENT_REMOVE_ACTIVE_TRIGGERS_BLUR_EVENT,

src/main/java/org/htmlunit/javascript/host/dom/Document.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.htmlunit.BrowserVersionFeatures.EVENT_TYPE_MUTATIONEVENT;
2121
import static org.htmlunit.BrowserVersionFeatures.EVENT_TYPE_TEXTEVENT;
2222
import static org.htmlunit.BrowserVersionFeatures.EVENT_TYPE_WHEELEVENT;
23-
import static org.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_COOKIES_IGNORE_BLANK;
2423
import static org.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_EVALUATE_RECREATES_RESULT;
2524
import static org.htmlunit.BrowserVersionFeatures.JS_DOCUMENT_SELECTION_RANGE_COUNT;
2625
import static org.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
@@ -49,7 +48,6 @@
4948
import org.htmlunit.HttpHeader;
5049
import org.htmlunit.Page;
5150
import org.htmlunit.SgmlPage;
52-
import org.htmlunit.WebClient;
5351
import org.htmlunit.WebResponse;
5452
import org.htmlunit.WebWindow;
5553
import org.htmlunit.corejs.javascript.Callable;
@@ -1119,14 +1117,12 @@ public String getCookie() {
11191117
*/
11201118
@JsxSetter
11211119
public void setCookie(final String newCookie) {
1122-
final SgmlPage sgmlPage = getPage();
1123-
final WebClient client = sgmlPage.getWebClient();
1124-
1125-
if (StringUtils.isBlank(newCookie)
1126-
&& client.getBrowserVersion().hasFeature(HTMLDOCUMENT_COOKIES_IGNORE_BLANK)) {
1120+
if (StringUtils.isBlank(newCookie)) {
11271121
return;
11281122
}
1129-
client.addCookie(newCookie, sgmlPage.getUrl(), this);
1123+
1124+
final SgmlPage sgmlPage = getPage();
1125+
sgmlPage.getWebClient().addCookie(newCookie, sgmlPage.getUrl(), this);
11301126
}
11311127

11321128
/**

src/main/java/org/htmlunit/javascript/host/html/HTMLDocument.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package org.htmlunit.javascript.host.html;
1616

1717
import static org.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_ELEMENTS_BY_NAME_EMPTY;
18-
import static org.htmlunit.BrowserVersionFeatures.HTMLDOCUMENT_GET_ALSO_FRAMES;
1918
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF;
2019
import static org.htmlunit.javascript.configuration.SupportedBrowser.FF_ESR;
2120

@@ -600,19 +599,17 @@ private Object getIt(final String name) {
600599
return NOT_FOUND;
601600
}
602601

603-
final boolean alsoFrames = getBrowserVersion().hasFeature(HTMLDOCUMENT_GET_ALSO_FRAMES);
604-
605602
// for performance,
606603
// we will calculate the elements to decide if we really have
607604
// to really create a HTMLCollection or not
608-
final List<DomNode> matchingElements = getItComputeElements(page, name, alsoFrames);
605+
final List<DomNode> matchingElements = getItComputeElements(page, name);
609606
final int size = matchingElements.size();
610607
if (size == 0) {
611608
return NOT_FOUND;
612609
}
613610
if (size == 1) {
614611
final DomNode object = matchingElements.get(0);
615-
if (alsoFrames && object instanceof BaseFrameElement) {
612+
if (object instanceof BaseFrameElement) {
616613
return ((BaseFrameElement) object).getEnclosedWindow().getScriptableObject();
617614
}
618615
return super.getScriptableFor(object);
@@ -621,7 +618,7 @@ private Object getIt(final String name) {
621618
final HTMLCollection coll = new HTMLCollection(page, matchingElements) {
622619
@Override
623620
protected HtmlUnitScriptable getScriptableFor(final Object object) {
624-
if (alsoFrames && object instanceof BaseFrameElement) {
621+
if (object instanceof BaseFrameElement) {
625622
return ((BaseFrameElement) object).getEnclosedWindow().getScriptableObject();
626623
}
627624
return super.getScriptableFor(object);
@@ -630,7 +627,7 @@ protected HtmlUnitScriptable getScriptableFor(final Object object) {
630627

631628
coll.setElementsSupplier(
632629
(Supplier<List<DomNode>> & Serializable)
633-
() -> getItComputeElements(page, name, alsoFrames));
630+
() -> getItComputeElements(page, name));
634631

635632
coll.setEffectOnCacheFunction(
636633
(java.util.function.Function<HtmlAttributeChangeEvent, EffectOnCache> & Serializable)
@@ -646,13 +643,11 @@ protected HtmlUnitScriptable getScriptableFor(final Object object) {
646643
return coll;
647644
}
648645

649-
static List<DomNode> getItComputeElements(final HtmlPage page, final String name,
650-
final boolean alsoFrames) {
646+
static List<DomNode> getItComputeElements(final HtmlPage page, final String name) {
651647
final List<DomElement> elements = page.getElementsByName(name);
652648
final List<DomNode> matchingElements = new ArrayList<>();
653649
for (final DomElement elt : elements) {
654-
if (elt instanceof HtmlForm || elt instanceof HtmlImage
655-
|| (alsoFrames && elt instanceof BaseFrameElement)) {
650+
if (elt instanceof HtmlForm || elt instanceof HtmlImage || elt instanceof BaseFrameElement) {
656651
matchingElements.add(elt);
657652
}
658653
}

src/test/java/org/htmlunit/javascript/host/html/HTMLAnchorElement2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ public void setType() throws Exception {
720720
FF = {":||||||", ":||||||", "mailto:||||||[email protected]", "tel:||||||123456",
721721
"foo:||||||blabla", "p:||||||", "p:||||||/", "p:||||||/TeMp"},
722722
FF_ESR = {":||||||", ":||||||", "mailto:||||||[email protected]", "tel:||||||123456",
723-
"foo:||||||blabla", "p:||||||//", "p:||||||/", "p:||||||/TeMp"})
723+
"foo:||||||blabla", "p:||||||", "p:||||||/", "p:||||||/TeMp"})
724724
public void propertiesNonStandardHref() throws Exception {
725725
final String html = DOCTYPE_HTML
726726
+ "<html>\n"

src/test/java/org/htmlunit/javascript/host/html/HTMLDocumentTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,7 @@ public void frames() throws Exception {
796796
* @throws Exception if the test fails
797797
*/
798798
@Test
799-
@Alerts(DEFAULT = {"[object Window]", "true"},
800-
FF_ESR = {"undefined", "false"})
799+
@Alerts({"[object Window]", "true"})
801800
public void frameAccessByName() throws Exception {
802801
final String html = DOCTYPE_HTML
803802
+ "<html><head><script>\n"
@@ -1593,8 +1592,7 @@ public void cookie_write_cookiesEnabled() throws Exception {
15931592
* @throws Exception if an error occurs
15941593
*/
15951594
@Test
1596-
@Alerts(DEFAULT = {"", "a", "a", "b", "b"},
1597-
FF_ESR = {"", "a", "", "b", ""})
1595+
@Alerts({"", "a", "a", "b", "b"})
15981596
public void cookie_write2() throws Exception {
15991597
final String html = DOCTYPE_HTML
16001598
+ "<html>\n"

src/test/java/org/htmlunit/javascript/host/html/HTMLElementTest.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6392,12 +6392,8 @@ public void hidden() throws Exception {
63926392
* @throws Exception if an error occurs
63936393
*/
63946394
@Test
6395-
@Alerts(DEFAULT = {"1 null/false", "2 /true", "3 /true", "4 hidden/true", "5 true/true", "6 false/true",
6396-
"7 until-found/until-found", "8 show/true", "9 Until-Found/until-found", "10 HIDDEN/true"},
6397-
FF_ESR = {"1 null/false", "2 /true", "3 /true", "4 hidden/true", "5 true/true", "6 false/true",
6398-
"7 until-found/true", "8 show/true", "9 Until-Found/true", "10 HIDDEN/true"})
6399-
@HtmlUnitNYI(FF_ESR = {"1 null/false", "2 /true", "3 /true", "4 hidden/true", "5 true/true", "6 false/true",
6400-
"7 until-found/until-found", "8 show/true", "9 Until-Found/until-found", "10 HIDDEN/true"})
6395+
@Alerts({"1 null/false", "2 /true", "3 /true", "4 hidden/true", "5 true/true", "6 false/true",
6396+
"7 until-found/until-found", "8 show/true", "9 Until-Found/until-found", "10 HIDDEN/true"})
64016397
public void hiddenGet() throws Exception {
64026398
final String html = DOCTYPE_HTML
64036399
+ "<html><body>\n"
@@ -6446,24 +6442,12 @@ public void hiddenGet() throws Exception {
64466442
* @throws Exception if an error occurs
64476443
*/
64486444
@Test
6449-
@Alerts(DEFAULT = {"1 null/false", "2 null/false", "3 /true", "4 /true", "5 null/false",
6450-
"6 null/false", "7 /true", "8 /true",
6451-
"9 null/false", "10 /true", "11 /true",
6452-
"12 null/false", "13 until-found/until-found", "14 null/false",
6453-
"15 null/false", "16 until-found/until-found",
6454-
"17 null/false", "18 /true"},
6455-
FF_ESR = {"1 null/false", "2 null/false", "3 /true", "4 /true", "5 null/false",
6456-
"6 null/false", "7 /true", "8 /true",
6457-
"9 null/false", "10 /true", "11 /true",
6458-
"12 null/false", "13 /true", "14 null/false",
6459-
"15 null/false", "16 /true",
6460-
"17 null/false", "18 /true"})
6461-
@HtmlUnitNYI(FF_ESR = {"1 null/false", "2 null/false", "3 /true", "4 /true", "5 null/false",
6462-
"6 null/false", "7 /true", "8 /true",
6463-
"9 null/false", "10 /true", "11 /true",
6464-
"12 null/false", "13 until-found/until-found", "14 null/false",
6465-
"15 null/false", "16 until-found/until-found",
6466-
"17 null/false", "18 /true"})
6445+
@Alerts({"1 null/false", "2 null/false", "3 /true", "4 /true", "5 null/false",
6446+
"6 null/false", "7 /true", "8 /true",
6447+
"9 null/false", "10 /true", "11 /true",
6448+
"12 null/false", "13 until-found/until-found", "14 null/false",
6449+
"15 null/false", "16 until-found/until-found",
6450+
"17 null/false", "18 /true"})
64676451
public void hiddenSet() throws Exception {
64686452
final String html = DOCTYPE_HTML
64696453
+ "<html><body>\n"

0 commit comments

Comments
 (0)