Htmlunit wraps "stand-alone" JavaScript (like you'd see in an onclick
attribute or a "javascript:" url) in a wrapper function before passing
the JavaScript to the Rhino engine for execution. (Rhino is the
Mozilla project that implements a JavaScript engine in Java. It's
integrated with Htmlunit to provide JavaScript functionality.)
This is perfectly normal behavior. Note that the number after the
"GargoyleWrapper" function name may vary upon each invocation. This
happens in the HtmlPage class in the executeJavaScriptIfPossible()
method.
Dave
On Oct 26, 2004, at 12:43 AM, Vinay Murthy wrote:
> Hi,
> Do onClick attributes get wrapped by GargoyleWrapper0() ? I have a
> button whose onclick attribute corresponds to calling a javascript
> function. As I click the button, the ScriptPreProcessor traps a js
> corresponding to "function GargoyleWrapper0() { Submitform("XYZ")} "
> Is this normal ? Could you please help me figure out what might be
> happening here ? I would normally expect the ScriptPreProcessor to
> trap all js snippets appearing in a page. And if it has trapped the
> one mentioned above, was the wrapper added into the response somewhere
> by HtnlUnit ?
>
> Best Regards
> Vinay
|