RDKEMW-18491 : [rdknativescript] add debugger support similar to webkit#134
Open
gurpreet319 wants to merge 1 commit into
Open
RDKEMW-18491 : [rdknativescript] add debugger support similar to webkit#134gurpreet319 wants to merge 1 commit into
gurpreet319 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a custom remote inspector implementation for the JSC-based runtime, aiming to provide debugger/inspector support “similar to WebKit” via an HTTP + WebSocket server and a lightweight browser UI.
Changes:
- Adds a libsoup-based
InspectorHTTPServerthat serves/json/*endpoints and a/devtools/page/<id>WebSocket for a minimal CDP-like protocol. - Adds a standalone inspector frontend (
nativejsinspector.html) with Console + Sources views and a “Reload” action. - Wires runtime events into the inspector (context registration, script registration, and forwarding console output), and adds a build option to enable the feature.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/nativejsinspector.html | New inspector UI (Console/Sources) that connects over WebSocket to the runtime. |
| src/jsc/JavaScriptUtils.cpp | Forwards console.* output to the inspector server when enabled. |
| src/jsc/JavaScriptEngine.cpp | Starts/stops the inspector server based on NATIVEJS_INSPECTOR_SERVER; updates websocket server polling. |
| src/jsc/JavaScriptContext.cpp | Registers/unregisters the top-level JS context with the inspector server and wires reload callback. |
| src/JavaScriptContextBase.cpp | Registers file-based scripts so they appear in the Sources panel. |
| src/InspectorHTTPServer.cpp | New HTTP + WebSocket server implementing minimal CDP-like messages, plus script/context tracking. |
| include/InspectorHTTPServer.h | New public header for the inspector server singleton. |
| src/jsc/include.cmake | Adds inspector sources/defines and libsoup linkage when enabled. |
| CMakeLists.txt | Renames/introduces REMOTE_INSPECTOR_ENABLE option and adjusts linking/include paths for libsoup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+82
to
+85
| .file-item.active { background: #0078d4; color: #fff; } | ||
| .file-item.js:before { content: '��� '; } | ||
| .file-item.json:before { content: '��� '; } | ||
| .file-item.txt:before { content: '��� '; } |
Comment on lines
+252
to
+256
| function connect() { | ||
| const wsUrl = `ws://${window.location.host}/devtools/page/${state.contextId}`; | ||
| log(`Connecting to ${wsUrl}...`, 'debug'); | ||
| state.ws = new WebSocket(wsUrl); | ||
|
|
Comment on lines
+318
to
+320
|
|
||
| log(`��� Script parsed: ${url}`, 'debug'); | ||
|
|
Comment on lines
+379
to
+381
| renderFileTree(); | ||
| log(`��� Script loaded: ${getFileName(url)}`, 'debug'); | ||
|
|
| set(JSRUNTIME_LIBRARY_LINK_DIRECTORIES ${JSRUNTIME_LIBRARY_LINK_DIRECTORIES} -L${CMAKE_CURRENT_SOURCE_DIR}/build/) | ||
| else () | ||
| set(JSRUNTIME_INCLUDE_DIRECTORIES ${JSRUNTIME_INCLUDE_DIRECTORIES} $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/glib-2.0 $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/lib/glib-2.0/include/ $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/rtcore $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/WPEFramework $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/gstreamer-1.0 $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/uwebsockets) | ||
| set(JSRUNTIME_INCLUDE_DIRECTORIES ${JSRUNTIME_INCLUDE_DIRECTORIES} $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/glib-2.0 $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/libsoup-3.0 $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/lib/glib-2.0/include/ $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/rtcore $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/WPEFramework $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/gstreamer-1.0 $ENV{PKG_CONFIG_SYSROOT_DIR}/usr/include/uwebsockets) |
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Comment on lines
+205
to
+215
| std::string escapedText; | ||
| for (const char* p = text; *p; ++p) { | ||
| switch (*p) { | ||
| case '\"': escapedText += "\\\""; break; | ||
| case '\\': escapedText += "\\\\"; break; | ||
| case '\n': escapedText += "\\n"; break; | ||
| case '\r': escapedText += "\\r"; break; | ||
| case '\t': escapedText += "\\t"; break; | ||
| default: escapedText += *p; break; | ||
| } | ||
| } |
Comment on lines
+75
to
+85
| .folder-item { padding: 4px 8px; font-size: 12px; color: #333; cursor: pointer; user-select: none; } | ||
| .folder-item:before { content: '��� '; } | ||
| .folder-item.open:before { content: '��� '; } | ||
| .folder-item:hover { background: #d8d8d8; } | ||
| .file-list { padding-left: 16px; } | ||
| .file-item { padding: 4px 8px; cursor: pointer; border-radius: 3px; font-size: 12px; color: #333; } | ||
| .file-item:hover { background: #d8d8d8; } | ||
| .file-item.active { background: #0078d4; color: #fff; } | ||
| .file-item.js:before { content: '��� '; } | ||
| .file-item.json:before { content: '��� '; } | ||
| .file-item.txt:before { content: '��� '; } |
f842503 to
0f49c41
Compare
0f49c41 to
97013df
Compare
97013df to
b7b32f3
Compare
Reason for change: Added debugger support Test Procedure: build should be successful Risk: low Priority: P2
b7b32f3 to
ade272b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason for change: Added debugger support
Test Procedure: build should be successful
Risk: low
Priority: P2