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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.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/CompilerScriptMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
index 8ff4c7f32d14d7a318d4747efe8115547a205353..92f73c8e758a2eed8b60f5261d0f18b2614d3acc 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/CompilerScriptMapping.js
@@ -150,19 +150,16 @@ Bindings.CompilerScriptMapping = class {
* @param {!Workspace.UISourceCode} uiSourceCode
* @param {number} lineNumber
* @param {number} columnNumber
- * @return {?SDK.DebuggerModel.Location}
+ * @return {!Array<!SDK.DebuggerModel.Location>}
*/
- uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {
+ uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber) {
var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol];
- if (!script)
- return null;
- var sourceMap = this._sourceMapManager.sourceMapForClient(script);
+ var sourceMap = script && this._sourceMapManager.sourceMapForClient(script);
if (!sourceMap)
- return null;
- var entry = sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber);
- if (!entry)
- return null;
- return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry.columnNumber);
+ return [];
+ return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber)
+ .map(entry => this._debuggerModel.createRawLocation(script, entry.lineNumber, entry.columnNumber))
+ .filter(location => location);
dgozman 2017/05/02 21:36:45 nit: location => !!location
}
/**
@@ -278,7 +275,7 @@ Bindings.CompilerScriptMapping = class {
var sourceMap = script ? this._sourceMapManager.sourceMapForClient(script) : null;
if (!sourceMap)
return true;
- return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber);
+ return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber).length > 0;
}
dispose() {

Powered by Google App Engine
This is Rietveld 408576698