Menu

#1416 Problems with (re)execution of script element

Latest SVN
closed
RBRi
None
7
2012-10-21
2012-07-10
Frank Danek
No

HtmlUnit does not behave properly (like the browsers) when working with <script> elements.
We found the problems when working with Richfaces ModalPanel and were able to track it down a bit further.

Here are the problems we found:
1. The main problem: when moving a script element to another parent, the source is executed twice for IE in HtmlUnit. In our case two instances of ModalPanel where created what lead to some trouble.
I think the cause is a fix introduced for issue 993940. Now (for IE) script.text and body.appendChild both (re)execute the source but in real IE only script.text (re)executes it.
2. When replacing the source of a script element from within the same script element, this should lead to an execution of the new source in the IE. The FF does not execute it (this works fine in the current implementation).
3. When replacing the source of a script element from within another script element, this should lead to an execution of the new source in both IE and FF. Currently this does not work in either browser.
4. The methods appendChild and insertBefore do not work in real IE but do work in IE in HtmlUnit. The first IE supporting these methods is IE9.

See attached a patch file adding some tests to HTMLScriptElementTest. I have checked the expectations for IE6, IE8 and FF13 (I know, it's to up-to-date, sorry...). Not all tests are failing currently but perhaps you can use them for regression tests.

Discussion

  • Frank Danek

    Frank Danek - 2012-07-10

    Some tests to HTMLScriptElementTest

     
  • RBRi

    RBRi - 2012-07-10

    Thanks for the testcases; will try to fix...

     
  • Frank Danek

    Frank Danek - 2012-08-09

    Some more tests to HTMLScriptElementTest

     
  • RBRi

    RBRi - 2012-08-10

    Now fixed in SVN. Thanks for reporting.

     
  • RBRi

    RBRi - 2012-08-10

    Thanks for the test cases.

     

Log in to post a comment.