HtmlUnit / htmlunit

HtmlUnit is a "GUI-Less browser for Java programs".
https://www.htmlunit.org
Apache License 2.0
872 stars 171 forks source link

'missing ) after formal parameters' with HTMX 1.9.10 #706

Open breun opened 9 months ago

breun commented 9 months ago

I have HtmlUnit 3.9.0 tests that work with HTMX 1.9.9, but when I upgrade to HTMX 1.9.10, I this error:

2024-01-08T09:41:35.431+01:00 ERROR 4784 --- [TAP] [           main] o.h.j.DefaultJavaScriptErrorListener     : Error during JavaScript execution

org.htmlunit.ScriptException: missing ) after formal parameters (http://localhost:35781/internal/assets/webjars/htmx.org/1.9.10/dist/htmx.min.js#1)
    at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:1014) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.corejs.javascript.Context.call(Context.java:581) ~[htmlunit-core-js-3.9.0.jar:3.9.0]
    at org.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:481) ~[htmlunit-core-js-3.9.0.jar:3.9.0]
    at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:347) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:844) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:810) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:113) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1152) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1024) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.ScriptElementSupport.executeScriptIfNeeded(ScriptElementSupport.java:194) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.ScriptElementSupport$1.execute(ScriptElementSupport.java:118) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.ScriptElementSupport.onAllChildrenAddedToPage(ScriptElementSupport.java:141) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:192) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:599) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:411) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:548) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1270) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1198) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:201) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:268) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2990) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1980) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:814) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:344) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:302) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.cyberneko.xerces.parsers.XMLParser.parse(XMLParser.java:72) ~[neko-htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:842) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:202) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:308) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:227) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:671) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:573) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:491) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:398) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:536) ~[htmlunit-3.9.0.jar:3.9.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:518) ~[htmlunit-3.9.0.jar:3.9.0]
        (...)
rbri commented 9 months ago

@breun, yes i'm already aware of this. This is because the new version uses default parameters at some places and this is not supported by Rhino. Will try to find a workaround maybe at the weekend.

rbri commented 9 months ago

@breun if you have access to the (as ist looks like from the stack trace) you can make a simple fix in htmx.js

