[Webtest] OOM Error on some pages with JavaScript

Matt Raible webtest@lists.canoo.com
Wed, 11 Jan 2006 15:20:24 -0700


On 1/11/06, Marc Guillemot <mguillemot@yahoo.fr> wrote:
> Hi Matt,
>
> have you tried to give ant more memory to see if it reaches the new
> limit after a while too?
>
> Out of context I can't say anything to the js function you had to
> change. If you can provide an example I could perhaps fix it in htmlunit.

It basically seems to happen when you have a form, and JavaScript
below it that submits the form before the page finishes loading.  This
works in a browser - but htmlunit doesn't seem to like it.

Here's an example:

<form method=3D"post" name=3D"Form0"
action=3D"/appfuse-tapestry/passwordHint.html" id=3D"passwordHint">
<input type=3D"hidden" name=3D"service" value=3D"direct"/>
<input type=3D"hidden" name=3D"service" value=3D"0"/>
<input type=3D"hidden" name=3D"service" value=3D"passwordHint"/>
<input type=3D"hidden" name=3D"sp" value=3D"S0"/>
<input type=3D"hidden" name=3D"Form0" value=3D""/>

<input name=3D"username" type=3D"hidden"></input>
</form>
<script type=3D"text/javascript">
    var f =3D document.getElementById('passwordHint');
    f.submit();
</script>

>
> Do you know how many of the onclick code gets executed? Have you an idea
> at which place it hangs?

I discovered it wasn't happening on that page (with the onclick) after
further investigation.  Rather, it was happening on the next page
where I auto-submit.  In reality, it's bad design to have a page that
simply submits to the next page - but it's what I've had to do to work
around limitations I've found in JSF and Tapestry.  In these
frameworks, it's difficult to call a page-backing bean directly w/o
submitting a form to it.

I think the workaround is easy enough, but it would be nice if
htmlunit behaved like the browser and submitted the form w/o the page
fully loading.

Matt

>
> Marc.
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>