From: Jeff M. <jma...@ho...> - 2005-02-24 14:46:42
|
Hello, I'm using HtmlUnit and have run into a problem that is related to the interaction between the software and our usage of JavaScript. I've stepped through our application, HtmlUnit and Rhino source code using the debugger in WebSphere Studio Application Developer 5.1.0, and I'm getting an EvaluatorException at runtime like so: org.mozilla.javascript.EvaluatorException: The undefined value has no properties. It is caught in the execute(HtmlPage, String, String, HtmlElement) method of the JavaScriptEngine class, but I think it might actually be occurring in either the evaluateReader(Scriptable, Reader, String, int, Object) or evaluteString(Scriptable, String, String, int, Object) method of the org.mozilla.javascript.Context class. I realize that class is part of the Rhino distribution, but I'm posting this message b/c of information I found in this link: http://sourceforge.net/mailarchive/message.php?msg_id=7662863 indicated that the exception "...is a fairly generic symptom that means "some javascript object that you"re trying to use hasn"t been implemented yet". The trick is to discover what javascript host object you"re referencing so that we can implement it (or at least stub it out as a temporary fix)...". The script that is being executed is pasted below: function submittingToCms() { var i, numEls = document.cmsForm.elements.length; for(i=0; i<numEls; i++) { document.cmsForm.elements[i].disabled = false; } document.cmsForm.elements.sendButton.disabled = true; } It is executed after posting from an HTML form using a submit button like so: <html-el:form action="/cms/update" focus="${focusField}" onsubmit="return submittingToCms();" styleId="cmsForm"> ... </html-el:form> The script is embedded within the page that contains the form, and that page has a number of Struts (version 1.1) tags from the struts-html-el.tld and struts-html.tld libraries. I'm not sure if that is part of the problem or not. We don't have a public server to access to try to troubleshoot the problem, but I'm hoping someone might be able to help without that. I've included a simplified view that shows the general sequence of classes and methods that I stepped through until the exception was thrown. I can provide more information as necessary. Please take a look and share your ideas for how I can work through this problem. We stopped using jWebUnit b/c it couldn't handle our JavaScript, which I think is minimal and straightforward (compared to other apps on which I've worked!), and switched to HmtlUnit b/c of the greater support it offers. Thank you. Jeff Debugging Steps: 1. org.mozilla.javascript.Context - evaluateReader(Scriptable, Reader, String, int, Object) 2. org.mozilla.javascript.gen.c196 (could not be found) 3. org.mozilla.javascript.Context - evaluateReader(Scriptable, Reader, String, int, Object 4. org.mozilla.javascript.Context - evaluateString(Scriptable, String, String, int, Object) - evaluateReader(Scriptable, Reader, String, int, Object) 5. com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine - execute(HtmlPage, String, String, HtmlElement) 6. com.gargoylesoftware.htmlunit.html.HtmlPage - executeJavaScriptIfPossible(String, String, boolean, HtmlElement) 7. org.mozilla.javascript.Context - evaluateReader(Scriptable, Reader, String, int, Object) 8. org.mozilla.javascript.gen.c197 (could not be found) 9. com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine - execute(HtmlPage, String, String, HtmlElement) ---> Throwable: org.mozilla.javascript.EvaluatorException: The undefined value has no properties. |