eclipsesource / J2V8

Java Bindings for V8
2.55k stars 355 forks source link

How to use V8DebugServer #532

Open kaolaxiaowugo opened 3 years ago

kaolaxiaowugo commented 3 years ago

I want to debug javascript in the chrome and I found V8DebugServer ,but it can't work . plz help me , very pleasure.

V8Object debugScope = runtime.getObject(DEBUG_OBJECT_NAME); debugScope is UNDEFINED , and the next steps get exception.

ahmadov commented 3 years ago

Hi, V8DebugServer is not compatible with J2V8 6.2. You have to use V8Inspector instead.

To establish communication with Chrome DevTools, you have to create a WebSocket based HTTP server then forward messages from Chrome DevTools to V8Inspector.dispatchProcotolMessage.

jamie-houston commented 3 years ago

FYI - you can use https://github.com/AlexTrotsenko/j2v8-debugger for this. I wrote a blog post about updating it to use the Inspector protocol. https://engineering.salesforce.com/debugging-embedded-javascript-in-an-android-app-using-chrome-devtools-8553864ee09c