Replace (line 144

function makeTagRegEx(tag, global = false) {
    return new RegExp(`<${tag}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${tag}>`,
        global ? 'gim' : 'im');
}

with

function makeTagRegEx(tag) {
    var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
    return new RegExp(`<${tag}(\\s[^>]*>|>)([\\s\\S]*?)<\\/${tag}>`,
        global ? 'gim' : 'im');
}

I guess you are able to find the matching code in the minified version you use.

There are some more issues with the current test suite, i guess i have to contact the htmx peoples to understand what is wrong here.

breun commented 9 months ago

I use the HTMX WebJar from Maven Central (org.webjars.npm:htmx.org), so it’s not trivial for me to patch the HTMX source, but thanks.

rbri commented 9 months ago

Ok will prepare another workaround for you

rbri commented 9 months ago

Hi @breun,

sorry but i have far too many things on my desk. Made a new 3.10.0-SNAPSHOT available.

Please try - you have to use the snapshot from today AND you have to add this

webClient.setScriptPreProcessor(new HtmxOneNineTenScriptPreprozessor());

to the setup code of your WebClient. Hope that helps....

breun commented 9 months ago

Thanks for the update, will try to try this next week.

breun commented 9 months ago

I can confirm that adding the preprocessor indeed helps!

But maybe the class should be called HtmxOneNineTenScriptPreProcessor to match the casing of the setScriptPreProcessor method and ScriptPreProcessor interface?

rbri commented 9 months ago

called HtmxOneNineTenScriptPreProcessor

shame on me - will be changed in the next version

breun commented 9 months ago

I see the casing is now fixed, but shouldn't the German Prozessor also be changed to Processor?

rbri commented 9 months ago

OMG time to switch of the light - thanks a lot

rbri commented 9 months ago

ok done - hopefully

fleboulch commented 8 months ago

I'm also having the same issue when upgrading from 3.9.0 to 3.11.0

The url I'm scrapping is https://krakatoa.org/agenda

I tried adding webClient.scriptPreProcessor = HtmxOneNineTenScriptPreProcessor() but it did not help me

Stack trace is:

org.htmlunit.ScriptException: missing ) after formal parameters (https://krakatoa.org/sites/default/files/krakatoa/advagg_js/js__x_tdbsAkV9Zc2xDC1c7o6jyebpNZIK_Mecv0vOeWxTk__hmw2tqO4-BCcgBgWXNAoATkbQ6_sBNYeHwdLr9Ep4SQ__uvI1SxR26vPNor0suQWhfUZdp9SqBCiRGzXv_jtl9fI.js#455)
    at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:1021) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Context.call(Context.java:581) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:481) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:347) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:833) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:799) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:119) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1154) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:1030) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.ScriptElementSupport.executeScriptIfNeeded(ScriptElementSupport.java:193) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.ScriptElementSupport$1.execute(ScriptElementSupport.java:117) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.ScriptElementSupport.onAllChildrenAddedToPage(ScriptElementSupport.java:140) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:192) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:594) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:303) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement(HtmlUnitNekoDOMBuilder.java:543) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.cyberneko.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1162) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1106) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.filters.DefaultFilter.endElement(DefaultFilter.java:149) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.filters.NamespaceBinder.endElement(NamespaceBinder.java:266) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3251) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan(HTMLScanner.java:2010) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLScanner.scanDocument(HTMLScanner.java:823) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:336) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.HTMLConfiguration.parse(HTMLConfiguration.java:294) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.cyberneko.xerces.parsers.XMLParser.parse(XMLParser.java:70) ~[neko-htmlunit-3.11.2.jar:3.11.2]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse(HtmlUnitNekoDOMBuilder.java:840) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse(HtmlUnitNekoHtmlParser.java:202) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:307) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:226) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:669) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.loadWebResponseInto(WebClient.java:571) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:489) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:396) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:534) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.WebClient.getPage(WebClient.java:516) ~[htmlunit-3.11.0.jar:3.11.0]
    at com.flb.bdxevents.infra.fetcher.internals.HtmlFetcher.handleInternal(HtmlFetcher.kt:24) ~[main/:na]
    at com.flb.bdxevents.infra.fetcher.internals.HtmlFetcher.handle(HtmlFetcher.kt:15) ~[main/:na]
    at com.flb.bdxevents.infra.fetcher.KrakatoaFetcher.fetch(KrakatoaFetcher.kt:39) ~[main/:na]
    at com.flb.bdxevents.infra.EventFetcher.fetch(EventFetcher.kt:55) ~[main/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:765) ~[spring-aop-6.1.3.jar:6.1.3]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:717) ~[spring-aop-6.1.3.jar:6.1.3]
    at com.flb.bdxevents.infra.EventFetcher$$SpringCGLIB$$0.fetch(<generated>) ~[main/:na]
    at com.flb.bdxevents.domain.application.SyncEvents.invoke(SyncEvents.kt:28) ~[main/:na]
    at com.flb.bdxevents.AtStartupApp.onApplicationEvent(BdxeventsApplication.kt:30) ~[main/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:365) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:237) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:168) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:981) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.1.3.jar:6.1.3]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:334) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.2.jar:3.2.2]
    at com.flb.bdxevents.BdxeventsApplicationKt.main(BdxeventsApplication.kt:33) ~[main/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281) ~[spring-core-6.1.3.jar:6.1.3]
    at com.flb.bdxevents.TestBdxeventsApplicationKt$main$$inlined$fromApplication$1.acceptWithException(SpringApplicationExtensions.kt:63) ~[test/:na]
    at com.flb.bdxevents.TestBdxeventsApplicationKt$main$$inlined$fromApplication$1.acceptWithException(SpringApplicationExtensions.kt:63) ~[test/:na]
    at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60) ~[spring-core-6.1.3.jar:6.1.3]
    at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:49) ~[spring-core-6.1.3.jar:6.1.3]
    at org.springframework.boot.SpringApplication$Augmented.lambda$run$1(SpringApplication.java:1513) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.lambda$withHook$7(SpringApplication.java:1436) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[spring-core-6.1.3.jar:6.1.3]
    at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[spring-core-6.1.3.jar:6.1.3]
    at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1454) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1435) ~[spring-boot-3.2.2.jar:3.2.2]
    at org.springframework.boot.SpringApplication$Augmented.run(SpringApplication.java:1513) ~[spring-boot-3.2.2.jar:3.2.2]
    at com.flb.bdxevents.TestBdxeventsApplicationKt.main(TestBdxeventsApplication.kt:14) ~[test/:na]
