Skip to content

JS error: "let declaration not directly within block" with JakartaEE11 faces.js #1040

@WolfgangHG

Description

@WolfgangHG

Using HtmlUnit 4.17, I see this error when testing a Jakarta Faces app using the Mojarra implementation for JakartaEE11:

Okt. 11, 2025 7:26:40 PM org.htmlunit.javascript.DefaultJavaScriptErrorListener scriptException
SCHWERWIEGEND: Error during JavaScript execution
======= EXCEPTION START ========
Exception class=[org.htmlunit.corejs.javascript.EvaluatorException]
org.htmlunit.ScriptException: let declaration not directly within block (http://localhost:8080/jsf-test/jakarta.faces.resource/faces.js.jsf?ln=jakarta.faces#32)
        at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitCompileContextAction.run(JavaScriptEngine.java:900)
        at org.htmlunit.corejs.javascript.Context.call(Context.java:638)
        at org.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:452)
        at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:312)
        at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:735)
        at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:108)
        at org.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1119)
        at org.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1010)
        at org.htmlunit.html.ScriptElementSupport.executeScriptIfNeeded(ScriptElementSupport.java:185)
        at org.htmlunit.html.ScriptElementSupport$1.execute(ScriptElementSupport.java:112)
        at org.htmlunit.html.ScriptElementSupport.onAllChildrenAddedToPage(ScriptElementSupport.java:131)
        at org.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:216)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:526)
        at org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:287)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:472)
        at org.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1255)
        at org.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1199)
        at org.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:169)
        at org.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:264)
        at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3341)
        at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2246)
        at org.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:965)
        at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:355)
        at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:313)
        at org.htmlunit.cyberneko.xerces.parsers.AbstractXMLDocumentParser.parse(AbstractXMLDocumentParser.java:79)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:773)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:179)
        at org.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299)
        at org.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:218)
        at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:694)
        at org.htmlunit.WebClient.loadDownloadedResponses(WebClient.java:2858)
        at org.htmlunit.html.DomElement.click(DomElement.java:1181)
        at org.htmlunit.html.DomElement.click(DomElement.java:1102)
        at org.htmlunit.html.DomElement.click(DomElement.java:988)
        at org.htmlunit.html.DomElement.click(DomElement.java:965)
        at org.openqa.selenium.htmlunit.HtmlUnitMouse.click(HtmlUnitMouse.java:87)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$click$1(HtmlUnitDriver.java:378)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0(HtmlUnitDriver.java:349)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:842)
Caused by: org.htmlunit.corejs.javascript.EvaluatorException: let declaration not directly within block (http://localhost:8080/jsf-test/jakarta.faces.resource/faces.js.jsf?ln=jakarta.faces#32)
        at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:388)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:247)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:229)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:225)
        at org.htmlunit.corejs.javascript.Parser.defineSymbol(Parser.java:2485)
        at org.htmlunit.corejs.javascript.Parser.variables(Parser.java:2373)
        at org.htmlunit.corejs.javascript.Parser.letStatement(Parser.java:2096)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1359)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.switchStatement(Parser.java:1560)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1320)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.forLoop(Parser.java:1743)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1329)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.tryStatement(Parser.java:1813)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1332)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:736)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:1012)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:937)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3380)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.plainProperty(Parser.java:4095)
        at org.htmlunit.corejs.javascript.Parser.objectLiteral(Parser.java:3923)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3388)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2519)
        at org.htmlunit.corejs.javascript.Parser.returnOrYield(Parser.java:2147)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1378)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:736)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:1012)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:937)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3380)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2563)
        at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2519)
        at org.htmlunit.corejs.javascript.Parser.nameOrLabel(Parser.java:2267)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1410)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1466)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:636)
        at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:564)
        at org.htmlunit.corejs.javascript.Context.parse(Context.java:2649)
        at org.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2584)
        at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1529)
        at org.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:195)
        at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1517)
        at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitCompileContextAction.run(JavaScriptEngine.java:893)
        ... 40 more
