Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
fix: use well-formatted URLs when setting breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed Oct 3, 2018
1 parent 62b5bea commit 1e6bd43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/agent/state/inspector-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,15 @@ class StateResolver {
if (this.scriptmapper[scriptId].url === undefined) {
return '';
}
return this.scriptmapper[scriptId].url;
const scriptUrl = this.scriptmapper[scriptId].url;
if (scriptUrl.startsWith('file://')) {
// In Node 11+, non-internal files are formatted as URLs, so get just the
// path.
return scriptUrl.slice('file://'.length);
} else {
// Internal files should be returned as is.
return scriptUrl;
}
}

resolveRelativePath_(frame: inspector.Debugger.CallFrame): string {
Expand Down
2 changes: 1 addition & 1 deletion src/agent/v8/inspector-debugapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class InspectorDebugApi implements debugapi.DebugApi {

const res = this.v8Inspector.setBreakpointByUrl({
lineNumber: line - 1,
url: matchingScript,
url: `file://${matchingScript}`,
columnNumber: column - 1,
condition: breakpoint.condition || undefined
});
Expand Down

0 comments on commit 1e6bd43

Please sign in to comment.