Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(766)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js

Issue 2477483002: DevTools: fix breakpoints in Node.js (Closed)
Patch Set: add test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/nodejs-set-breakpoint-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
index 2af3c43935e067607de0acfe58911663b5326512..acdc7e2bce9602c341001033340c4db12a40950e 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
@@ -56,6 +56,8 @@ WebInspector.DebuggerModel = class extends WebInspector.SDKModel {
WebInspector.moduleSetting('pauseOnCaughtException').addChangeListener(this._pauseOnExceptionStateChanged, this);
WebInspector.moduleSetting('enableAsyncStackTraces').addChangeListener(this.asyncStackTracesStateChanged, this);
+ /** @type {!Map<string, string>} */
+ this._fileURLToNodeJSPath = new Map();
this.enableDebugger();
}
@@ -201,6 +203,9 @@ WebInspector.DebuggerModel = class extends WebInspector.SDKModel {
* @param {function(?DebuggerAgent.BreakpointId, !Array.<!WebInspector.DebuggerModel.Location>)=} callback
*/
setBreakpointByURL(url, lineNumber, columnNumber, condition, callback) {
+ // Convert file url to node-js path.
+ if (this.target().isNodeJS() && this._fileURLToNodeJSPath.has(url))
+ url = this._fileURLToNodeJSPath.get(url);
// Adjust column if needed.
var minColumnNumber = 0;
var scripts = this._scriptsBySourceURL.get(url) || [];
@@ -457,8 +462,11 @@ WebInspector.DebuggerModel = class extends WebInspector.SDKModel {
if (executionContextAuxData && ('isDefault' in executionContextAuxData))
isContentScript = !executionContextAuxData['isDefault'];
// Support file URL for node.js.
- if (this.target().isNodeJS() && sourceURL && sourceURL.startsWith('/'))
- sourceURL = WebInspector.ParsedURL.platformPathToURL(sourceURL);
+ if (this.target().isNodeJS() && sourceURL && sourceURL.startsWith('/')) {
+ var nodeJSPath = sourceURL;
+ sourceURL = WebInspector.ParsedURL.platformPathToURL(nodeJSPath);
+ this._fileURLToNodeJSPath.set(sourceURL, nodeJSPath);
+ }
var script = new WebInspector.Script(
this, scriptId, sourceURL, startLine, startColumn, endLine, endColumn, executionContextId, hash,
isContentScript, isLiveEdit, sourceMapURL, hasSourceURL);
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sources/debugger-breakpoints/nodejs-set-breakpoint-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698