Caused by: org.htmlunit.corejs.javascript.EvaluatorException: missing ) after formal parameters (https://krakatoa.org/sites/default/files/krakatoa/advagg_js/js__x_tdbsAkV9Zc2xDC1c7o6jyebpNZIK_Mecv0vOeWxTk__hmw2tqO4-BCcgBgWXNAoATkbQ6_sBNYeHwdLr9Ep4SQ__uvI1SxR26vPNor0suQWhfUZdp9SqBCiRGzXv_jtl9fI.js#455)
    at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:431) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.addError(Parser.java:257) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.reportError(Parser.java:336) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.reportError(Parser.java:332) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:472) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mustMatchToken(Parser.java:463) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.parseFunctionParams(Parser.java:842) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.function(Parser.java:913) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.function(Parser.java:848) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3091) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2721) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2624) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2544) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2527) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2513) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2496) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2474) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2450) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2441) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2432) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2423) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2414) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2405) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2372) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2330) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.plainProperty(Parser.java:3661) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.objectLiteral(Parser.java:3558) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3099) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2721) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2624) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2544) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2527) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2513) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2496) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2474) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2450) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2441) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2432) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2423) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2414) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2405) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2372) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2330) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2353) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2309) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.nameOrLabel(Parser.java:2067) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1246) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1110) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.parseFunctionBody(Parser.java:735) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.function(Parser.java:914) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.function(Parser.java:848) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3091) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2721) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2624) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2544) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2527) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2513) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2496) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2474) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2450) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2441) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2432) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2423) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2414) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2405) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2372) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2330) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2309) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.parenExpr(Parser.java:3185) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.primaryExpr(Parser.java:3107) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.memberExpr(Parser.java:2721) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.unaryExpr(Parser.java:2624) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expExpr(Parser.java:2544) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.mulExpr(Parser.java:2527) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.addExpr(Parser.java:2513) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.shiftExpr(Parser.java:2496) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.relExpr(Parser.java:2474) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.eqExpr(Parser.java:2450) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitAndExpr(Parser.java:2441) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitXorExpr(Parser.java:2432) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.bitOrExpr(Parser.java:2423) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.andExpr(Parser.java:2414) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.orExpr(Parser.java:2405) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.condExpr(Parser.java:2372) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.assignExpr(Parser.java:2330) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.expr(Parser.java:2309) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.statementHelper(Parser.java:1255) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.statement(Parser.java:1110) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:631) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Parser.parse(Parser.java:561) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Context.parse(Context.java:2540) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2471) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1439) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:218) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.corejs.javascript.Context.compileString(Context.java:1427) ~[htmlunit-core-js-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.JavaScriptEngine$1.doRun(JavaScriptEngine.java:824) ~[htmlunit-3.11.0.jar:3.11.0]
    at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:1004) ~[htmlunit-3.11.0.jar:3.11.0]
    ... 86 common frames omitted
rbri commented 8 months ago

Ok, will check this and if the page really works with 3.9.0 then i can fix that. But i'm on a workshop for the next days. Please be a bit patient...

fleboulch commented 8 months ago

Yes I will be patient! Many thanks for all the work :muscle:

breun commented 7 months ago

HTMX 1.9.11 was just released, and also seems to require using HtmxOneNineTenScriptPreProcessor.

rbri commented 7 months ago

@breun yes the preprocessor is still needed, and also another fix for HtmlUnit itself. You can use the lastest snapshot build...

fleboulch commented 7 months ago

This issue (following my comment above) has been resolved with the latest snapshot :tada:
Thanks a lot

breun commented 7 months ago

@rbri I didn't experience any issues when running my tests with HTMX 1.9.11 and HtmlUnit 3.11.0 with the HtmxOneNineTenScriptPreProcessor enabled, so I'm good, even without the latest snapshot build.

rbri commented 7 months ago

@breun to finally solve this issue i have to enhance the js support.

At the moment i like to focus on https://github.com/HtmlUnit/htmlunit/issues/755 - this will solve the problem at all. But there is no release date set - hope to know more in one week or so...