-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
inspectorIssues and PRs related to the V8 inspector protocolIssues and PRs related to the V8 inspector protocolworkerIssues and PRs related to Worker support.Issues and PRs related to Worker support.
Description
Version
21.1.0
Platform
Darwin mbp.peet.io 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64
Subsystem
inspector
What steps will reproduce the bug?
From a user's point of view...
- Debug a script like this in VS Code
const { Worker, isMainThread } = require('worker_threads');
if (isMainThread) {
new Worker(__filename);
} else {
debugger;
}
- Ensure the worker_thread session is select and run
console.log('本機磁碟')
- Nothing happens (an error behind the scenes)
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
It should log 本機磁碟
What do you see instead?
An error
Additional information
Behind the scenes, this calls
{
"id": 1027,
"method": "NodeWorker.sendMessageToWorker",
"params": {
"message": "{\"id\":1014,\"method\":\"Debugger.evaluateOnCallFrame\",\"params\":{\"expression\":\"console.log('本機磁碟')\\n//# sourceURL=eval-1e14c9c5.repl\\n\",\"includeCommandLineAPI\":true,\"objectGroup\":\"console\",\"generatePreview\":true,\"callFrameId\":\"-7882104772351236078.1.0\"}}",
"sessionId": "1"
}
}
This is created by simply JSON.stringify'ing the relevant CDP call.
However, this results in
{
"method": "NodeWorker.receivedMessageFromWorker",
"params": {
"sessionId": "1",
"message": "{\"error\":{\"code\":-32700,\"message\":\"Message must be a valid JSON\"}}"
}
}
Which seems to come from here
reportProtocolErrorTo(m_frontendChannel, DispatchResponse::kParseError, "Message must be a valid JSON"); |
This causes more 'real' issues when users have paths with multi-byte codepoints, as reported in microsoft/vscode-js-debug#1798 and microsoft/vscode-js-debug#2043
Metadata
Metadata
Assignees
Labels
inspectorIssues and PRs related to the V8 inspector protocolIssues and PRs related to the V8 inspector protocolworkerIssues and PRs related to Worker support.Issues and PRs related to Worker support.