Hi Michael
I have committed the fix here:
https://issues.apache.org/jira/browse/MYFACES-2748
Now it should work. Could you try again your tests to see if
everything is all right?.
regards,
Leonardo Uribe
2010/6/9 Michael Concini <[email protected] <mailto:[email protected]>>
ok, so the script validation problem is fixed now.
However, when attempting to run the actual tests we're still
seeing some problems when running in the default (IE) client mode.
As before, 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 our 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 simply executing an
increment action on a counter var and using 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());
I'll go ahead and get a new JIRA issue opened for this one since
this looks like its a different issue.
Regards,
Mike
On 6/9/2010 9:35 AM, Michael Concini wrote:
I tested this morning using my standalone test case on Tomcat
that I've been using to debug this problem. So far so good.
This is with a local snapshot build sync'd this morning that
includes the fixes for 2745 and 2747.
I've now begun the process of integrating the changes into my
Websphere sandbox and kicking off the full set of tests. I
should have results by this afternoon.
On 6/9/2010 5:37 AM, Werner Punz wrote:
Hello Michael, can you do a quick check if your tests now
pass with the current codebase.
According to your descriptions they now should
We have another bugfix coming which bypasses yet another
htmlunit issue within the dom routines, where htmlunit
disables an IE6 and 7 fixup by
masking itself as ie but yet doing things differently.
I am not sure however if this one will make it into 2.0.1,
it probably will.
Werner
Am 09.06.10 02:40, schrieb Michael Concini:
Werner and Leo,
Thanks to both of you for looking into this issue.
Our tests are for the most part loading JSF pages
which just happen to
have some f:ajax tags in them and thus loaded jsf.js.
As Leo mentioned
though, the problem is that it affects any page that
loads jsf.js,
whether through an ajax tag or not and whether you use
it or not. The
particular tests that we're running in this case
however are not related
to the TCK, although it sounds like the TCK would be
affected as well
based on your recent comments.
Also, to answer your other question, these were all
tests that passed
previously on the 2.0.0 version and on earlier
snapshot builds of 2.0.1.
-Mike
On 6/8/2010 6:30 PM, Leonardo Uribe wrote:
Hi Werner
2010/6/8 Werner Punz <[email protected]
<mailto:[email protected]>
<mailto:[email protected]
<mailto:[email protected]>>>
Ok Leo just gave me the clarification, the
htmlunit stuff was
induced by the TCK but the TCK does not test very
deeply into the
entire lifecycle so after the fix to 2745, a 2.0.1
should be fine now.
Yes, we are ok after the fix of MYFACES-2745. The
reason is that issue
affects javascript loading, so any tests that
loads a page with jsf.js
javascript even if it is not used with htmlunit
could fail.
I would be happy to work on htmlunit integration
issues after
2.0.1 to improve the testability of our codebase a
little bit further.
(Currently I am running manual tests and partially
Selenium here)
I thought the GSOC work about the automated test
webapp was about do
myfaces 2.0.x tests of parts that we can't do it
with junit, but it
seems that project has taken another direction
towards a testing
framework, which is good.
regards,
Leonardo Uribe
Werner
Am 08.06.10 23:55, schrieb Werner Punz:
Since Michael posted a bugreport regarding
HTMLUnit support.
We nailed that down it was a combination of dirty
stuff
htmlunit did and
a bug introduced by me by the refactoring on the
codebase.
(the dirty trick from htmlunit was passing a
"null" string
back instead
of giving null back or undefined while masking
itself as IE )
I just would like to know since I never really
tested the scripts
against HTMLUnit not before nor after the the
refactoring.
How far was it running for 2.0.0?
Because as I see it getting a full htmlunit
support for 2.0.1
is not a
requirement in my eyes which should hold up the
2.0.1 release,
which is
important due to the pending security issue, unless
2.0.0 was entirely running with htmlunit.
The way I see it from what I am getting in, html
unit does
some things
quite differently while masking itself as IE so we
have to add
some
fallback code in our codebase just to deal with
html unit as
masked IE
in certain parts - as if dealing with various
versions of IE
was not bad
enough we get a fourth IE version in, which is
html unit
(Rhino + added
stuff passing a user agent string as ie down the
system). The
way I see
it full html unit support should be a goal for
2.0.2 not 2.0.1.
As I said not that I am against it, getting
htmlunit support
in makes
testing definitely easier in the long run, I just
try to
evaluate how
far the html unit tests from Michael etc... were
going for
2.0.0 to get
a clearer picture here on what is needed for 2.0.1.
Was ist just loading the page and doing some
html/jsf related
stuff or
was it triggering the entire lifecycle on Ajax and
running
through a
series of ajaxed tests?
Werner
Am 08.06.10 23:01, schrieb Leonardo Uribe (JIRA):
[
https://issues.apache.org/jira/browse/MYFACES-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe resolved MYFACES-2745.
-------------------------------------
Fix Version/s: 2.0.1
(was: 2.0.1-SNAPSHOT)
Resolution: Fixed
Cannot set property "_mfProto" of null to "null" error
with new
javascript
--------------------------------------------------------------------------
Key: MYFACES-2745
URL:
https://issues.apache.org/jira/browse/MYFACES-2745
Project: MyFaces Core
Issue Type: Bug
Components: JSR-314
Affects Versions: 2.0.1
Reporter: Michael Concini
Assignee: Leonardo Uribe
Fix For: 2.0.1
The javascript changes from 5/25 have caused a
regression when using
htmlunit against even the simplest JSF page as long as
it loads the
jsf.js script.
The exception occurs simply executing getPage() on the
webClient.
WebClient webClient = new WebClient();
HtmlPage page =
webClient.getPage("http://localhost:8080/JSF20AJAXTag/DisabledFalse.jsf");
It can be recreated by a page with nothing but this
form in the body:
<h:form id="form1" prependId="false">
<h:outputText id="out1" value="This is broken"/>
<h:outputScript name="jsf.js" library="javax.faces"
target="head" />
</h:form>
Attached is the exception trace from a run this
morning which
includes Werner's changes from MYFACES-2742 this
morning so we are up
to date in our sandbox.
======= EXCEPTION START ========
EcmaError: lineNumber=[51] column=[0] lineSource=[<no
source>]
name=[TypeError]
sourceName=[http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces]
message=[TypeError: Cannot set property "_mfProto" of
null to "null"
(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces#51)]
com.gargoylesoftware.htmlunit.ScriptException:
TypeError: Cannot set
property "_mfProto" of null to "null"
(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces#51)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
at
net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:425)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:980)
at
com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:353)
at
com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:215)
at
com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:235)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:718)
at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:676)
at
org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136)
at
org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038)
at
org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at
org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
at
org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999)
at
org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991)
at
org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:896)
at
com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:350)
at
com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:304)
at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:134)
at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:420)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:303)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:345)
at com.ibm.mike.TestJS.homePage(TestJS.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at
junit.framework.TestResult$1.protect(TestResult.java:106)
at
junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by:
net.sourceforge.htmlunit.corejs.javascript.EcmaError:
TypeError: Cannot set property "_mfProto" of null to
"null"
(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces#51)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3785)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:3807)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setObjectElem(ScriptRuntime.java:1578)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1450)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:416)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
... 46 more
Enclosed exception:
net.sourceforge.htmlunit.corejs.javascript.EcmaError:
TypeError:
Cannot set property "_mfProto" of null to "null"
(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces#51)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:3785)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:3807)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setObjectElem(ScriptRuntime.java:1578)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1450)
at
script(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces:51)
at
script(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces:48)
at
script(http://localhost:8080/JSF20AJAXTag/javax.faces.resource/jsf.js.jsf?ln=javax.faces:65)
at
net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
at
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
at
net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
at
net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$3.doRun(JavaScriptEngine.java:416)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
at
net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
at
net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:425)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:980)
at
com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:353)
at
com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:215)
at
com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:235)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:718)
at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:676)
at
org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136)
at
org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038)
at
org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at
org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
at
org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999)
at
org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991)
at
org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
at
com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:896)
at
com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:350)
at
com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:304)
at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:134)
at
com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:420)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:303)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:360)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:345)
at com.ibm.mike.TestJS.homePage(TestJS.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at
junit.framework.TestResult$1.protect(TestResult.java:106)
at
junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
======= EXCEPTION END ========