First step for a better Rhino usage in HtmlUnit

HtmlUnit relies on Mozilla’s Rhino for the JavaScript execution. Rhino is “just” a JavaScript engine which means that HtmlUnit has to “tell” him of all objects used inthe context of a web page like Window, Document, Navigator, …

Until now HtmlUnit misused Rhino by configuring some host objects when it was not needed and catching property and method access rather than letting Rhino work with the previously configured information. This made quite difficult to understand how the js code was interpreted and caused some bugs, therefore we wanted to fix this since a long long time.

I’ve committed last Friday the main changes for a better Rhino usage. Scriptable#put still needs to be improved and some clean-up is now needed but this was the decisive step and our future JavaScript improvements should now be easier to implement.



  1. Khalid said,

    June 5, 2007 at 9:51 am


    I am using htmlunit however there is a showmodaldialog function involed. And it is not being called because its not under ECMA standards. If I need to test it then what should I do. I searched and found a showmodaldialog function for mozilla. Where should I add it so that it works fine?

    I needed an advice as to what should I do.

  2. Marc Guillemot said,

    June 7, 2007 at 7:07 am

    ECMA standard just describes JavaScript “core” which means for instance that all usual objects/functions used in a browser like window, document, alert, … are not contained in the standard.
    In the case of HtmlUnit, it’s HtmlUnit’s role to configure Rhino to “tell” it what these objects are.
    Concerning showmodaldialog, please open an issue by HtmlUnit.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: