Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#438 RHINO USAGE WARNING: Missed Context.javaToJS() conversion

closed-invalid
Wolfgang Fahl
None
1
2014-08-26
2009-11-15
Joerg Troester
No

The sample code is:
WebConversation wc = new WebConversation();
WebResponse resp = wc.getResponse("http://web.de");

The full stacktrace is:
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object [Ljava.lang.Object;@15e293a of class [Ljava.lang.Object; where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
org.mozilla.javascript.EcmaError: TypeError: Cannot call method "replace" of undefined
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
at org.mozilla.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3698)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2221)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at com.meterware.httpunit.javascript.ScriptingEngineImpl.runScript(ScriptingEngineImpl.java:92)
at com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:88)
at com.meterware.httpunit.parsing.NekoDOMParser.runScript(NekoDOMParser.java:151)
at com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1132)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1034)
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:3058)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1994)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:907)
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 org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:48)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:271)
at com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1301)
at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1285)
at com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:1024)
at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179)
at com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:315)
at com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:526)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:201)
at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:125)
at com.meterware.httpunit.WebClient.getResponse(WebClient.java:96)

Discussion

  • Wolfgang Fahl
    Wolfgang Fahl
    2012-09-12

    Dear httpunit user!

    Thank you for your bug report. We appreciate the time and effort you are putting into this.

    Please supply a testcase with the expected result for the bug report that you are asking a solution for and we'll look into implementing it. For a start you might want to get the trunk version from the subversion repository (see https://sourceforge.net/svn/?group_id=6550\)
    and have a look at the source code of some of the more than 700 JUnit based testcase in there.

    If you do not use or have subversion tool you can still directly browse our test cases via:
    http://httpunit.svn.sourceforge.net/viewvc/httpunit/trunk/httpunit/test/com/meterware/httpunit/
    Looking into one or more of the Junit Java source files
    should give you a clue on what a proper testcase for httpunit looks like, often you will probably only have to "clone" an existing testcase and modify it slightly to your needs.

    When you are ready you might want to attach the testcase (and if you already have started implementing a solution for it it also the actual code) to the patch section of the sourceforge.net tracker for patches of the httpunit project at
    https://sourceforge.net/tracker/?atid=306550&group_id=6550&func=browse.

    The main communication about further details of the development is via the httpunit developer mailinglist. You are most welcome to sign up via
    https://lists.sourceforge.net/lists/listinfo/httpunit-develop

    Yours
    The httpunit developer team

    (Russell, Wolfgang, Mark, Patrick and Tim as of 2008-04)

     
  • Wolfgang Fahl
    Wolfgang Fahl
    2012-09-12

    • priority: 5 --> 1
    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> closed-invalid
     
  • Wolfgang Fahl
    Wolfgang Fahl
    2012-09-12

    Thank you for supplying this bug report.
    JUnit does not fully support JavaScript as of version 1.7.
    Quite a few standard functions are simply not implemented and will lead to behaviour as described in your bug report.

    If you seek to get a specific function working please supply a Test case as per the httpunit FAQ. An external webpage can not be referenced by the webtest since all resources must be setup in the unit test itself. Also external webpages might change (e.g. in this case it has taken us 22 months to work on your bug report and in the meantime the webpage referenced might look different.

    Keep up the good work!