New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 679144 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Last visit 29 days ago
Closed: Dec 12
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

v8 node js debugger source url mismatch with workspaces

Reported by lacm...@gmail.com, Jan 7 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce the problem:
I want to use chrome as a node js debugger/"ide". node --inspect works fine but when i want to map files with the local file system in windows for live editing...I got problems with the workspace path mappings / breakpoints, etc. Im using NodeJS v7.4

What is the expected behavior?
I made a proxy workaround to remap the source urls and replace the directory separators.

My process runs form a subdirectory... thats why i made this: path.resolve(__dirname+'/../..');

This code connects to the standard 5858 debugger ws port and listens on 5859... so you have to change the link when connecting devtools. Example: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5859/11212484-27c8-4a50-98c0-e298d8b9942c

If there is a better solution, pls tell me.

this works fine from a seperate process::

var WebSocket = require('ws');
var WebSocketServer = WebSocket.Server;
var path = require('path');
wss = new WebSocketServer({ port: 5859 });
wss.on('connection', function connection(ws) {
ws.dbgclient = new WebSocket('ws://localhost:5858' + ws.upgradeReq.url);
console.log('Debug proxy connection: ' + ws.upgradeReq.url);
ws.dbgclient.on('message', function(message) {
//From app
var msg = JSON.parse(message);;
if (msg.method=='Debugger.scriptParsed') {
var abspath=path.resolve(__dirname+'/../..');
if (msg.params.url.indexOf(abspath)==0) {
msg.params.url=msg.params.url.substring(abspath.length).replace(/\/g, '/');
}
}
ws.send(JSON.stringify(msg));
});
ws.dbgclient.on('close', function() {
console.log('Host connection closed');
});
ws.on('message', function(message) {
//From chrome
var msg = JSON.parse(message);
if (msg.method=='Debugger.setBreakpointByUrl') {
msg.params.url=(path.resolve(__dirname+'/../../')+msg.params.url).replace(///g, '\')
}
ws.dbgclient.send(JSON.stringify(msg));
});
ws.on('close', function() {
ws.dbgclient.close();
console.log('Proxy connection closed')
})
});

What went wrong?
I got problems with the workspace path mappings / breakpoints, etc. 

Did this work before? No 

Chrome version: 55.0.2883.87  Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: Shockwave Flash 24.0 r0
 
Labels: TE-NeedsTriageHelp

Comment 3 by kojii@chromium.org, Jan 10 2017

Components: -Blink Platform>DevTools

Comment 4 by alph@chromium.org, Jan 10 2017

Owner: eostroukhov@chromium.org
Status: Assigned (was: Unconfirmed)
Owner: lushnikov@chromium.org
Chrome 55 was not very friendly as an IDE for node.
In Chrome Canary we're doing better - it should solve majority of your problems. Could you try it out and see how it goes?
Labels: Needs-Feedback

Comment 8 Deleted

Comment 9 by lacm...@gmail.com, Apr 18 2017

Thx for your reply! I see the improvements in Canary, it should map it automaticaly... but it is the same. it can't parse node's filenames begins with C:\... and not file://c:/
...and with my proxy it can't automatically map with filesystem.
Project Member

Comment 10 by bugdroid1@chromium.org, Jan 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2e6a86dc0fe38ca58339cd3570df3292d7497a8d

commit 2e6a86dc0fe38ca58339cd3570df3292d7497a8d
Author: Andrey Lushnikov <lushnikov@chromium.org>
Date: Wed Jan 24 03:43:50 2018

DevTools: fix node.js + Workspaces + Windows

Node.js reports scripts with file paths instead of urls. Since all of
the devtools front-end code operates with URLs, we transform file paths
to urls in the DebuggerModel.

This patch fixes filePath->URL translation so that it works for Windows
paths.

R=dgozman, kozy
BUG= 679144 

Change-Id: Idf9320bd62c679277bb0689e0031ab948dbe0b72
Reviewed-on: https://chromium-review.googlesource.com/828466
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531412}
[modify] https://crrev.com/2e6a86dc0fe38ca58339cd3570df3292d7497a8d/third_party/WebKit/LayoutTests/http/tests/devtools/sources/debugger-breakpoints/nodejs-set-breakpoint.js
[modify] https://crrev.com/2e6a86dc0fe38ca58339cd3570df3292d7497a8d/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js

Status: Fixed (was: Assigned)

Sign in to add a comment