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

Side by Side 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: update a test expectation. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 }, 154 },
155 155
156 /** 156 /**
157 * @param {?WebInspector.Target} target 157 * @param {?WebInspector.Target} target
158 * @param {?string} scriptId 158 * @param {?string} scriptId
159 * @param {string} sourceURL 159 * @param {string} sourceURL
160 * @param {number} lineNumber 160 * @param {number} lineNumber
161 * @param {number=} columnNumber 161 * @param {number=} columnNumber
162 * @param {string=} classes 162 * @param {string=} classes
163 * @return {!Element} 163 * @return {?Element}
164 */ 164 */
165 linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, col umnNumber, classes) 165 linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, col umnNumber, classes)
dgozman 2016/07/15 23:24:22 This is used in ConsoleViewMessage._tryFormatAsErr
166 { 166 {
167 var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineN umber, columnNumber, classes); 167 var fallbackAnchor = sourceURL ? WebInspector.linkifyResourceAsNode(sour ceURL, lineNumber, columnNumber, classes) : null;
168 if (!target || target.isDetached()) 168 if (!target || target.isDetached())
169 return fallbackAnchor; 169 return fallbackAnchor;
170 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 170 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
171 if (!debuggerModel) 171 if (!debuggerModel)
172 return fallbackAnchor; 172 return fallbackAnchor;
173 173
174 var rawLocation = scriptId ? debuggerModel.createRawLocationByScriptId(s criptId, lineNumber, columnNumber || 0) : 174 var rawLocation = scriptId && scriptId !== "0"
dgozman 2016/07/15 23:24:22 Let's rather fix backend to send empty string or b
175 debuggerModel.createRawLocationByURL(source URL, lineNumber, columnNumber || 0); 175 ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumber, co lumnNumber || 0)
176 : debuggerModel.createRawLocationByURL(sourceURL, lineNumber, column Number || 0);
176 if (!rawLocation) 177 if (!rawLocation)
177 return fallbackAnchor; 178 return fallbackAnchor;
178 179
179 var anchor = this._createAnchor(classes); 180 var anchor = this._createAnchor(classes);
180 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocat ion(rawLocation, this._updateAnchor.bind(this, anchor), /** @type {!WebInspector .LiveLocationPool} */(this._locationPoolByTarget.get(rawLocation.target()))); 181 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocat ion(rawLocation, this._updateAnchor.bind(this, anchor), /** @type {!WebInspector .LiveLocationPool} */(this._locationPoolByTarget.get(rawLocation.target())));
181 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get( rawLocation.target())); 182 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get( rawLocation.target()));
182 anchors.push(anchor); 183 anchors.push(anchor);
183 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; 184 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation;
184 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; 185 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor;
185 return anchor; 186 return anchor;
186 }, 187 },
187 188
188 /** 189 /**
189 * @param {!WebInspector.DebuggerModel.Location} rawLocation 190 * @param {!WebInspector.DebuggerModel.Location} rawLocation
190 * @param {string} fallbackUrl 191 * @param {string} fallbackUrl
191 * @param {string=} classes 192 * @param {string=} classes
192 * @return {!Element} 193 * @return {?Element}
193 */ 194 */
194 linkifyRawLocation: function(rawLocation, fallbackUrl, classes) 195 linkifyRawLocation: function(rawLocation, fallbackUrl, classes)
dgozman 2016/07/15 23:24:22 This is used in ObjectPopoverHelper._showObjectPop
195 { 196 {
196 return this.linkifyScriptLocation(rawLocation.target(), rawLocation.scri ptId, fallbackUrl, rawLocation.lineNumber, rawLocation.columnNumber, classes); 197 return this.linkifyScriptLocation(rawLocation.target(), rawLocation.scri ptId, fallbackUrl, rawLocation.lineNumber, rawLocation.columnNumber, classes);
197 }, 198 },
198 199
199 /** 200 /**
200 * @param {?WebInspector.Target} target 201 * @param {?WebInspector.Target} target
201 * @param {!RuntimeAgent.CallFrame} callFrame 202 * @param {!RuntimeAgent.CallFrame} callFrame
202 * @param {string=} classes 203 * @param {string=} classes
203 * @return {!Element} 204 * @return {?Element}
204 */ 205 */
205 linkifyConsoleCallFrame: function(target, callFrame, classes) 206 linkifyConsoleCallFrame: function(target, callFrame, classes)
206 { 207 {
207 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, callFrame.lineNumber, callFrame.columnNumber, classes); 208 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, callFrame.lineNumber, callFrame.columnNumber, classes);
208 }, 209 },
209 210
210 /** 211 /**
211 * @param {?WebInspector.Target} target 212 * @param {?WebInspector.Target} target
212 * @param {!RuntimeAgent.CallFrame} callFrame 213 * @param {!RuntimeAgent.CallFrame} callFrame
213 * @param {string=} classes 214 * @param {string=} classes
214 * @return {!Element} 215 * @return {?Element}
215 */ 216 */
216 linkifyConsoleCallFrameForTimeline: function(target, callFrame, classes) 217 linkifyConsoleCallFrameForTimeline: function(target, callFrame, classes)
217 { 218 {
218 // TODO(kozyatinskiy): remove this when Profilers will migrate to 0-base d lineNumber and columnNumber. 219 // TODO(kozyatinskiy): remove this when Profilers will migrate to 0-base d lineNumber and columnNumber.
219 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, callFrame.lineNumber - 1, callFrame.columnNumber - 1, classes); 220 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, callFrame.lineNumber - 1, callFrame.columnNumber - 1, classes);
220 }, 221 },
221 222
222 /** 223 /**
223 * @param {!WebInspector.Target} target 224 * @param {!WebInspector.Target} target
224 * @param {!RuntimeAgent.StackTrace} stackTrace 225 * @param {!RuntimeAgent.StackTrace} stackTrace
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 /** 547 /**
547 * @param {!WebInspector.NetworkRequest} request 548 * @param {!WebInspector.NetworkRequest} request
548 * @return {!Element} 549 * @return {!Element}
549 */ 550 */
550 WebInspector.linkifyRequestAsNode = function(request) 551 WebInspector.linkifyRequestAsNode = function(request)
551 { 552 {
552 var anchor = WebInspector.linkifyURLAsNode(request.url); 553 var anchor = WebInspector.linkifyURLAsNode(request.url);
553 anchor.requestId = request.requestId; 554 anchor.requestId = request.requestId;
554 return anchor; 555 return anchor;
555 } 556 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698