How to get events from an embedded JavaScript Rhino engine

53 Views Asked by At

I have a webapp project running on tomcat that uses an embedded Rhino engine to execute custom scripts uploaded by (power) users; from the execution point of view, everything is working as expected, provided the script is correct.

But currently the scripts can only be debugged using the Rhino Debugger from the server; this raises several problems :

  1. users cannot debug their own scripts remotely
  2. how to handle this on a headless production server

One approach would be to write some web-based components that can handle (basic?) script debugging, but I can't find a way of catching debug-related events from the scripting engine.

Can you please share your thoughts on how to handle this ?

Can it even be implemented on the current version of Rhino ?

1

There are 1 best solutions below

0
Paul On

Unfortunately there isn't a standard/preferred, out-of-the-box solution.

The Rhino project comes with a debugger, but that one isn't designed to connect to remote processes.

The Eclipse DLTK (JavaScript) project has a debugger implementation for Rhino, but that project is sort is dead, except for a fork

There have been efforts to implement a remote debugger the old V8 wire protocol, but as far as I can tell they have been abandoned

For both items above, see https://groups.google.com/g/mozilla.dev.tech.js-engine.rhino/c/pNJlUd_2ueg/m/GBc2std9czEJ

Within the Rhino project there's the idea of implementing a remote debugger based on DAP, but no champion yet to get that of the ground