Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

JavaScript validation error when calling a JakartaEE10 MyFaces page

未关闭
#883 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java, javascript
领域
backend, testing

调研方向

Start by inspecting the attached test.js and the JavaScript served as faces.js.jsf in the TomEE reproduction; compare it with the version served under Mojarra on WildFly. Run the provided Maven sample with Java 17 and TomEE 10.0M2 to reproduce the parser error. Done means identifying and addressing the incompatibility so the Jakarta Faces page with an Ajax call loads without the exception.

由索引模型根据 Issue 内容生成。

描述

Using HtmlUnitDriver 4.23.0, I observe an ugly EvaluatorException when calling a minimal Jakarta Faces page with just an Ajax call:

org.htmlunit.corejs.javascript.EvaluatorException: syntax error (http://localhost:8080/test/jakarta.faces.resource/faces.js.jsf;jsessionid=6C2C888968266540AA88DD3A0FCD95C5?ln=jakarta.faces&stage=Development#194)
    at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error (HtmlUnitContextFactory.java:399)
    at org.htmlunit.corejs.javascript.Parser.addError (Parser.java:241)
    … (a lot of parser methods)...
    at org.htmlunit.corejs.javascript.Context.parse (Context.java:2550)
    at org.htmlunit.corejs.javascript.Context.compileImpl (Context.java:2481)
    at org.htmlunit.corejs.javascript.Context.compileString (Context.java:1443)
    at org.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString (HtmlUnitContextFactory.java:193)
    at org.htmlunit.corejs.javascript.Context.compileString (Context.java:1431)
    at org.htmlunit.javascript.JavaScriptEngine$1.doRun (JavaScriptEngine.java:722)
    at org.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run (JavaScriptEngine.java:930)
    at org.htmlunit.corejs.javascript.Context.call (Context.java:586)
    at org.htmlunit.corejs.javascript.ContextFactory.call (ContextFactory.java:481)
    at org.htmlunit.javascript.HtmlUnitContextFactory.callSecured (HtmlUnitContextFactory.java:315)
    at org.htmlunit.javascript.JavaScriptEngine.compile (JavaScriptEngine.java:731)
    at org.htmlunit.javascript.JavaScriptEngine.compile (JavaScriptEngine.java:112)
    at org.htmlunit.html.HtmlPage.loadJavaScriptFromUrl (HtmlPage.java:1124)
    at org.htmlunit.html.HtmlPage.loadExternalJavaScriptFile (HtmlPage.java:1015)
    at org.htmlunit.html.ScriptElementSupport.executeScriptIfNeeded (ScriptElementSupport.java:191)
    at org.htmlunit.html.ScriptElementSupport$1.execute (ScriptElementSupport.java:112)
    at org.htmlunit.html.ScriptElementSupport.onAllChildrenAddedToPage (ScriptElementSupport.java:135)
    at org.htmlunit.html.HtmlScript.onAllChildrenAddedToPage (HtmlScript.java:192)
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement (HtmlUnitNekoDOMBuilder.java:508)
    at org.htmlunit.cyberneko.xerces.parsers.AbstractSAXParser.endElement (AbstractSAXParser.java:291)
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.endElement (HtmlUnitNekoDOMBuilder.java:454)
    at org.htmlunit.cyberneko.HTMLTagBalancer.callEndElement (HTMLTagBalancer.java:1220)
    at org.htmlunit.cyberneko.HTMLTagBalancer.endElement (HTMLTagBalancer.java:1164)
    at org.htmlunit.cyberneko.filters.DefaultFilter.endElement (DefaultFilter.java:168)
    at org.htmlunit.cyberneko.filters.NamespaceBinder.endElement (NamespaceBinder.java:266)
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scanEndElement (HTMLScanner.java:3208)
    at org.htmlunit.cyberneko.HTMLScanner$ContentScanner.scan (HTMLScanner.java:2098)
    at org.htmlunit.cyberneko.HTMLScanner.scanDocument (HTMLScanner.java:909)
    at org.htmlunit.cyberneko.HTMLConfiguration.parse (HTMLConfiguration.java:336)
    at org.htmlunit.cyberneko.HTMLConfiguration.parse (HTMLConfiguration.java:294)
    at org.htmlunit.cyberneko.xerces.parsers.AbstractXMLDocumentParser.parse (AbstractXMLDocumentParser.java:80)
    at org.htmlunit.html.parser.neko.HtmlUnitNekoDOMBuilder.parse (HtmlUnitNekoDOMBuilder.java:753)
    at org.htmlunit.html.parser.neko.HtmlUnitNekoHtmlParser.parse (HtmlUnitNekoHtmlParser.java:195)
    at org.htmlunit.DefaultPageCreator.createHtmlPage (DefaultPageCreator.java:300)
    at org.htmlunit.DefaultPageCreator.createPage (DefaultPageCreator.java:219)
    at org.htmlunit.WebClient.loadWebResponseInto (WebClient.java:681)
    at org.htmlunit.WebClient.loadWebResponseInto (WebClient.java:575)
    at org.htmlunit.WebClient.getPage (WebClient.java:493)
    at org.htmlunit.WebClient.getPage (WebClient.java:402)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get (HtmlUnitDriver.java:638)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$get$7 (HtmlUnitDriver.java:619)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.lambda$runAsync$0 (HtmlUnitDriver.java:351)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
    at java.lang.Thread.run (Thread.java:842)

Posting the full stacktrace probably does not bring any additional information.

I have a sample to reprocuce, but i requires a few steps:

  1. download TomEE 10.0M2 from https://tomee.apache.org/download.html (you need "TomEE Webprofile zip") and unzip
  2. you need Java 17
  3. rename attached "test.war.zip" to "test.war" and copy it to to TOMEE_HOME\webapps:
    test.war.zip
  4. start TomEE: TOMEE_HOME\bin\startup.bat (or startup.sh)
  5. you can test the app by browsing to http://localhost:8080/test/index.jsf
  6. now launch attached sample "htmlunittest.zip" (a small Eclipse maven project): mvn clean compile exec:java - you should see a large exception.
    htmlunittest.zip

From the log output, I picked this JavaScript file:
test.js.zip

I ran my sample also on WildFly, which includes the Mojarra Jakarta Faces implementation, and here the error did not happen. So maybe it is really a syntax error?

主要语言
JavaScript
星标
952
派生
183
平均合并
2 天 1 小时
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

HtmlUnit/htmlunit 的其他 Issue

查看 HtmlUnit/htmlunit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。