Skip to content

RDKEMW-18491 : [rdknativescript] add debugger support similar to webkit#134

Open
gurpreet319 wants to merge 1 commit into
developfrom
topic/RDKEMW-18491
Open

RDKEMW-18491 : [rdknativescript] add debugger support similar to webkit#134
gurpreet319 wants to merge 1 commit into
developfrom
topic/RDKEMW-18491

Conversation

@gurpreet319
Copy link
Copy Markdown
Contributor

Reason for change: Added debugger support
Test Procedure: build should be successful
Risk: low
Priority: P2

Copilot AI review requested due to automatic review settings June 4, 2026 11:45
@gurpreet319 gurpreet319 requested a review from a team as a code owner June 4, 2026 11:45
Comment thread utils/nativejsinspector.html Dismissed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 InspectorHTTPServer that 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 thread src/jsc/JavaScriptEngine.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread utils/nativejsinspector.html Outdated
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 thread utils/nativejsinspector.html Outdated
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 thread utils/nativejsinspector.html Outdated
Comment on lines +318 to +320

log(`��� Script parsed: ${url}`, 'debug');

Comment thread utils/nativejsinspector.html Outdated
Comment on lines +379 to +381
renderFileTree();
log(`��� Script loaded: ${getFileName(url)}`, 'debug');

Comment thread CMakeLists.txt Outdated
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)
@github-advanced-security
Copy link
Copy Markdown

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:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copilot AI review requested due to automatic review settings June 5, 2026 06:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Comment thread src/jsc/JavaScriptEngine.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
Comment thread src/InspectorHTTPServer.cpp Outdated
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 thread utils/nativejsinspector.html Outdated
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: '��� '; }
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/JavaScriptContextBase.cpp
@gurpreet319 gurpreet319 force-pushed the topic/RDKEMW-18491 branch from f842503 to 0f49c41 Compare June 5, 2026 08:53
Comment thread src/jsc/JavaScriptUtils.cpp Fixed
@gurpreet319 gurpreet319 force-pushed the topic/RDKEMW-18491 branch from 0f49c41 to 97013df Compare June 5, 2026 08:55
Copilot AI review requested due to automatic review settings June 5, 2026 09:08
@gurpreet319 gurpreet319 force-pushed the topic/RDKEMW-18491 branch from 97013df to b7b32f3 Compare June 5, 2026 09:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/InspectorHTTPServer.cpp
Comment thread src/jsc/JavaScriptEngine.cpp
Reason for change: Added debugger support
Test Procedure: build should be successful
Risk: low
Priority: P2
@gurpreet319 gurpreet319 force-pushed the topic/RDKEMW-18491 branch from b7b32f3 to ade272b Compare June 5, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants