Use setBreakpoint() only when creating a new breakpoint
Up until now we used getPossibleBreakpoints() in order to find the
breakable location, just for setBreakpoint to set a breakpoint
on the first returned location. Using setBreakpoint() directly
is more intuitive and straight-forward, and for our use case
it should result in the same breakpoint setting behavior.
Bug: chromium:1105172
Change-Id: Id9460dcddb714fafa32a4620116e29c62c03c301
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2306150
Auto-Submit: Kim-Anh Tran <[email protected]>
Reviewed-by: Benedikt Meurer <[email protected]>
Commit-Queue: Benedikt Meurer <[email protected]>
diff --git a/front_end/sources/DebuggerPlugin.js b/front_end/sources/DebuggerPlugin.js
index ddda6c6..faf9e82 100644
--- a/front_end/sources/DebuggerPlugin.js
+++ b/front_end/sources/DebuggerPlugin.js
@@ -1719,17 +1719,6 @@
return;
}
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ScriptsBreakpointSet);
- if (editorLineNumber < this._textEditor.linesCount) {
- const start = this._transformer.editorLocationToUILocation(editorLineNumber, 0);
- const end = this._transformer.editorLocationToUILocation(editorLineNumber + 1, 0);
- const locations = await this._breakpointManager.possibleBreakpoints(
- this._uiSourceCode,
- new TextUtils.TextRange.TextRange(start.lineNumber, start.columnNumber, end.lineNumber, end.columnNumber));
- if (locations && locations.length) {
- await this._setBreakpoint(locations[0].lineNumber, locations[0].columnNumber, condition, enabled);
- return;
- }
- }
const origin = this._transformer.editorLocationToUILocation(editorLineNumber, 0);
await this._setBreakpoint(origin.lineNumber, origin.columnNumber, condition, enabled);
}