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

Side by Side 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: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber) : null; 259 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber) : null;
260 return columnBreakpoints ? columnBreakpoints[0] : null; 260 return columnBreakpoints ? columnBreakpoints[0] : null;
261 } 261 }
262 262
263 /** 263 /**
264 * @param {!Workspace.UISourceCode} uiSourceCode 264 * @param {!Workspace.UISourceCode} uiSourceCode
265 * @param {!TextUtils.TextRange} textRange 265 * @param {!TextUtils.TextRange} textRange
266 * @return {!Promise<!Array<!Workspace.UILocation>>} 266 * @return {!Promise<!Array<!Workspace.UILocation>>}
267 */ 267 */
268 possibleBreakpoints(uiSourceCode, textRange) { 268 possibleBreakpoints(uiSourceCode, textRange) {
269 var startLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocatio n( 269 var startLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocatio ns(
270 uiSourceCode, textRange.startLine, textRange.startColumn); 270 uiSourceCode, textRange.startLine, textRange.startColumn)[0];
dgozman 2017/05/02 19:47:41 This is suspicious. What if there are multiple and
271 var endLocation = 271 var endLocation = Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations (
272 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode, textRange.endLine, textRange.endColumn); 272 uiSourceCode, textRange.endLine, textRange.endColumn)[0];
273 if (!startLocation || !endLocation || startLocation.debuggerModel !== endLoc ation.debuggerModel) 273 if (!startLocation || !endLocation || startLocation.debuggerModel !== endLoc ation.debuggerModel)
274 return Promise.resolve([]); 274 return Promise.resolve([]);
275 275
276 return startLocation.debuggerModel 276 return startLocation.debuggerModel
277 .getPossibleBreakpoints(startLocation, endLocation, /* restrictToFunctio n */ false) 277 .getPossibleBreakpoints(startLocation, endLocation, /* restrictToFunctio n */ false)
278 .then(toUILocations.bind(this)); 278 .then(toUILocations.bind(this));
279 279
280 /** 280 /**
281 * @this {!Bindings.BreakpointManager} 281 * @this {!Bindings.BreakpointManager}
282 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations 282 * @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 callback(); 802 callback();
803 return; 803 return;
804 } 804 }
805 805
806 var uiSourceCode = this._breakpoint.uiSourceCode(); 806 var uiSourceCode = this._breakpoint.uiSourceCode();
807 var lineNumber = this._breakpoint._lineNumber; 807 var lineNumber = this._breakpoint._lineNumber;
808 var columnNumber = this._breakpoint._columnNumber; 808 var columnNumber = this._breakpoint._columnNumber;
809 var condition = this._breakpoint.condition(); 809 var condition = this._breakpoint.condition();
810 810
811 var debuggerLocation = uiSourceCode && 811 var debuggerLocation = uiSourceCode &&
812 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber); 812 Bindings.debuggerWorkspaceBinding.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber)[0];
813 var newState; 813 var newState;
814 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri ptDiverged()) { 814 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri ptDiverged()) {
815 newState = null; 815 newState = null;
816 } else if (debuggerLocation) { 816 } else if (debuggerLocation) {
817 var script = debuggerLocation.script(); 817 var script = debuggerLocation.script();
818 if (script.sourceURL) { 818 if (script.sourceURL) {
819 newState = new Bindings.BreakpointManager.Breakpoint.State( 819 newState = new Bindings.BreakpointManager.Breakpoint.State(
820 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio n.columnNumber, condition); 820 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio n.columnNumber, condition);
821 } else { 821 } else {
822 newState = new Bindings.BreakpointManager.Breakpoint.State( 822 newState = new Bindings.BreakpointManager.Breakpoint.State(
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 this.url = breakpoint._url; 1080 this.url = breakpoint._url;
1081 this.lineNumber = breakpoint.lineNumber(); 1081 this.lineNumber = breakpoint.lineNumber();
1082 this.columnNumber = breakpoint.columnNumber(); 1082 this.columnNumber = breakpoint.columnNumber();
1083 this.condition = breakpoint.condition(); 1083 this.condition = breakpoint.condition();
1084 this.enabled = breakpoint.enabled(); 1084 this.enabled = breakpoint.enabled();
1085 } 1085 }
1086 }; 1086 };
1087 1087
1088 /** @type {!Bindings.BreakpointManager} */ 1088 /** @type {!Bindings.BreakpointManager} */
1089 Bindings.breakpointManager; 1089 Bindings.breakpointManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698