OLD | NEW |
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 |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
13 * distribution. | 13 * distribution. |
14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
17 * | 17 * |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | |
31 /** | 30 /** |
32 * @interface | 31 * @interface |
33 */ | 32 */ |
34 WebInspector.LinkifierFormatter = function() | 33 WebInspector.LinkifierFormatter = function() {}; |
35 { | 34 |
| 35 WebInspector.LinkifierFormatter.prototype = { |
| 36 /** |
| 37 * @param {!Element} anchor |
| 38 * @param {!WebInspector.UILocation} uiLocation |
| 39 * @param {boolean} isBlackboxed |
| 40 */ |
| 41 formatLiveAnchor: function(anchor, uiLocation, isBlackboxed) {} |
36 }; | 42 }; |
37 | 43 |
38 WebInspector.LinkifierFormatter.prototype = { | 44 /** |
39 /** | |
40 * @param {!Element} anchor | |
41 * @param {!WebInspector.UILocation} uiLocation | |
42 * @param {boolean} isBlackboxed | |
43 */ | |
44 formatLiveAnchor: function(anchor, uiLocation, isBlackboxed) { } | |
45 }; | |
46 | |
47 /** | |
48 * @constructor | |
49 * @implements {WebInspector.TargetManager.Observer} | 45 * @implements {WebInspector.TargetManager.Observer} |
50 * @param {!WebInspector.LinkifierFormatter=} formatter | 46 * @unrestricted |
51 */ | 47 */ |
52 WebInspector.Linkifier = function(formatter) | 48 WebInspector.Linkifier = class { |
53 { | 49 /** |
54 this._formatter = formatter || new WebInspector.Linkifier.DefaultFormatter(W
ebInspector.Linkifier.MaxLengthForDisplayedURLs); | 50 * @param {!WebInspector.LinkifierFormatter=} formatter |
| 51 */ |
| 52 constructor(formatter) { |
| 53 this._formatter = |
| 54 formatter || new WebInspector.Linkifier.DefaultFormatter(WebInspector.Li
nkifier.MaxLengthForDisplayedURLs); |
55 /** @type {!Map<!WebInspector.Target, !Array<!Element>>} */ | 55 /** @type {!Map<!WebInspector.Target, !Array<!Element>>} */ |
56 this._anchorsByTarget = new Map(); | 56 this._anchorsByTarget = new Map(); |
57 /** @type {!Map<!WebInspector.Target, !WebInspector.LiveLocationPool>} */ | 57 /** @type {!Map<!WebInspector.Target, !WebInspector.LiveLocationPool>} */ |
58 this._locationPoolByTarget = new Map(); | 58 this._locationPoolByTarget = new Map(); |
59 WebInspector.targetManager.observeTargets(this); | 59 WebInspector.targetManager.observeTargets(this); |
60 }; | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * @param {?WebInspector.Linkifier.LinkHandler} handler | 63 * @param {?WebInspector.Linkifier.LinkHandler} handler |
64 */ | 64 */ |
65 WebInspector.Linkifier.setLinkHandler = function(handler) | 65 static setLinkHandler(handler) { |
66 { | |
67 WebInspector.Linkifier._linkHandler = handler; | 66 WebInspector.Linkifier._linkHandler = handler; |
68 }; | 67 } |
69 | 68 |
70 /** | 69 /** |
71 * @param {string} url | 70 * @param {string} url |
72 * @param {number=} lineNumber | 71 * @param {number=} lineNumber |
73 * @return {boolean} | 72 * @return {boolean} |
74 */ | 73 */ |
75 WebInspector.Linkifier.handleLink = function(url, lineNumber) | 74 static handleLink(url, lineNumber) { |
76 { | |
77 if (!WebInspector.Linkifier._linkHandler) | 75 if (!WebInspector.Linkifier._linkHandler) |
78 return false; | 76 return false; |
79 return WebInspector.Linkifier._linkHandler.handleLink(url, lineNumber); | 77 return WebInspector.Linkifier._linkHandler.handleLink(url, lineNumber); |
80 }; | 78 } |
81 | 79 |
82 /** | 80 /** |
83 * @param {!Object} revealable | 81 * @param {!Object} revealable |
84 * @param {string} text | 82 * @param {string} text |
85 * @param {string=} fallbackHref | 83 * @param {string=} fallbackHref |
86 * @param {number=} fallbackLineNumber | 84 * @param {number=} fallbackLineNumber |
87 * @param {string=} title | 85 * @param {string=} title |
88 * @param {string=} classes | 86 * @param {string=} classes |
89 * @return {!Element} | 87 * @return {!Element} |
90 */ | 88 */ |
91 WebInspector.Linkifier.linkifyUsingRevealer = function(revealable, text, fallbac
kHref, fallbackLineNumber, title, classes) | 89 static linkifyUsingRevealer(revealable, text, fallbackHref, fallbackLineNumber
, title, classes) { |
92 { | 90 var a = createElement('a'); |
93 var a = createElement("a"); | 91 a.className = (classes || '') + ' webkit-html-resource-link'; |
94 a.className = (classes || "") + " webkit-html-resource-link"; | |
95 a.textContent = text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayed
URLs); | 92 a.textContent = text.trimMiddle(WebInspector.Linkifier.MaxLengthForDisplayed
URLs); |
96 a.title = title || text; | 93 a.title = title || text; |
97 if (fallbackHref) { | 94 if (fallbackHref) { |
98 a.href = fallbackHref; | 95 a.href = fallbackHref; |
99 a.lineNumber = fallbackLineNumber; | 96 a.lineNumber = fallbackLineNumber; |
100 } | 97 } |
101 /** | 98 /** |
102 * @param {!Event} event | 99 * @param {!Event} event |
103 * @this {Object} | 100 * @this {Object} |
104 */ | 101 */ |
105 function clickHandler(event) | 102 function clickHandler(event) { |
106 { | 103 event.stopImmediatePropagation(); |
107 event.stopImmediatePropagation(); | 104 event.preventDefault(); |
108 event.preventDefault(); | 105 if (fallbackHref && WebInspector.Linkifier.handleLink(fallbackHref, fallba
ckLineNumber)) |
109 if (fallbackHref && WebInspector.Linkifier.handleLink(fallbackHref, fall
backLineNumber)) | 106 return; |
110 return; | 107 |
111 | 108 WebInspector.Revealer.reveal(this); |
112 WebInspector.Revealer.reveal(this); | 109 } |
113 } | 110 a.addEventListener('click', clickHandler.bind(revealable), false); |
114 a.addEventListener("click", clickHandler.bind(revealable), false); | |
115 return a; | 111 return a; |
| 112 } |
| 113 |
| 114 /** |
| 115 * @param {!Element} anchor |
| 116 * @return {?WebInspector.UILocation} uiLocation |
| 117 */ |
| 118 static uiLocationByAnchor(anchor) { |
| 119 return anchor[WebInspector.Linkifier._uiLocationSymbol]; |
| 120 } |
| 121 |
| 122 /** |
| 123 * @param {!WebInspector.Target} target |
| 124 * @param {string} scriptId |
| 125 * @param {number} lineNumber |
| 126 * @param {number=} columnNumber |
| 127 * @return {string} |
| 128 */ |
| 129 static liveLocationText(target, scriptId, lineNumber, columnNumber) { |
| 130 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 131 if (!debuggerModel) |
| 132 return ''; |
| 133 var script = debuggerModel.scriptForId(scriptId); |
| 134 if (!script) |
| 135 return ''; |
| 136 var location = /** @type {!WebInspector.DebuggerModel.Location} */ ( |
| 137 debuggerModel.createRawLocation(script, lineNumber, columnNumber || 0)); |
| 138 var uiLocation = /** @type {!WebInspector.UILocation} */ ( |
| 139 WebInspector.debuggerWorkspaceBinding.rawLocationToUILocation(location))
; |
| 140 return uiLocation.linkText(); |
| 141 } |
| 142 |
| 143 /** |
| 144 * @override |
| 145 * @param {!WebInspector.Target} target |
| 146 */ |
| 147 targetAdded(target) { |
| 148 this._anchorsByTarget.set(target, []); |
| 149 this._locationPoolByTarget.set(target, new WebInspector.LiveLocationPool()); |
| 150 } |
| 151 |
| 152 /** |
| 153 * @override |
| 154 * @param {!WebInspector.Target} target |
| 155 */ |
| 156 targetRemoved(target) { |
| 157 var locationPool = /** @type {!WebInspector.LiveLocationPool} */ (this._loca
tionPoolByTarget.remove(target)); |
| 158 locationPool.disposeAll(); |
| 159 var anchors = this._anchorsByTarget.remove(target); |
| 160 for (var anchor of anchors) { |
| 161 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 162 var fallbackAnchor = anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 163 if (fallbackAnchor) { |
| 164 anchor.href = fallbackAnchor.href; |
| 165 anchor.lineNumber = fallbackAnchor.lineNumber; |
| 166 anchor.title = fallbackAnchor.title; |
| 167 anchor.className = fallbackAnchor.className; |
| 168 anchor.textContent = fallbackAnchor.textContent; |
| 169 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 170 } |
| 171 } |
| 172 } |
| 173 |
| 174 /** |
| 175 * @param {?WebInspector.Target} target |
| 176 * @param {?string} scriptId |
| 177 * @param {string} sourceURL |
| 178 * @param {number} lineNumber |
| 179 * @param {number=} columnNumber |
| 180 * @param {string=} classes |
| 181 * @return {?Element} |
| 182 */ |
| 183 maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumb
er, classes) { |
| 184 var fallbackAnchor = |
| 185 sourceURL ? WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, co
lumnNumber, classes) : null; |
| 186 if (!target || target.isDisposed()) |
| 187 return fallbackAnchor; |
| 188 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 189 if (!debuggerModel) |
| 190 return fallbackAnchor; |
| 191 |
| 192 var rawLocation = |
| 193 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumb
er, columnNumber || 0) : null) || |
| 194 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber
|| 0); |
| 195 if (!rawLocation) |
| 196 return fallbackAnchor; |
| 197 |
| 198 var anchor = this._createAnchor(classes); |
| 199 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocation( |
| 200 rawLocation, this._updateAnchor.bind(this, anchor), |
| 201 /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarge
t.get(rawLocation.target()))); |
| 202 var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(raw
Location.target())); |
| 203 anchors.push(anchor); |
| 204 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; |
| 205 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; |
| 206 return anchor; |
| 207 } |
| 208 |
| 209 /** |
| 210 * @param {?WebInspector.Target} target |
| 211 * @param {?string} scriptId |
| 212 * @param {string} sourceURL |
| 213 * @param {number} lineNumber |
| 214 * @param {number=} columnNumber |
| 215 * @param {string=} classes |
| 216 * @return {!Element} |
| 217 */ |
| 218 linkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumber, c
lasses) { |
| 219 return this.maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumb
er, columnNumber, classes) || |
| 220 WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnNumber,
classes); |
| 221 } |
| 222 |
| 223 /** |
| 224 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 225 * @param {string} fallbackUrl |
| 226 * @param {string=} classes |
| 227 * @return {!Element} |
| 228 */ |
| 229 linkifyRawLocation(rawLocation, fallbackUrl, classes) { |
| 230 return this.linkifyScriptLocation( |
| 231 rawLocation.target(), rawLocation.scriptId, fallbackUrl, rawLocation.lin
eNumber, rawLocation.columnNumber, |
| 232 classes); |
| 233 } |
| 234 |
| 235 /** |
| 236 * @param {?WebInspector.Target} target |
| 237 * @param {!RuntimeAgent.CallFrame} callFrame |
| 238 * @param {string=} classes |
| 239 * @return {?Element} |
| 240 */ |
| 241 maybeLinkifyConsoleCallFrame(target, callFrame, classes) { |
| 242 return this.maybeLinkifyScriptLocation( |
| 243 target, callFrame.scriptId, callFrame.url, callFrame.lineNumber, callFra
me.columnNumber, classes); |
| 244 } |
| 245 |
| 246 /** |
| 247 * @param {!WebInspector.Target} target |
| 248 * @param {!RuntimeAgent.StackTrace} stackTrace |
| 249 * @param {string=} classes |
| 250 * @return {!Element} |
| 251 */ |
| 252 linkifyStackTraceTopFrame(target, stackTrace, classes) { |
| 253 console.assert(stackTrace.callFrames && stackTrace.callFrames.length); |
| 254 |
| 255 var topFrame = stackTrace.callFrames[0]; |
| 256 var fallbackAnchor = |
| 257 WebInspector.linkifyResourceAsNode(topFrame.url, topFrame.lineNumber, to
pFrame.columnNumber, classes); |
| 258 if (target.isDisposed()) |
| 259 return fallbackAnchor; |
| 260 |
| 261 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 262 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTrace); |
| 263 if (rawLocations.length === 0) |
| 264 return fallbackAnchor; |
| 265 |
| 266 var anchor = this._createAnchor(classes); |
| 267 var liveLocation = WebInspector.debuggerWorkspaceBinding.createStackTraceTop
FrameLiveLocation( |
| 268 rawLocations, this._updateAnchor.bind(this, anchor), |
| 269 /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarge
t.get(target))); |
| 270 var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(tar
get)); |
| 271 anchors.push(anchor); |
| 272 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; |
| 273 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; |
| 274 return anchor; |
| 275 } |
| 276 |
| 277 /** |
| 278 * @param {!WebInspector.CSSLocation} rawLocation |
| 279 * @param {string=} classes |
| 280 * @return {!Element} |
| 281 */ |
| 282 linkifyCSSLocation(rawLocation, classes) { |
| 283 var anchor = this._createAnchor(classes); |
| 284 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation( |
| 285 rawLocation, this._updateAnchor.bind(this, anchor), |
| 286 /** @type {!WebInspector.LiveLocationPool} */ (this._locationPoolByTarge
t.get(rawLocation.target()))); |
| 287 var anchors = /** @type {!Array<!Element>} */ (this._anchorsByTarget.get(raw
Location.target())); |
| 288 anchors.push(anchor); |
| 289 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; |
| 290 return anchor; |
| 291 } |
| 292 |
| 293 /** |
| 294 * @param {!WebInspector.Target} target |
| 295 * @param {!Element} anchor |
| 296 */ |
| 297 disposeAnchor(target, anchor) { |
| 298 delete anchor[WebInspector.Linkifier._uiLocationSymbol]; |
| 299 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; |
| 300 var liveLocation = anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 301 if (liveLocation) |
| 302 liveLocation.dispose(); |
| 303 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; |
| 304 } |
| 305 |
| 306 /** |
| 307 * @param {string=} classes |
| 308 * @return {!Element} |
| 309 */ |
| 310 _createAnchor(classes) { |
| 311 var anchor = createElement('a'); |
| 312 anchor.className = (classes || '') + ' webkit-html-resource-link'; |
| 313 |
| 314 /** |
| 315 * @param {!Event} event |
| 316 */ |
| 317 function clickHandler(event) { |
| 318 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; |
| 319 if (!uiLocation) |
| 320 return; |
| 321 |
| 322 event.consume(true); |
| 323 if (WebInspector.Linkifier.handleLink(uiLocation.uiSourceCode.url(), uiLoc
ation.lineNumber)) |
| 324 return; |
| 325 WebInspector.Revealer.reveal(uiLocation); |
| 326 } |
| 327 anchor.addEventListener('click', clickHandler, false); |
| 328 return anchor; |
| 329 } |
| 330 |
| 331 reset() { |
| 332 for (var target of this._anchorsByTarget.keysArray()) { |
| 333 this.targetRemoved(target); |
| 334 this.targetAdded(target); |
| 335 } |
| 336 } |
| 337 |
| 338 dispose() { |
| 339 for (var target of this._anchorsByTarget.keysArray()) |
| 340 this.targetRemoved(target); |
| 341 WebInspector.targetManager.unobserveTargets(this); |
| 342 } |
| 343 |
| 344 /** |
| 345 * @param {!Element} anchor |
| 346 * @param {!WebInspector.LiveLocation} liveLocation |
| 347 */ |
| 348 _updateAnchor(anchor, liveLocation) { |
| 349 var uiLocation = liveLocation.uiLocation(); |
| 350 if (!uiLocation) |
| 351 return; |
| 352 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation; |
| 353 this._formatter.formatLiveAnchor(anchor, uiLocation, liveLocation.isBlackbox
ed()); |
| 354 } |
116 }; | 355 }; |
117 | 356 |
118 WebInspector.Linkifier._uiLocationSymbol = Symbol("uiLocation"); | 357 |
119 WebInspector.Linkifier._fallbackAnchorSymbol = Symbol("fallbackAnchor"); | 358 WebInspector.Linkifier._uiLocationSymbol = Symbol('uiLocation'); |
120 WebInspector.Linkifier._liveLocationSymbol = Symbol("liveLocation"); | 359 WebInspector.Linkifier._fallbackAnchorSymbol = Symbol('fallbackAnchor'); |
121 | 360 WebInspector.Linkifier._liveLocationSymbol = Symbol('liveLocation'); |
122 WebInspector.Linkifier.prototype = { | 361 |
123 /** | 362 |
124 * @override | 363 /** |
125 * @param {!WebInspector.Target} target | 364 * @implements {WebInspector.LinkifierFormatter} |
126 */ | 365 * @unrestricted |
127 targetAdded: function(target) | 366 */ |
128 { | 367 WebInspector.Linkifier.DefaultFormatter = class { |
129 this._anchorsByTarget.set(target, []); | 368 /** |
130 this._locationPoolByTarget.set(target, new WebInspector.LiveLocationPool
()); | 369 * @param {number=} maxLength |
131 }, | 370 */ |
132 | 371 constructor(maxLength) { |
133 /** | 372 this._maxLength = maxLength; |
134 * @override | 373 } |
135 * @param {!WebInspector.Target} target | 374 |
136 */ | 375 /** |
137 targetRemoved: function(target) | 376 * @override |
138 { | 377 * @param {!Element} anchor |
139 var locationPool = /** @type {!WebInspector.LiveLocationPool} */(this._l
ocationPoolByTarget.remove(target)); | 378 * @param {!WebInspector.UILocation} uiLocation |
140 locationPool.disposeAll(); | 379 * @param {boolean} isBlackboxed |
141 var anchors = this._anchorsByTarget.remove(target); | 380 */ |
142 for (var anchor of anchors) { | 381 formatLiveAnchor(anchor, uiLocation, isBlackboxed) { |
143 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; | 382 var text = uiLocation.linkText(); |
144 var fallbackAnchor = anchor[WebInspector.Linkifier._fallbackAnchorSy
mbol]; | 383 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, '$1\u2026'); |
145 if (fallbackAnchor) { | 384 if (this._maxLength) |
146 anchor.href = fallbackAnchor.href; | 385 text = text.trimMiddle(this._maxLength); |
147 anchor.lineNumber = fallbackAnchor.lineNumber; | 386 anchor.textContent = text; |
148 anchor.title = fallbackAnchor.title; | 387 |
149 anchor.className = fallbackAnchor.className; | 388 var titleText = uiLocation.uiSourceCode.url(); |
150 anchor.textContent = fallbackAnchor.textContent; | 389 if (typeof uiLocation.lineNumber === 'number') |
151 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; | 390 titleText += ':' + (uiLocation.lineNumber + 1); |
152 } | 391 anchor.title = titleText; |
153 } | 392 |
154 }, | 393 anchor.classList.toggle('webkit-html-blackbox-link', isBlackboxed); |
155 | 394 } |
156 /** | |
157 * @param {?WebInspector.Target} target | |
158 * @param {?string} scriptId | |
159 * @param {string} sourceURL | |
160 * @param {number} lineNumber | |
161 * @param {number=} columnNumber | |
162 * @param {string=} classes | |
163 * @return {?Element} | |
164 */ | |
165 maybeLinkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber
, columnNumber, classes) | |
166 { | |
167 var fallbackAnchor = sourceURL ? WebInspector.linkifyResourceAsNode(sour
ceURL, lineNumber, columnNumber, classes) : null; | |
168 if (!target || target.isDisposed()) | |
169 return fallbackAnchor; | |
170 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | |
171 if (!debuggerModel) | |
172 return fallbackAnchor; | |
173 | |
174 var rawLocation = | |
175 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, line
Number, columnNumber || 0) : null) || | |
176 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNu
mber || 0); | |
177 if (!rawLocation) | |
178 return fallbackAnchor; | |
179 | |
180 var anchor = this._createAnchor(classes); | |
181 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocat
ion(rawLocation, this._updateAnchor.bind(this, anchor), /** @type {!WebInspector
.LiveLocationPool} */(this._locationPoolByTarget.get(rawLocation.target()))); | |
182 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get(
rawLocation.target())); | |
183 anchors.push(anchor); | |
184 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; | |
185 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; | |
186 return anchor; | |
187 }, | |
188 | |
189 /** | |
190 * @param {?WebInspector.Target} target | |
191 * @param {?string} scriptId | |
192 * @param {string} sourceURL | |
193 * @param {number} lineNumber | |
194 * @param {number=} columnNumber | |
195 * @param {string=} classes | |
196 * @return {!Element} | |
197 */ | |
198 linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, col
umnNumber, classes) | |
199 { | |
200 return this.maybeLinkifyScriptLocation(target, scriptId, sourceURL, line
Number, columnNumber, classes) | |
201 || WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, columnN
umber, classes); | |
202 }, | |
203 | |
204 /** | |
205 * @param {!WebInspector.DebuggerModel.Location} rawLocation | |
206 * @param {string} fallbackUrl | |
207 * @param {string=} classes | |
208 * @return {!Element} | |
209 */ | |
210 linkifyRawLocation: function(rawLocation, fallbackUrl, classes) | |
211 { | |
212 return this.linkifyScriptLocation(rawLocation.target(), rawLocation.scri
ptId, fallbackUrl, rawLocation.lineNumber, rawLocation.columnNumber, classes); | |
213 }, | |
214 | |
215 /** | |
216 * @param {?WebInspector.Target} target | |
217 * @param {!RuntimeAgent.CallFrame} callFrame | |
218 * @param {string=} classes | |
219 * @return {?Element} | |
220 */ | |
221 maybeLinkifyConsoleCallFrame: function(target, callFrame, classes) | |
222 { | |
223 return this.maybeLinkifyScriptLocation(target, callFrame.scriptId, callF
rame.url, callFrame.lineNumber, callFrame.columnNumber, classes); | |
224 }, | |
225 | |
226 /** | |
227 * @param {!WebInspector.Target} target | |
228 * @param {!RuntimeAgent.StackTrace} stackTrace | |
229 * @param {string=} classes | |
230 * @return {!Element} | |
231 */ | |
232 linkifyStackTraceTopFrame: function(target, stackTrace, classes) | |
233 { | |
234 console.assert(stackTrace.callFrames && stackTrace.callFrames.length); | |
235 | |
236 var topFrame = stackTrace.callFrames[0]; | |
237 var fallbackAnchor = WebInspector.linkifyResourceAsNode(topFrame.url, to
pFrame.lineNumber, topFrame.columnNumber, classes); | |
238 if (target.isDisposed()) | |
239 return fallbackAnchor; | |
240 | |
241 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | |
242 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTra
ce); | |
243 if (rawLocations.length === 0) | |
244 return fallbackAnchor; | |
245 | |
246 var anchor = this._createAnchor(classes); | |
247 var liveLocation = WebInspector.debuggerWorkspaceBinding.createStackTrac
eTopFrameLiveLocation(rawLocations, this._updateAnchor.bind(this, anchor), /** @
type {!WebInspector.LiveLocationPool} */(this._locationPoolByTarget.get(target))
); | |
248 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get(
target)); | |
249 anchors.push(anchor); | |
250 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; | |
251 anchor[WebInspector.Linkifier._fallbackAnchorSymbol] = fallbackAnchor; | |
252 return anchor; | |
253 }, | |
254 | |
255 /** | |
256 * @param {!WebInspector.CSSLocation} rawLocation | |
257 * @param {string=} classes | |
258 * @return {!Element} | |
259 */ | |
260 linkifyCSSLocation: function(rawLocation, classes) | |
261 { | |
262 var anchor = this._createAnchor(classes); | |
263 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation(r
awLocation, this._updateAnchor.bind(this, anchor), /** @type {!WebInspector.Live
LocationPool} */(this._locationPoolByTarget.get(rawLocation.target()))); | |
264 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get(
rawLocation.target())); | |
265 anchors.push(anchor); | |
266 anchor[WebInspector.Linkifier._liveLocationSymbol] = liveLocation; | |
267 return anchor; | |
268 }, | |
269 | |
270 /** | |
271 * @param {!WebInspector.Target} target | |
272 * @param {!Element} anchor | |
273 */ | |
274 disposeAnchor: function(target, anchor) | |
275 { | |
276 delete anchor[WebInspector.Linkifier._uiLocationSymbol]; | |
277 delete anchor[WebInspector.Linkifier._fallbackAnchorSymbol]; | |
278 var liveLocation = anchor[WebInspector.Linkifier._liveLocationSymbol]; | |
279 if (liveLocation) | |
280 liveLocation.dispose(); | |
281 delete anchor[WebInspector.Linkifier._liveLocationSymbol]; | |
282 }, | |
283 | |
284 /** | |
285 * @param {string=} classes | |
286 * @return {!Element} | |
287 */ | |
288 _createAnchor: function(classes) | |
289 { | |
290 var anchor = createElement("a"); | |
291 anchor.className = (classes || "") + " webkit-html-resource-link"; | |
292 | |
293 /** | |
294 * @param {!Event} event | |
295 */ | |
296 function clickHandler(event) | |
297 { | |
298 var uiLocation = anchor[WebInspector.Linkifier._uiLocationSymbol]; | |
299 if (!uiLocation) | |
300 return; | |
301 | |
302 event.consume(true); | |
303 if (WebInspector.Linkifier.handleLink(uiLocation.uiSourceCode.url(),
uiLocation.lineNumber)) | |
304 return; | |
305 WebInspector.Revealer.reveal(uiLocation); | |
306 } | |
307 anchor.addEventListener("click", clickHandler, false); | |
308 return anchor; | |
309 }, | |
310 | |
311 reset: function() | |
312 { | |
313 for (var target of this._anchorsByTarget.keysArray()) { | |
314 this.targetRemoved(target); | |
315 this.targetAdded(target); | |
316 } | |
317 }, | |
318 | |
319 dispose: function() | |
320 { | |
321 for (var target of this._anchorsByTarget.keysArray()) | |
322 this.targetRemoved(target); | |
323 WebInspector.targetManager.unobserveTargets(this); | |
324 }, | |
325 | |
326 /** | |
327 * @param {!Element} anchor | |
328 * @param {!WebInspector.LiveLocation} liveLocation | |
329 */ | |
330 _updateAnchor: function(anchor, liveLocation) | |
331 { | |
332 var uiLocation = liveLocation.uiLocation(); | |
333 if (!uiLocation) | |
334 return; | |
335 anchor[WebInspector.Linkifier._uiLocationSymbol] = uiLocation; | |
336 this._formatter.formatLiveAnchor(anchor, uiLocation, liveLocation.isBlac
kboxed()); | |
337 } | |
338 }; | 395 }; |
339 | 396 |
340 /** | 397 /** |
341 * @param {!Element} anchor | 398 * @unrestricted |
342 * @return {?WebInspector.UILocation} uiLocation | 399 */ |
343 */ | 400 WebInspector.Linkifier.DefaultCSSFormatter = class extends WebInspector.Linkifie
r.DefaultFormatter { |
344 WebInspector.Linkifier.uiLocationByAnchor = function(anchor) | 401 constructor() { |
345 { | 402 super(WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs); |
346 return anchor[WebInspector.Linkifier._uiLocationSymbol]; | 403 } |
| 404 |
| 405 /** |
| 406 * @override |
| 407 * @param {!Element} anchor |
| 408 * @param {!WebInspector.UILocation} uiLocation |
| 409 * @param {boolean} isBlackboxed |
| 410 */ |
| 411 formatLiveAnchor(anchor, uiLocation, isBlackboxed) { |
| 412 super.formatLiveAnchor(anchor, uiLocation, isBlackboxed); |
| 413 anchor.classList.add('webkit-html-resource-link'); |
| 414 anchor.setAttribute('data-uncopyable', anchor.textContent); |
| 415 anchor.textContent = ''; |
| 416 } |
347 }; | 417 }; |
348 | 418 |
349 /** | |
350 * @constructor | |
351 * @implements {WebInspector.LinkifierFormatter} | |
352 * @param {number=} maxLength | |
353 */ | |
354 WebInspector.Linkifier.DefaultFormatter = function(maxLength) | |
355 { | |
356 this._maxLength = maxLength; | |
357 }; | |
358 | |
359 WebInspector.Linkifier.DefaultFormatter.prototype = { | |
360 /** | |
361 * @override | |
362 * @param {!Element} anchor | |
363 * @param {!WebInspector.UILocation} uiLocation | |
364 * @param {boolean} isBlackboxed | |
365 */ | |
366 formatLiveAnchor: function(anchor, uiLocation, isBlackboxed) | |
367 { | |
368 var text = uiLocation.linkText(); | |
369 text = text.replace(/([a-f0-9]{7})[a-f0-9]{13}[a-f0-9]*/g, "$1\u2026"); | |
370 if (this._maxLength) | |
371 text = text.trimMiddle(this._maxLength); | |
372 anchor.textContent = text; | |
373 | |
374 var titleText = uiLocation.uiSourceCode.url(); | |
375 if (typeof uiLocation.lineNumber === "number") | |
376 titleText += ":" + (uiLocation.lineNumber + 1); | |
377 anchor.title = titleText; | |
378 | |
379 anchor.classList.toggle("webkit-html-blackbox-link", isBlackboxed); | |
380 } | |
381 }; | |
382 | |
383 /** | |
384 * @constructor | |
385 * @extends {WebInspector.Linkifier.DefaultFormatter} | |
386 */ | |
387 WebInspector.Linkifier.DefaultCSSFormatter = function() | |
388 { | |
389 WebInspector.Linkifier.DefaultFormatter.call(this, WebInspector.Linkifier.De
faultCSSFormatter.MaxLengthForDisplayedURLs); | |
390 }; | |
391 | |
392 WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs = 30; | 419 WebInspector.Linkifier.DefaultCSSFormatter.MaxLengthForDisplayedURLs = 30; |
393 | 420 |
394 WebInspector.Linkifier.DefaultCSSFormatter.prototype = { | |
395 /** | |
396 * @override | |
397 * @param {!Element} anchor | |
398 * @param {!WebInspector.UILocation} uiLocation | |
399 * @param {boolean} isBlackboxed | |
400 */ | |
401 formatLiveAnchor: function(anchor, uiLocation, isBlackboxed) | |
402 { | |
403 WebInspector.Linkifier.DefaultFormatter.prototype.formatLiveAnchor.call(
this, anchor, uiLocation, isBlackboxed); | |
404 anchor.classList.add("webkit-html-resource-link"); | |
405 anchor.setAttribute("data-uncopyable", anchor.textContent); | |
406 anchor.textContent = ""; | |
407 }, | |
408 __proto__: WebInspector.Linkifier.DefaultFormatter.prototype | |
409 }; | |
410 | |
411 /** | 421 /** |
412 * The maximum number of characters to display in a URL. | 422 * The maximum number of characters to display in a URL. |
413 * @const | 423 * @const |
414 * @type {number} | 424 * @type {number} |
415 */ | 425 */ |
416 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150; | 426 WebInspector.Linkifier.MaxLengthForDisplayedURLs = 150; |
417 | 427 |
418 /** | 428 /** |
419 * The maximum length before strings are considered too long for finding URLs. | 429 * The maximum length before strings are considered too long for finding URLs. |
420 * @const | 430 * @const |
421 * @type {number} | 431 * @type {number} |
422 */ | 432 */ |
423 WebInspector.Linkifier.MaxLengthToIgnoreLinkifier = 10000; | 433 WebInspector.Linkifier.MaxLengthToIgnoreLinkifier = 10000; |
424 | 434 |
425 /** | 435 /** |
426 * @interface | 436 * @interface |
427 */ | 437 */ |
428 WebInspector.Linkifier.LinkHandler = function() | 438 WebInspector.Linkifier.LinkHandler = function() {}; |
429 { | 439 |
| 440 WebInspector.Linkifier.LinkHandler.prototype = { |
| 441 /** |
| 442 * @param {string} url |
| 443 * @param {number=} lineNumber |
| 444 * @return {boolean} |
| 445 */ |
| 446 handleLink: function(url, lineNumber) {} |
430 }; | 447 }; |
431 | 448 |
432 WebInspector.Linkifier.LinkHandler.prototype = { | |
433 /** | |
434 * @param {string} url | |
435 * @param {number=} lineNumber | |
436 * @return {boolean} | |
437 */ | |
438 handleLink: function(url, lineNumber) {} | |
439 }; | |
440 | |
441 /** | |
442 * @param {!WebInspector.Target} target | |
443 * @param {string} scriptId | |
444 * @param {number} lineNumber | |
445 * @param {number=} columnNumber | |
446 * @return {string} | |
447 */ | |
448 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber,
columnNumber) | |
449 { | |
450 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | |
451 if (!debuggerModel) | |
452 return ""; | |
453 var script = debuggerModel.scriptForId(scriptId); | |
454 if (!script) | |
455 return ""; | |
456 var location = /** @type {!WebInspector.DebuggerModel.Location} */ (debugger
Model.createRawLocation(script, lineNumber, columnNumber || 0)); | |
457 var uiLocation = /** @type {!WebInspector.UILocation} */ (WebInspector.debug
gerWorkspaceBinding.rawLocationToUILocation(location)); | |
458 return uiLocation.linkText(); | |
459 }; | |
460 | 449 |
461 /** | 450 /** |
462 * @param {string} string | 451 * @param {string} string |
463 * @param {function(string,string,number=,number=):!Node} linkifier | 452 * @param {function(string,string,number=,number=):!Node} linkifier |
464 * @return {!DocumentFragment} | 453 * @return {!DocumentFragment} |
465 */ | 454 */ |
466 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
fier) | 455 WebInspector.linkifyStringAsFragmentWithCustomLinkifier = function(string, linki
fier) { |
467 { | 456 var container = createDocumentFragment(); |
468 var container = createDocumentFragment(); | 457 var linkStringRegEx = |
469 var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-
_+*'=\|\/\\(){}[\]^%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; | 458 /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|data:|www\.)[\w$\-_+*'=\|\/\\(){}[\]^%
@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({^%@&#~]/; |
470 var pathLineRegex = /(?:\/[\/\w\.-]+)+\:[\d]+/; | 459 var pathLineRegex = /(?:\/[\/\w\.-]+)+\:[\d]+/; |
471 | 460 |
472 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLin
kifier) { | 461 while (string && string.length < WebInspector.Linkifier.MaxLengthToIgnoreLinki
fier) { |
473 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(stri
ng); | 462 var linkString = linkStringRegEx.exec(string) || pathLineRegex.exec(string); |
474 if (!linkString) | 463 if (!linkString) |
475 break; | 464 break; |
476 | 465 |
477 linkString = linkString[0]; | 466 linkString = linkString[0]; |
478 var linkIndex = string.indexOf(linkString); | 467 var linkIndex = string.indexOf(linkString); |
479 var nonLink = string.substring(0, linkIndex); | 468 var nonLink = string.substring(0, linkIndex); |
480 container.appendChild(createTextNode(nonLink)); | 469 container.appendChild(createTextNode(nonLink)); |
481 | 470 |
482 var title = linkString; | 471 var title = linkString; |
483 var realURL = (linkString.startsWith("www.") ? "http://" + linkString :
linkString); | 472 var realURL = (linkString.startsWith('www.') ? 'http://' + linkString : link
String); |
484 var splitResult = WebInspector.ParsedURL.splitLineAndColumn(realURL); | 473 var splitResult = WebInspector.ParsedURL.splitLineAndColumn(realURL); |
485 var linkNode; | 474 var linkNode; |
486 if (splitResult) | 475 if (splitResult) |
487 linkNode = linkifier(title, splitResult.url, splitResult.lineNumber,
splitResult.columnNumber); | 476 linkNode = linkifier(title, splitResult.url, splitResult.lineNumber, split
Result.columnNumber); |
488 else | 477 else |
489 linkNode = linkifier(title, realURL); | 478 linkNode = linkifier(title, realURL); |
490 | 479 |
491 container.appendChild(linkNode); | 480 container.appendChild(linkNode); |
492 string = string.substring(linkIndex + linkString.length, string.length); | 481 string = string.substring(linkIndex + linkString.length, string.length); |
493 } | 482 } |
494 | 483 |
495 if (string) | 484 if (string) |
496 container.appendChild(createTextNode(string)); | 485 container.appendChild(createTextNode(string)); |
497 | 486 |
498 return container; | 487 return container; |
499 }; | 488 }; |
500 | 489 |
501 /** | 490 /** |
502 * @param {string} string | 491 * @param {string} string |
503 * @return {!DocumentFragment} | 492 * @return {!DocumentFragment} |
504 */ | 493 */ |
505 WebInspector.linkifyStringAsFragment = function(string) | 494 WebInspector.linkifyStringAsFragment = function(string) { |
506 { | 495 /** |
507 /** | 496 * @param {string} title |
508 * @param {string} title | 497 * @param {string} url |
509 * @param {string} url | 498 * @param {number=} lineNumber |
510 * @param {number=} lineNumber | 499 * @param {number=} columnNumber |
511 * @param {number=} columnNumber | 500 * @return {!Node} |
512 * @return {!Node} | 501 */ |
513 */ | 502 function linkifier(title, url, lineNumber, columnNumber) { |
514 function linkifier(title, url, lineNumber, columnNumber) | 503 var isExternal = |
515 { | 504 !WebInspector.resourceForURL(url) && !WebInspector.networkMapping.uiSour
ceCodeForURLForAnyTarget(url); |
516 var isExternal = !WebInspector.resourceForURL(url) && !WebInspector.netw
orkMapping.uiSourceCodeForURLForAnyTarget(url); | 505 var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined, isExterna
l); |
517 var urlNode = WebInspector.linkifyURLAsNode(url, title, undefined, isExt
ernal); | 506 if (typeof lineNumber !== 'undefined') { |
518 if (typeof lineNumber !== "undefined") { | 507 urlNode.lineNumber = lineNumber; |
519 urlNode.lineNumber = lineNumber; | 508 if (typeof columnNumber !== 'undefined') |
520 if (typeof columnNumber !== "undefined") | 509 urlNode.columnNumber = columnNumber; |
521 urlNode.columnNumber = columnNumber; | |
522 } | |
523 | |
524 return urlNode; | |
525 } | 510 } |
526 | 511 |
527 return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string, linki
fier); | 512 return urlNode; |
| 513 } |
| 514 |
| 515 return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string, linkifi
er); |
528 }; | 516 }; |
529 | 517 |
530 /** | 518 /** |
531 * @param {string} url | 519 * @param {string} url |
532 * @param {number=} lineNumber | 520 * @param {number=} lineNumber |
533 * @param {number=} columnNumber | 521 * @param {number=} columnNumber |
534 * @param {string=} classes | 522 * @param {string=} classes |
535 * @param {string=} tooltipText | 523 * @param {string=} tooltipText |
536 * @param {string=} urlDisplayName | 524 * @param {string=} urlDisplayName |
537 * @return {!Element} | 525 * @return {!Element} |
538 */ | 526 */ |
539 WebInspector.linkifyResourceAsNode = function(url, lineNumber, columnNumber, cla
sses, tooltipText, urlDisplayName) | 527 WebInspector.linkifyResourceAsNode = function(url, lineNumber, columnNumber, cla
sses, tooltipText, urlDisplayName) { |
540 { | 528 if (!url) { |
541 if (!url) { | 529 var element = createElementWithClass('span', classes); |
542 var element = createElementWithClass("span", classes); | 530 element.textContent = urlDisplayName || WebInspector.UIString('(unknown)'); |
543 element.textContent = urlDisplayName || WebInspector.UIString("(unknown)
"); | 531 return element; |
544 return element; | 532 } |
545 } | 533 var linkText = urlDisplayName || WebInspector.displayNameForURL(url); |
546 var linkText = urlDisplayName || WebInspector.displayNameForURL(url); | 534 if (typeof lineNumber === 'number') |
547 if (typeof lineNumber === "number") | 535 linkText += ':' + (lineNumber + 1); |
548 linkText += ":" + (lineNumber + 1); | 536 var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tool
tipText); |
549 var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, to
oltipText); | 537 anchor.lineNumber = lineNumber; |
550 anchor.lineNumber = lineNumber; | 538 anchor.columnNumber = columnNumber; |
551 anchor.columnNumber = columnNumber; | 539 return anchor; |
552 return anchor; | |
553 }; | 540 }; |
554 | 541 |
555 /** | 542 /** |
556 * @param {!WebInspector.NetworkRequest} request | 543 * @param {!WebInspector.NetworkRequest} request |
557 * @return {!Element} | 544 * @return {!Element} |
558 */ | 545 */ |
559 WebInspector.linkifyRequestAsNode = function(request) | 546 WebInspector.linkifyRequestAsNode = function(request) { |
560 { | 547 var anchor = WebInspector.linkifyURLAsNode(request.url); |
561 var anchor = WebInspector.linkifyURLAsNode(request.url); | 548 anchor.requestId = request.requestId; |
562 anchor.requestId = request.requestId; | 549 return anchor; |
563 return anchor; | |
564 }; | 550 }; |
OLD | NEW |