[ 
https://issues.apache.org/jira/browse/MYFACES-2748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877368#action_12877368
 ] 

Werner Punz commented on MYFACES-2748:
--------------------------------------

A last comment on this issue, this bug only affected IE and only did so for the 
IE simulation of html unit.
The root cause of this bug was following IE bug 
http://blogs.perl.org/users/clinton_gormley/2010/02/forcing-ie-to-accept-script-tags-in-innerhtml.html

This bug only can occur in certain corner cases and afair also 2.0.0 was 
affected which did not use innerHTML but used fragments instead (I moved over 
to innerHTML because it is well supported in IE and faster and provided a 
lifecycle which was closer to the contextual ranges we have for more W3C 
compliant browsers. 

The reason why we did not stumble over it was simply that we had no testing 
cases which triggered it, my cross form submit testing revealed it, because it 
only happens in certain dom combinations which are relatively rare and probably 
should not occur at existing usecases.

However the problem with the proposed approach from clinton_gormley is that the 
wrapping in forms does not work out for certain corner cases which have forms 
embedded so I moved over to a table based approach, which then broke in 
htmlUnit (I have to investigate if the deep scan can be eliminited by adding 
more elements, but that is not the scope of 2.0.1 anymore)

The good thing is since the entire operation of replacement is encapsulated 
into a single outerHTML replacement method, we always can relatively swiftly 
switch to a different approach.

(one of the advantages of the code cleanup I did of between 2.0.0 - 2.0.1 the 
code is way more maintainable and structured)


> NPE in htmlunit when testing ajax rendering
> -------------------------------------------
>
>                 Key: MYFACES-2748
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2748
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.1-SNAPSHOT
>            Reporter: Michael Concini
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.1
>
>
> When attempting to run some simple ajax  tests using htmlunit, we're seeing 
> some NPEs when running in the default (IE) client mode.  As before with 
> MYFACES-2745 this looks like its a bug in htmlunit, however these test cases 
> had been passing on the MyFaces 2.0.0 release so something that is going on 
> with the new javascript must be triggering the bug.  I've validated in IE8, 
> Firefox 3.6 and Chrome that this is being rendered properly in a live browser 
> session as well as that it works if you initialize the htmlunit with new 
> WebClient(BrowserVersion.FIREFOX_3).
> Here's a simple example of a failing case.  Its just executes an increment 
> action on a counter var and uses f:ajax to re-render an outputText field. 
>     <h:form id="form1" prependId="false">
>         <h:outputText id="out1" value="#{incrementdecrement.value}"/>
>         <br/>
>         <h:commandButton id="button1" value="Count" 
> action="#{incrementdecrement.increment}" >
>             <f:ajax render="out1" disabled="false"  />
>         </h:commandButton>
>         <br/>
>     </h:form>
> After doing some debugging, htmlunit doesn't seem to be handling the partial 
> page update.  Instead of updating the span value for "out1", it is actually 
> removing it from the idMap for the page.  So if you try to validate the value 
> of "out1" has been incremented, you'll get an NPE since the element is no 
> longer on the idMap.
>         WebClient webClient = new WebClient();       
>         HtmlPage page = (HtmlPage) webClient.getPage 
> ("http://localhost:8080/JSF20AJAXTag/DisabledFalse.jsf";);
>         String buttonId = "button1";
>         doClick(page,buttonId);
>        
>         Assert.assertEquals( "1", page.getElementById 
> ("out1").getTextContent());
> The NPE is coming from trying to execute getTextContent() when 
> page.getElementById("out1") is returning null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to