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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 2151653005: DevTools: Do not linkify to pseudo (program) node when there's no URL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments. Created 4 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: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
index c1c0279ca26fc9e1d7a8b630dcfa68e2d673ce04..eec35908a39775e266dc18fb33c650d8ade5ef9c 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
@@ -160,19 +160,20 @@ WebInspector.Linkifier.prototype = {
* @param {number} lineNumber
* @param {number=} columnNumber
* @param {string=} classes
- * @return {!Element}
+ * @return {?Element}
*/
- linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes)
+ maybeLinkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes)
{
- var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes);
+ var fallbackAnchor = sourceURL ? WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes) : null;
if (!target || target.isDetached())
return fallbackAnchor;
var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
if (!debuggerModel)
return fallbackAnchor;
- var rawLocation = scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumber, columnNumber || 0) :
- debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0);
+ var rawLocation = scriptId
+ ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumber, columnNumber || 0)
+ : debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0);
if (!rawLocation)
return fallbackAnchor;
@@ -186,6 +187,21 @@ WebInspector.Linkifier.prototype = {
},
/**
+ * @param {?WebInspector.Target} target
+ * @param {?string} scriptId
+ * @param {string} sourceURL
+ * @param {number} lineNumber
+ * @param {number=} columnNumber
+ * @param {string=} classes
+ * @return {!Element}
+ */
+ linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes)
+ {
+ return this.maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumber, classes)
+ || WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber, classes);
+ },
+
+ /**
* @param {!WebInspector.DebuggerModel.Location} rawLocation
* @param {string} fallbackUrl
* @param {string=} classes
@@ -200,18 +216,18 @@ WebInspector.Linkifier.prototype = {
* @param {?WebInspector.Target} target
* @param {!RuntimeAgent.CallFrame} callFrame
* @param {string=} classes
- * @return {!Element}
+ * @return {?Element}
*/
linkifyConsoleCallFrame: function(target, callFrame, classes)
dgozman 2016/07/16 20:34:39 maybeLinkify...
alph 2016/07/18 19:28:53 Done.
{
- return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame.url, callFrame.lineNumber, callFrame.columnNumber, classes);
+ return this.maybeLinkifyScriptLocation(target, callFrame.scriptId, callFrame.url, callFrame.lineNumber, callFrame.columnNumber, classes);
},
/**
* @param {?WebInspector.Target} target
* @param {!RuntimeAgent.CallFrame} callFrame
* @param {string=} classes
- * @return {!Element}
+ * @return {?Element}
*/
linkifyConsoleCallFrameForTimeline: function(target, callFrame, classes)
dgozman 2016/07/16 20:34:39 maybeLinkify...
alph 2016/07/18 19:28:54 Done.
{

Powered by Google App Engine
This is Rietveld 408576698