Enclosed exception:
org.htmlunit.corejs.javascript.EvaluatorException: let declaration not directly within block (http://localhost:8080/jsf-test/jakarta.faces.resource/faces.js.jsf?ln=jakarta.faces#32)
        at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:388)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:247)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:229)
        at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:225)
        at org.htmlunit.corejs.javascript.Parser.defineSymbol(Parser.java:2485)
        at org.htmlunit.corejs.javascript.Parser.variables(Parser.java:2373)
        at org.htmlunit.corejs.javascript.Parser.letStatement(Parser.java:2096)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1359)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.switchStatement(Parser.java:1560)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1320)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.forLoop(Parser.java:1743)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1329)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.tryStatement(Parser.java:1813)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1332)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1474)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:736)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:1012)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:937)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3380)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.plainProperty(Parser.java:4095)
        at org.htmlunit.corejs.javascript.Parser.objectLiteral(Parser.java:3923)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3388)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2519)
        at org.htmlunit.corejs.javascript.Parser.returnOrYield(Parser.java:2147)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1378)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:736)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:1012)
        at org.htmlunit.corejs.javascript.Parser.function(Parser.java:937)
        at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3380)
        at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2968)
        at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2871)
        at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2781)
        at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2764)
        at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2750)
        at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2733)
        at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2711)
        at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2687)
        at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2678)
        at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2669)
        at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2660)
        at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2651)
        at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2642)
        at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2623)
        at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2591)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2545)
        at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2563)
        at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2519)
        at org.htmlunit.corejs.javascript.Parser.nameOrLabel(Parser.java:2267)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1410)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.statements(Parser.java:1221)
        at org.htmlunit.corejs.javascript.Parser.block(Parser.java:2199)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1388)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.getNextStatementAfterInlineComments(Parser.java:1631)
        at org.htmlunit.corejs.javascript.Parser.ifStatement(Parser.java:1466)
        at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1317)
        at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1262)
        at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:636)
        at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:564)
        at org.htmlunit.corejs.javascript.Context.parse(Context.java:2649)
        at org.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2584)
        at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1529)
        at org.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:195)
        at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1517)
        at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitCompileContextAction.run(JavaScriptEngine.java:893)
        at org.htmlunit.corejs.javascript.Context.call(Context.java:638)
        at org.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:452)
        at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:312)
        at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:735)
        at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:108)
        at org.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1119)
        at org.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1010)
        at org.htmlunit.html.ScriptElementSupport.executeScriptIfNeeded(ScriptElementSupport.java:185)
        at org.htmlunit.html.ScriptElementSupport$1.execute(ScriptElementSupport.java:112)
        at org.htmlunit.html.ScriptElementSupport.onAllChildrenAddedToPage(ScriptElementSupport.java:131)
        at org.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:216)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:526)
        at org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:287)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:472)
        at org.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1255)
        at org.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1199)
        at org.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:169)
        at org.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:264)
        at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3341)
        at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2246)
        at org.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:965)
        at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:355)
        at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:313)
        at org.htmlunit.cyberneko.xerces.parsers.AbstractXMLDocumentParser.parse(AbstractXMLDocumentParser.java:79)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:773)
        at org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:179)
        at org.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:299)
        at org.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:218)
        at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:694)
        at org.htmlunit.WebClient.loadDownloadedResponses(WebClient.java:2858)
        at org.htmlunit.html.DomElement.click(DomElement.java:1181)
        at org.htmlunit.html.DomElement.click(DomElement.java:1102)
        at org.htmlunit.html.DomElement.click(DomElement.java:988)
        at org.htmlunit.html.DomElement.click(DomElement.java:965)
        at org.openqa.selenium.htmlunit.HtmlUnitMouse.click(HtmlUnitMouse.java:87)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$click$1(HtmlUnitDriver.java:378)
        at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0(HtmlUnitDriver.java:349)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:842)
== CALLING JAVASCRIPT ==

My sample continues to run, so the error seems to be handled internally, but it looks rather ugly and apparently something is not working as expected.

I have a sample to reproduce the error, but i requires a few steps:

  1. download WildFly 37.0.1.Final Preview (for JakartaEE 11 features) from https://github.com/wildfly/wildfly/releases/download/37.0.1.Final/wildflypreview-37.0.1.Final.zip and unzip
  2. you need Java 17
  3. rename attached "jsf-test.war.zip" to "jsf-test.war" and copy it to to WILDFLY_HOME\standalone\deployments: jsf-test.war.zip
  4. start WildFly:
    set JBOSS_HOME=c:\path\to\wildfly-preview-37.0.1.Final
    c:\path\to\wildfly-preview-37.0.1.Final\bin\startup.bat (or startup.sh)
    
    you can test the app by browsing to http://localhost:8080/jsf-test/index.jsf
  5. now launch attached sample "htmlunittest.zip" (a small Eclipse maven project): mvn clean compile exec:java - you should see a large exception.
    htmlunittest.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions