Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlUnit fails to parse script faces.js from MyFaces 4.0.2 #732

Open
tandraschko opened this issue Feb 21, 2024 · 5 comments
Open

HtmlUnit fails to parse script faces.js from MyFaces 4.0.2 #732

tandraschko opened this issue Feb 21, 2024 · 5 comments
Assignees
Labels
js-engine Issues related to the js engine

Comments

@tandraschko
Copy link

tandraschko commented Feb 21, 2024

I get following exception in my integration test environment:

org.htmlunit.corejs.javascript.EvaluatorException: missing formal parameter (http://..../jakarta.faces.resource/faces.js.xhtml?ln=jakarta.faces#2)
        at org.htmlunit.javascript.HtmlUnitContextFactory$HtmlUnitErrorReporter.error(HtmlUnitContextFactory.java:431)

Line Number: 2
Column Number: 864

The JS can be found here:
https://repo1.maven.org/maven2/org/apache/myfaces/core/myfaces-api/4.0.2/myfaces-api-4.0.2.jar

extract it and you can find it here:
\META-INF\resources\jakarta.faces\faces.js

the exception is there since v2.13 and still fails with 3.10.0

rbri added a commit that referenced this issue Feb 25, 2024
@rbri
Copy link
Member

rbri commented Feb 25, 2024

@tandraschko,
thanks for the bug report. HtmlUnit (and Wetator) has a log history testing JSF/Myfaces/Richfaces app. Therefore i spend some time looking at this.

The problem here is (again) som js feature support in rhino. The faces.js implementation uses rest parameters (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) e.g.

e.chain = function(e, t, ...n)

that are currently not supported by Rhino.

What to do?

Option 1: wait until Rhino moves forward here - in the past i have provided many updates to rhino but its getting harder because of the backward compatibility that rhino likes to manage

Option 2: I have a plan to replace the js engine by something more modern, but this is a huge effort and might not be available during the next months (you can of course ask your boss to sponsor my work (https://github.com/sponsors/rbri) to make this a bit faster). Please be a bit patient regarding this, i plan to announce the plan and more details soon

Option 3: Patch the faces.js file 'on the fly' and replace the problematic statements with some rhino compatible stuff. I did this already for Htmx and it is possible for this also. At least if you like to test bigger MyFaces projects (or many) this might be a good solution.

Please give me a sign, if you like to go with option 3 for some time and i will try to help you with this.

@rbri rbri self-assigned this Feb 25, 2024
@rbri rbri changed the title HtmlUnit fails to parse script HtmlUnit fails to parse script faces.js from MyFaces 4.0.2 Feb 25, 2024
@rbri
Copy link
Member

rbri commented Feb 25, 2024

Looks like i have rhino support for function rest parameters ready... will release something during the next days

@tandraschko
Copy link
Author

that sounds great! Thank you! :)

NOTE: i'm just working on another OS project, Apache DeltaSpike, and i'm trying to fix our integration tests for new JakartaEE 10

@tandraschko
Copy link
Author

is there any expected release date yet? :)

@rbri
Copy link
Member

rbri commented Mar 27, 2024

@tandraschko sorry but the fix i made for rhino (mozilla/rhino#1451) seems to be only the first required one. The js file not only uses rest paramters but also spread syntax support.

At the moment i like to focus on #755 - this will solve the problem at all.
But there is no release date set - hope to know more in one week or so...

@rbri rbri added the js-engine Issues related to the js engine label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js-engine Issues related to the js engine
Projects
None yet
Development

No branches or pull requests

2 participants