This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 237876 - Stepping into JS via invokeMethod does not stop in JS
Summary: Stepping into JS via invokeMethod does not stop in JS
Status: RESOLVED INCOMPLETE
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-01 06:41 UTC by Jaroslav Tulach
Modified: 2014-07-16 08:29 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2013-11-01 06:41:10 UTC
I know there is support for stepping into JDK8's Nashorn through "eval". However my project is using other ways to get into the JavaScript and these are not supported. I tried work around the problem by stepping in via initial eval, but as my JavaScript file is large, it took ages. 

To reproduce:
$ hg clone http://source.apidesign.org/hg/bck2brwsr
$ cd bck2brwsr
$ hg up -C 60ca4f72a70c
$ mvn clean install -DskipTests

and then open rt/vm project in NetBeans running on top of JDK8.

Open a test. For example StaticMethodTest. While debugging it stop in TestVM:61 there is:

  ret = code.invokeMethod(bck2brwsr, "loadClass", clazz.getName());

invokeMethod calls into the Nashorn VM and executes some JavaScript. Try to step in. The code does not stop in JavaScript, but only on next line in TestVM source code.
Comment 1 Jaroslav Tulach 2013-11-01 14:24:35 UTC
I forgot to say that one needs b113 of JDK8, where https://bugs.openjdk.java.net/browse/JDK-8025213 is fixed, otherwise the Nashorn won't be able to parse the generated JavaScript at all.
Comment 2 Martin Entlicher 2014-01-08 17:50:05 UTC
It can also be reproduced with a code like:

        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = manager.getEngineByName("JavaScript");
        Invocable invocable;
        if (engine instanceof Invocable) {
            invocable = (Invocable) engine;
        } else {
            System.err.println(engine+" does not support invocations!");
            return ;
        }
        engine.eval("load (\"src/VR_test.js\");");
        invocable.invokeFunction("foo", 9);
        invocable.invokeFunction("foo", 99);

where step into invocable.invokeFunction("foo", 9);
does not stop in VR_test.foo() function.
Comment 3 Martin Entlicher 2014-01-09 16:52:57 UTC
Fixed by changeset:   270295:f0c62216c27e
http://hg.netbeans.org/core-main/rev/f0c62216c27e
Comment 4 Jaroslav Tulach 2014-01-10 09:02:05 UTC
Step in works, but when verifying it on the bck2brwsr example, I found that line numbers are incorrect. So the feature is not really useful in current state. Can you take a look at line mishmash issue? Enough to reopen, or should I report new bug?
Comment 5 Martin Entlicher 2014-01-10 09:20:24 UTC
Seems like a separate issue, but never mind.
Can you please describe how the line numbers are incorrect? Doesn't the code in the original file start from it's fist line? Is there some line shift? Is it possible to reproduce with some short test code?
Comment 6 Jan Peska 2014-07-16 08:29:05 UTC
Jardo, please reopen the issue once you answer Martin's questions.

Thanks