Skip to content

Commit 7ca8259

Browse files
committed
on the way to use html5 doctype for all our tests
1 parent 0d42408 commit 7ca8259

36 files changed

+653
-568
lines changed

src/changes/changes.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
<body>
1010
<release version="4.11.0" date="March xx, 2025" description="Chrome/Edge 134, Firefox 136, Rhino regex, less dependencies, Bugfixes">
11+
<action type="fix" dev="RhinoTeam">
12+
core-js: An issue where capture groups in quantified expressions (min = 2) were not cleared between iterations fixed.
13+
For example, in /(?:(\2)(\d)){2}/, during the second iteration, \2 incorrectly retained the first iteration's value instead of being reset.
14+
</action>
1115
<action type="remove" dev="rbri">
1216
Switched back from our RegExp translation into java regular expressions to use the core Rhino stuff. Rhino mades significant
1317
progress in this arae. This simplifies out impl and supports more features in the future.

src/test/java/org/htmlunit/javascript/ArgumentsTest.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public class ArgumentsTest extends WebDriverTestCase {
3535
@Test
3636
@Alerts({"0", "0", "1", "0"})
3737
public void arguments() throws Exception {
38-
final String html
39-
= "<html><head>\n"
38+
final String html = DOCTYPE_HTML
39+
+ "<html><head>\n"
4040
+ "<script>\n"
4141
+ LOG_TITLE_FUNCTION
4242
+ "function test() {\n"
@@ -60,8 +60,8 @@ public void arguments() throws Exception {
6060
@Test
6161
@Alerts({"null", "null"})
6262
public void argumentsShouldBeNullOutsideFunction() throws Exception {
63-
final String html
64-
= "<html><body>"
63+
final String html = DOCTYPE_HTML
64+
+ "<html><body>"
6565
+ "<script>\n"
6666
+ LOG_TITLE_FUNCTION
6767
+ "function test() {\n"
@@ -80,8 +80,8 @@ public void argumentsShouldBeNullOutsideFunction() throws Exception {
8080
@Test
8181
@Alerts("2")
8282
public void passedCountDifferentFromDeclared() throws Exception {
83-
final String html
84-
= "<html><head>\n"
83+
final String html = DOCTYPE_HTML
84+
+ "<html><head>\n"
8585
+ "<script>\n"
8686
+ LOG_TITLE_FUNCTION
8787
+ "function test() {\n"
@@ -102,8 +102,8 @@ public void passedCountDifferentFromDeclared() throws Exception {
102102
@Test
103103
@Alerts({"2", "world", "undefined", "undefined"})
104104
public void readOnlyWhenAccessedThroughFunction() throws Exception {
105-
final String html
106-
= "<html><head>\n"
105+
final String html = DOCTYPE_HTML
106+
+ "<html><head>\n"
107107
+ "<script>\n"
108108
+ LOG_TITLE_FUNCTION
109109
+ "function test() {\n"
@@ -129,7 +129,8 @@ public void readOnlyWhenAccessedThroughFunction() throws Exception {
129129
@Test
130130
@Alerts({"2", "hi", "undefined", "you"})
131131
public void writableWithinFunction() throws Exception {
132-
final String html = "<html><body>\n"
132+
final String html = DOCTYPE_HTML
133+
+ "<html><body>\n"
133134
+ "<script>\n"
134135
+ LOG_TITLE_FUNCTION
135136
+ "function test1() {\n"
@@ -152,7 +153,8 @@ public void writableWithinFunction() throws Exception {
152153
@Test
153154
@Alerts("false")
154155
public void argumentsEqualsFnArguments() throws Exception {
155-
final String html = "<html><body>\n"
156+
final String html = DOCTYPE_HTML
157+
+ "<html><body>\n"
156158
+ "<script>\n"
157159
+ LOG_TITLE_FUNCTION
158160
+ "function test1() {\n"
@@ -170,7 +172,8 @@ public void argumentsEqualsFnArguments() throws Exception {
170172
@Test
171173
@Alerts("hi")
172174
public void argumentsAsParameter() throws Exception {
173-
final String html = "<html><body>"
175+
final String html = DOCTYPE_HTML
176+
+ "<html><body>"
174177
+ "<script>\n"
175178
+ LOG_TITLE_FUNCTION
176179
+ "function test1(arguments) {\n"

src/test/java/org/htmlunit/javascript/AttributeCaseTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ private void setupAttributeTest(final String content, final String elementId) th
174174

175175
private void setupGetAttributeTest(final String attributeName, final String attributeValue) throws Exception {
176176
final String elementId = "p-id";
177-
final String content = "<html><head><title>AttributeCaseTest</title></head><body>\n"
177+
final String content = DOCTYPE_HTML
178+
+ "<html><head><title>AttributeCaseTest</title></head><body>\n"
178179
+ "<p id=\"" + elementId + "\" " + attributeName + "=\"" + attributeValue + "\">\n"
179180
+ "</body></html>";
180181

@@ -187,8 +188,8 @@ private void setupSetAttributeTest(
187188
throws Exception {
188189

189190
final String elementId = "p-id";
190-
final String content
191-
= "<html><head><title>AttributeCaseTest</title></head><body>\n"
191+
final String content = DOCTYPE_HTML
192+
+ "<html><head><title>AttributeCaseTest</title></head><body>\n"
192193
+ "<p id=\"" + elementId + "\" " + attributeName + "=\"" + attributeValue + "\">\n"
193194
+ "<script language=\"javascript\" type=\"text/javascript\">\n<!--\n"
194195
+ " document.getElementById(\"" + elementId + "\").setAttribute(\"" + attributeName + "\", \""

src/test/java/org/htmlunit/javascript/DebugFrameImplTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ public void tearDown() throws Exception {
7373
*/
7474
@Test
7575
public void withCallable() throws Exception {
76-
final String content = "<html><head><title>debug test</title>\n"
76+
final String content = DOCTYPE_HTML
77+
+ "<html><head><title>debug test</title>\n"
7778
+ "<script>\n"
7879
+ " var counter = 0;\n"
7980
+ " window.__defineGetter__('foo', function(a) { return counter++ });\n"

src/test/java/org/htmlunit/javascript/ErrorTest.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public class ErrorTest extends WebDriverTestCase {
4646
FF_ESR = {"Error", "Whoops!", "undefined", "undefined", "undefined",
4747
"25", "true", "Error/Error"})
4848
public void error() throws Exception {
49-
final String html
50-
= "<html>\n"
49+
final String html = DOCTYPE_HTML
50+
+ "<html>\n"
5151
+ "<head>\n"
5252
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
5353
+ "</head>\n"
@@ -90,8 +90,8 @@ public void error() throws Exception {
9090
FF_ESR = {"EvalError", "Whoops!", "undefined", "undefined", "undefined",
9191
"25", "true", "true", "EvalError"})
9292
public void evalError() throws Exception {
93-
final String html
94-
= "<html>\n"
93+
final String html = DOCTYPE_HTML
94+
+ "<html>\n"
9595
+ "<head>\n"
9696
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
9797
+ "</head>\n"
@@ -135,8 +135,8 @@ public void evalError() throws Exception {
135135
FF_ESR = {"RangeError", "Whoops!", "undefined", "undefined", "undefined",
136136
"25", "true", "true", "RangeError"})
137137
public void rangeError() throws Exception {
138-
final String html
139-
= "<html>\n"
138+
final String html = DOCTYPE_HTML
139+
+ "<html>\n"
140140
+ "<head>\n"
141141
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
142142
+ "</head>\n"
@@ -180,8 +180,8 @@ public void rangeError() throws Exception {
180180
FF_ESR = {"ReferenceError", "Whoops!", "undefined", "undefined", "undefined",
181181
"25", "true", "true", "ReferenceError"})
182182
public void referenceError() throws Exception {
183-
final String html
184-
= "<html>\n"
183+
final String html = DOCTYPE_HTML
184+
+ "<html>\n"
185185
+ "<head>\n"
186186
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
187187
+ "</head>\n"
@@ -225,8 +225,8 @@ public void referenceError() throws Exception {
225225
FF_ESR = {"SyntaxError", "Whoops!", "undefined", "undefined", "undefined",
226226
"25", "true", "true", "SyntaxError"})
227227
public void syntaxError() throws Exception {
228-
final String html
229-
= "<html>\n"
228+
final String html = DOCTYPE_HTML
229+
+ "<html>\n"
230230
+ "<head>\n"
231231
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
232232
+ "</head>\n"
@@ -270,8 +270,8 @@ public void syntaxError() throws Exception {
270270
FF_ESR = {"TypeError", "Whoops!", "undefined", "undefined", "undefined",
271271
"25", "true", "true", "TypeError"})
272272
public void typeError() throws Exception {
273-
final String html
274-
= "<html>\n"
273+
final String html = DOCTYPE_HTML
274+
+ "<html>\n"
275275
+ "<head>\n"
276276
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
277277
+ "</head>\n"
@@ -315,8 +315,8 @@ public void typeError() throws Exception {
315315
FF_ESR = {"URIError", "Whoops!", "undefined", "undefined", "undefined",
316316
"25", "true", "true", "URIError"})
317317
public void uriError() throws Exception {
318-
final String html
319-
= "<html>\n"
318+
final String html = DOCTYPE_HTML
319+
+ "<html>\n"
320320
+ "<head>\n"
321321
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
322322
+ "</head>\n"
@@ -367,8 +367,8 @@ public void uriError() throws Exception {
367367
"undefined", "undefined",
368368
"25", "true", "true", "AggregateError/AggregateError"})
369369
public void aggregateError() throws Exception {
370-
final String html
371-
= "<html>\n"
370+
final String html = DOCTYPE_HTML
371+
+ "<html>\n"
372372
+ "<head>\n"
373373
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
374374
+ "</head>\n"
@@ -414,8 +414,8 @@ public void aggregateError() throws Exception {
414414
FF_ESR = {"InternalError", "Whoops!", "undefined", "undefined", "undefined", "25",
415415
"true", "true", "InternalError/InternalError"})
416416
public void internalError() throws Exception {
417-
final String html
418-
= "<html>\n"
417+
final String html = DOCTYPE_HTML
418+
+ "<html>\n"
419419
+ "<head>\n"
420420
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
421421
+ "</head>\n"
@@ -452,8 +452,8 @@ public void internalError() throws Exception {
452452
FF = {"Error", "", "undefined", "undefined", "undefined", "25"},
453453
FF_ESR = {"Error", "", "undefined", "undefined", "undefined", "25"})
454454
public void ctorWithoutParams() throws Exception {
455-
final String html
456-
= "<html>\n"
455+
final String html = DOCTYPE_HTML
456+
+ "<html>\n"
457457
+ "<head>\n"
458458
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
459459
+ "</head>\n"
@@ -487,8 +487,8 @@ public void ctorWithoutParams() throws Exception {
487487
FF = {"Error", "msg", "undefined", "undefined", "undefined", "25"},
488488
FF_ESR = {"Error", "msg", "undefined", "undefined", "undefined", "25"})
489489
public void ctorFilename() throws Exception {
490-
final String html
491-
= "<html>\n"
490+
final String html = DOCTYPE_HTML
491+
+ "<html>\n"
492492
+ "<head>\n"
493493
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
494494
+ "</head>\n"
@@ -522,8 +522,8 @@ public void ctorFilename() throws Exception {
522522
FF = {"Error", "test", "undefined", "undefined", "undefined", "25"},
523523
FF_ESR = {"Error", "test", "undefined", "undefined", "undefined", "25"})
524524
public void ctorAsFunction() throws Exception {
525-
final String html
526-
= "<html>\n"
525+
final String html = DOCTYPE_HTML
526+
+ "<html>\n"
527527
+ "<head>\n"
528528
+ "<script>" + LOG_TITLE_FUNCTION + "</script>\n"
529529
+ "</head>\n"

src/test/java/org/htmlunit/javascript/FunctionsRestParametersTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public class FunctionsRestParametersTest extends WebDriverTestCase {
3434
@Test
3535
@Alerts("1,abc,2,##")
3636
public void oneRestArg() throws Exception {
37-
final String html
38-
= "<html><head>\n"
37+
final String html = DOCTYPE_HTML
38+
+ "<html><head>\n"
3939
+ "<script>\n"
4040
+ LOG_TITLE_FUNCTION
4141
+ "</script></head>\n"
@@ -59,8 +59,8 @@ public void oneRestArg() throws Exception {
5959
@Test
6060
@Alerts("true-0")
6161
public void oneRestArgNothingProvided() throws Exception {
62-
final String html
63-
= "<html><head>\n"
62+
final String html = DOCTYPE_HTML
63+
+ "<html><head>\n"
6464
+ "<script>\n"
6565
+ LOG_TITLE_FUNCTION
6666
+ "</script></head>\n"
@@ -85,8 +85,8 @@ public void oneRestArgNothingProvided() throws Exception {
8585
@Test
8686
@Alerts("true-1")
8787
public void oneRestArgOneProvided() throws Exception {
88-
final String html
89-
= "<html><head>\n"
88+
final String html = DOCTYPE_HTML
89+
+ "<html><head>\n"
9090
+ "<script>\n"
9191
+ LOG_TITLE_FUNCTION
9292
+ "</script></head>\n"
@@ -111,8 +111,8 @@ public void oneRestArgOneProvided() throws Exception {
111111
@Test
112112
@Alerts("abc,2,##")
113113
public void twoRestArg() throws Exception {
114-
final String html
115-
= "<html><head>\n"
114+
final String html = DOCTYPE_HTML
115+
+ "<html><head>\n"
116116
+ "<script>\n"
117117
+ LOG_TITLE_FUNCTION
118118
+ "</script></head>\n"
@@ -136,8 +136,8 @@ public void twoRestArg() throws Exception {
136136
@Test
137137
@Alerts("undefined - true-0")
138138
public void twoRestArgNothingProvided() throws Exception {
139-
final String html
140-
= "<html><head>\n"
139+
final String html = DOCTYPE_HTML
140+
+ "<html><head>\n"
141141
+ "<script>\n"
142142
+ LOG_TITLE_FUNCTION
143143
+ "</script></head>\n"
@@ -161,8 +161,8 @@ public void twoRestArgNothingProvided() throws Exception {
161161
@Test
162162
@Alerts("77 - true-0")
163163
public void twoRestArgOneProvided() throws Exception {
164-
final String html
165-
= "<html><head>\n"
164+
final String html = DOCTYPE_HTML
165+
+ "<html><head>\n"
166166
+ "<script>\n"
167167
+ LOG_TITLE_FUNCTION
168168
+ "</script></head>\n"
@@ -186,8 +186,8 @@ public void twoRestArgOneProvided() throws Exception {
186186
@Test
187187
@Alerts("1-4")
188188
public void arguments() throws Exception {
189-
final String html
190-
= "<html><head>\n"
189+
final String html = DOCTYPE_HTML
190+
+ "<html><head>\n"
191191
+ "<script>\n"
192192
+ LOG_TITLE_FUNCTION
193193
+ "</script></head>\n"
@@ -211,8 +211,8 @@ public void arguments() throws Exception {
211211
@Test
212212
@Alerts("0-1")
213213
public void length() throws Exception {
214-
final String html
215-
= "<html><head>\n"
214+
final String html = DOCTYPE_HTML
215+
+ "<html><head>\n"
216216
+ "<script>\n"
217217
+ LOG_TITLE_FUNCTION
218218
+ "</script></head>\n"
@@ -235,8 +235,8 @@ public void length() throws Exception {
235235
@Test
236236
@Alerts("2-1-0")
237237
public void argLength() throws Exception {
238-
final String html
239-
= "<html><head>\n"
238+
final String html = DOCTYPE_HTML
239+
+ "<html><head>\n"
240240
+ "<script>\n"
241241
+ LOG_TITLE_FUNCTION
242242
+ "</script></head>\n"
@@ -260,8 +260,8 @@ public void argLength() throws Exception {
260260
@Test
261261
@Alerts("function rest(...restArgs) { return restArgs.length; }")
262262
public void string() throws Exception {
263-
final String html
264-
= "<html><head>\n"
263+
final String html = DOCTYPE_HTML
264+
+ "<html><head>\n"
265265
+ "<script>\n"
266266
+ LOG_TITLE_FUNCTION
267267
+ "</script></head>\n"

0 commit comments

Comments
 (0)