Skip to content

[🐛 Bug]: JS parse error when upgrading to Bootstrap v5 #17150

@hantsy

Description

@hantsy

Description

I maintained an example project that demonstrates Jakarta EE Faces and used the Arquillian Graphene to test UI interactions, which relied on Selenium in the background.

The previous Bootstrap v4 worked well, but when I tried to upgrade to Bootstrap v5, it failed.

Reproducible Code

https://github.com/hantsy/jakartaee-faces-sample/actions/runs/22535583200/job/65282277014#step:5:71

Debugging Logs

https://github.com/hantsy/jakartaee-faces-sample/actions/runs/22535583200/job/65282277014#step:5:71


 
Error:  com.example.it.HomeScreenTest.testHomePage -- Time elapsed: 2.695 s <<< ERROR!
org.openqa.selenium.WebDriverException: 
org.htmlunit.ScriptException: syntax error (https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.js#272)
Build info: version: '4.40.0', revision: 'b3333f1'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.14.0-1017-azure', java.version: '17.0.18'
Driver info: driver.version: HtmlUnitDriver
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:789)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$get$7(HtmlUnitDriver.java:749)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0(HtmlUnitDriver.java:386)
	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:840)
Caused by: org.htmlunit.ScriptException: syntax error (https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.js#272)
	at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitCompileContextAction.run(JavaScriptEngine.java:892)
	at org.htmlunit.corejs.javascript.Context.call(Context.java:636)
	at org.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:462)
	at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:325)
	at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:727)
	at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:106)
	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:1332)
	at org.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1255)
	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:3405)
	at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2309)
	at org.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:984)
	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:178)
	at org.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:305)
	at org.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:218)
	at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:694)
	at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:587)
	at org.htmlunit.WebClient.getPage(WebClient.java:504)
	at org.htmlunit.WebClient.getPage(WebClient.java:413)
	at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:768)
	... 5 more
Caused by: org.htmlunit.corejs.javascript.EvaluatorException: syntax error (https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.js#272)
	at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:401)
	at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:247)
	at org.htmlunit.corejs.javascript.Parser.reportError(Parser.java:327)
	at org.htmlunit.corejs.javascript.Parser.reportError(Parser.java:319)
	at org.htmlunit.corejs.javascript.Parser.reportError(Parser.java:315)
	at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3521)
	at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2997)
	at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2900)
	at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2810)
	at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2793)
	at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2779)
	at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2762)
	at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2740)
	at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2716)
	at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2707)
	at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2698)
	at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2689)
	at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2680)
	at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2671)
	at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2652)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2620)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.argumentList(Parser.java:2968)
	at org.htmlunit.corejs.javascript.Parser.makeFunctionCall(Parser.java:3121)
	at org.htmlunit.corejs.javascript.Parser.memberExprTail(Parser.java:3091)
	at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:3032)
	at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2900)
	at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2810)
	at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2793)
	at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2779)
	at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2762)
	at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2740)
	at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2716)
	at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2707)
	at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2698)
	at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2689)
	at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2680)
	at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2671)
	at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2652)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2620)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2632)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2548)
	at org.htmlunit.corejs.javascript.Parser.returnOrYield(Parser.java:2176)
	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.arrowFunction(Parser.java:1112)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2605)
	at org.htmlunit.corejs.javascript.Parser.variables(Parser.java:2411)
	at org.htmlunit.corejs.javascript.Parser.letStatement(Parser.java:2125)
	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.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:3409)
	at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2997)
	at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2900)
	at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2810)
	at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2793)
	at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2779)
	at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2762)
	at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2740)
	at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2716)
	at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2707)
	at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2698)
	at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2689)
	at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2680)
	at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2671)
	at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2652)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2620)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2548)
	at org.htmlunit.corejs.javascript.Parser.parenExpr(Parser.java:3536)
	at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3425)
	at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2997)
	at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2900)
	at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2810)
	at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2793)
	at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2779)
	at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2762)
	at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2740)
	at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2716)
	at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2707)
	at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2698)
	at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2689)
	at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2680)
	at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2671)
	at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2652)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2620)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.argumentList(Parser.java:2968)
	at org.htmlunit.corejs.javascript.Parser.makeFunctionCall(Parser.java:3121)
	at org.htmlunit.corejs.javascript.Parser.memberExprTail(Parser.java:3091)
	at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:3032)
	at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2900)
	at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2810)
	at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2793)
	at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2779)
	at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2762)
	at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2740)
	at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2716)
	at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2707)
	at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2698)
	at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2689)
	at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2680)
	at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2671)
	at org.htmlunit.corejs.javascript.Parser.nullishCoalescingExpr(Parser.java:2652)
	at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2620)
	at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2574)
	at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2548)
	at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1422)
	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:2678)
	at org.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2613)
	at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1559)
	at org.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:195)
	at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1547)
	at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitCompileContextAction.run(JavaScriptEngine.java:885)
	... 38 more

ℹ️ Last known working version: 4.40

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsI-defectSomething is not working as intendedJ-awaiting answerQuestion asked of user; a reply moves it to triage againOS-linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions