Open sengsational opened 2 years ago
I have recreated the error in IntelliJ with htmlunit built from source, but it appears that the problem is in either net.sourceforge.htmlunit.cyberneko
or net.sourceforge.htmlunit.corejs.javascript
(the build has those as jars).
The exception is thrown by this line: https://github.com/HtmlUnit/htmlunit/blob/a7d65d735168f923c636476245b149f7d1eeb444/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java#L816 That's code in net.sourceforge.htmlunit.corejs.javascript.Context
I need to figure out how to do the build so cyberneko and corejs is from source too.
Looking in htmlunit-rhino-fork
, I found the error that's thrown under class decorators in htmlunit-rhino-fork/docs/compat/engines.html
. If I'm reading this right, it's saying that mozilla/rhino does not support javascript class decorators.
The following is given as an example:
class A {
@nonconf
get B() {}
}
function nonconf(target, name, descriptor) {
descriptor.configurable = false;
return descriptor;
}
return Object.getOwnPropertyDescriptor(A.prototype, "B").configurable === false;
I'm not sure what about that makes it a class decorator. Is there another way to write that code so it isn't considered a class decorator? I'm thinking about a work-around where I would add a pre-processor like webClient.setScriptPreProcessor(preProcessor);
and re-write the unsupported javascript construct.
Will try to have a look....
Was just coming to write a ticket for this. If it helps, here's a one-liner to reproduce:
import com.gargoylesoftware.htmlunit.WebClient
import com.gargoylesoftware.htmlunit.html.HtmlPage
fun main() { WebClient().getPage<HtmlPage>("https://www.hcso.org/") }
Have started some work to optionally integrate babel as preprocessor for the scrips to overcome some Rhino limitations. But this will requires some time.
Sounds like a great idea for how to manage the Rhino limitations.
hey, any progress?
sorry, no, far too many other activities
Revisiting this after a long while. As of 3.5.0, the problem still persists. Wow, reading my earlier investigations from April 2022 on this topic, I'm pretty sure I'm dumber now than I used to be, LOL!
I have also encountered this problem. Do you have any good solutions
see #755
This exception is being thrown and I think it might be why I'm unable to progress through testing.
The complete stack trace is attached. EvaluatorException_IdentifierIsAReservedWord.txt
Version: 2.60.0, running on MS Windows