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

Unified Diff: Source/devtools/front_end/sdk/Linkifier.js

Issue 404953004: DevTools: Refactor linkifyRawLocation to use fallback url (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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: Source/devtools/front_end/sdk/Linkifier.js
diff --git a/Source/devtools/front_end/sdk/Linkifier.js b/Source/devtools/front_end/sdk/Linkifier.js
index 9e25ecc72ac3958e854af0a702440325c586047a..7f0196e85d00d03348e55d4f806469f6cfe59b92 100644
--- a/Source/devtools/front_end/sdk/Linkifier.js
+++ b/Source/devtools/front_end/sdk/Linkifier.js
@@ -142,57 +142,38 @@ WebInspector.Linkifier.prototype = {
/**
* @param {?WebInspector.Target} target
- * @param {string} scriptId
+ * @param {?string} scriptId
* @param {string} sourceURL
* @param {number} lineNumber
* @param {number=} columnNumber
* @param {string=} classes
- * @return {?Element}
+ * @return {!Element}
*/
linkifyLocationByScriptId: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes)
{
- var rawLocation = target ? target.debuggerModel.createRawLocationByScriptId(scriptId, sourceURL, lineNumber, columnNumber || 0) : null;
+ var rawLocation = target && !target.isDead() ? target.debuggerModel.createRawLocationByScriptId(scriptId, sourceURL, lineNumber, columnNumber || 0) : null;
var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, classes);
if (!rawLocation)
return fallbackAnchor;
- var anchor = this.linkifyRawLocation(rawLocation, classes);
+ var anchor = this._createAnchor(classes);
+ var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bind(this, anchor));
+ this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anchor, location: liveLocation});
anchor.__fallbackAnchor = fallbackAnchor;
return anchor;
-
},
/**
- * @param {!WebInspector.Target} target
+ * @param {?WebInspector.Target} target
* @param {string} sourceURL
* @param {number} lineNumber
* @param {number=} columnNumber
* @param {string=} classes
- * @return {?Element}
+ * @return {!Element}
*/
linkifyLocation: function(target, sourceURL, lineNumber, columnNumber, classes)
vsevik 2014/07/21 06:54:46 This method seems confusing now, should we remove
sergeyv 2014/07/21 12:06:54 Done.
{
- var rawLocation = target.debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0);
- if (!rawLocation)
- return WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, classes);
- return this.linkifyRawLocation(rawLocation, classes);
- },
-
- /**
- * @param {!WebInspector.DebuggerModel.Location} rawLocation
- * @param {string=} classes
- * @return {?Element}
- */
- linkifyRawLocation: function(rawLocation, classes)
vsevik 2014/07/21 07:24:28 Could we keep this method and add sourceURL to raw
- {
- // FIXME: this check should not be here.
- var script = rawLocation.target().debuggerModel.scriptForId(rawLocation.scriptId);
- if (!script)
- return null;
- var anchor = this._createAnchor(classes);
- var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bind(this, anchor));
- this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anchor, location: liveLocation});
- return anchor;
+ return this.linkifyLocationByScriptId(target, null, sourceURL, lineNumber, columnNumber, classes);
},
/**

Powered by Google App Engine
This is Rietveld 408576698