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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js

Issue 2857453002: DevTools: support resolving a UILocation to multiple raw script locations (Closed)
Patch Set: Review comments addressed Created 3 years, 8 months 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
Index: third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js b/third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js
index 88df8c07de7cbb1c99df450002bbcead19cc7d72..cdf521a934f4154805016c34610befba2de2fa70 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js
@@ -266,13 +266,15 @@ Bindings.BreakpointManager = class extends Common.Object {
* @return {!Promise<!Array<!Workspace.UILocation>>}
*/
possibleBreakpoints(uiSourceCode, textRange) {
- var startLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(
+ var startLocations = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations(
uiSourceCode, textRange.startLine, textRange.startColumn);
- var endLocation =
- Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode, textRange.endLine, textRange.endColumn);
- if (!startLocation || !endLocation || startLocation.debuggerModel !== endLocation.debuggerModel)
+ var endLocations = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations(
+ uiSourceCode, textRange.endLine, textRange.endColumn);
+ var startLocationsByScript = new Map(startLocations.map(location => [location.uniqueScriptId(), location]));
dgozman 2017/05/02 21:36:45 Why not just compare them all? for (var startLoca
+ var endLocation = endLocations.find(location => startLocationsByScript.get(location.uniqueScriptId()));
+ if (!endLocation)
return Promise.resolve([]);
-
+ var startLocation = startLocationsByScript.get(endLocation.uniqueScriptId());
return startLocation.debuggerModel
.getPossibleBreakpoints(startLocation, endLocation, /* restrictToFunction */ false)
.then(toUILocations.bind(this));
@@ -809,7 +811,7 @@ Bindings.BreakpointManager.ModelBreakpoint = class {
var condition = this._breakpoint.condition();
var debuggerLocation = uiSourceCode &&
- Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber);
+ Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber)[0];
var newState;
if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scriptDiverged()) {
newState = null;

Powered by Google App Engine
This is Rietveld 408576698