Changeset 193001 in webkit
- Timestamp:
- Dec 3, 2015, 10:29:28 AM (10 years ago)
- Location:
- branches/safari-601-branch/Source/WebInspectorUI
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-601-branch/Source/WebInspectorUI/ChangeLog
r192523 r193001 1 2015-12-01 Timothy Hatcher <timothy@apple.com> 2 3 Merge r186695. rdar://problem/23221163 4 5 2015-07-10 Devin Rousso <drousso@apple.com> 6 7 Web Inspector: Add source links to functions logged in the console 8 https://bugs.webkit.org/show_bug.cgi?id=146377 9 10 Reviewed by Timothy Hatcher. 11 12 * UserInterface/Protocol/RemoteObject.js: 13 (WebInspector.RemoteObject.prototype.findFunctionSourceCodeLocation): 14 Returns a promise that contains the sourceCodeLocation if the object represents a function and has an objectId. 15 (WebInspector.RemoteObject.prototype._isFunction): 16 * UserInterface/Views/ConsoleMessageView.css: 17 (.console-message .console-message-location): 18 Added specified values for font sizing and family to ensure that all location links have the same styling. 19 * UserInterface/Views/ConsoleMessageView.js: 20 (WebInspector.ConsoleMessageView): 21 Now creates a link to the source code of the entered text if the message is of the type "result". 22 (WebInspector.ConsoleMessageView.prototype._appendLocationLink): 23 (WebInspector.ConsoleMessageView.prototype._createRemoteObjectIfNeeded): 24 (WebInspector.ConsoleMessageView.prototype._appendFormattedArguments): 25 (WebInspector.ConsoleMessageView.prototype._linkifyLocation): 26 (WebInspector.ConsoleMessageView.prototype._linkifyCallFrameLocation): 27 (WebInspector.ConsoleMessageView.prototype._linkifyCallFrame): 28 1 29 2015-11-17 Babak Shafiei <bshafiei@apple.com> 2 30 -
branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js
r185638 r193001 479 479 } 480 480 481 findFunctionSourceCodeLocation() 482 { 483 var result = new WebInspector.WrappedPromise; 484 485 if (!this._isFunction() || !this._objectId) { 486 result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId); 487 return result.promise; 488 } 489 490 DebuggerAgent.getFunctionDetails(this._objectId, function(error, response) { 491 if (error) { 492 result.reject(error); 493 return; 494 } 495 496 var location = response.location; 497 var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(location.scriptId); 498 499 if (!sourceCode || sourceCode.url.startsWith("__WebInspector")) { 500 result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound); 501 return; 502 } 503 504 var sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0); 505 result.resolve(sourceCodeLocation); 506 }); 507 508 return result.promise; 509 } 510 481 511 // Private 482 512 … … 484 514 { 485 515 return this._type === "symbol"; 516 } 517 518 _isFunction() 519 { 520 return this._type === "function"; 486 521 } 487 522 … … 565 600 }; 566 601 602 WebInspector.RemoteObject.SourceCodeLocationPromise = { 603 NoSourceFound: "remote-object-source-code-location-promise-no-source-found", 604 MissingObjectId: "remote-object-source-code-location-promise-missing-object-id" 605 } 606 567 607 // FIXME: Phase out this deprecated class. 568 608 WebInspector.DeprecatedRemoteObjectProperty = class DeprecatedRemoteObjectProperty -
branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.css
r186634 r193001 231 231 .console-message .console-message-location { 232 232 float: right; 233 font-family: -webkit-system-font, sans-serif; 234 font-size: 12px; 233 235 font-weight: normal; 236 -webkit-user-select: text; 234 237 } 235 238 -
branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js
r190742 r193001 319 319 } 320 320 321 if (!callFrame) 322 return; 323 324 var locationElement = new WebInspector.CallFrameView(callFrame); 325 locationElement.classList.add("console-message-location"); 326 this._element.appendChild(locationElement); 321 if (callFrame) { 322 var locationElement = new WebInspector.CallFrameView(callFrame); 323 locationElement.classList.add("console-message-location"); 324 this._element.appendChild(locationElement); 325 326 return; 327 } 328 329 if (this._message.parameters.length === 1) { 330 var parameter = this._createRemoteObjectIfNeeded(this._message.parameters[0]); 331 332 parameter.findFunctionSourceCodeLocation().then(function(result) { 333 if (result === WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound || result === WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId) 334 return; 335 336 var link = this._linkifyLocation(result.sourceCode.url, result.lineNumber, result.columnNumber); 337 link.classList.add("console-message-location"); 338 339 if (this._element.hasChildNodes()) 340 this._element.insertBefore(link, this._element.firstChild); 341 else 342 this._element.appendChild(link); 343 }.bind(this)); 344 } 327 345 } 328 346 … … 374 392 } 375 393 394 _createRemoteObjectIfNeeded(parameter) 395 { 396 // FIXME: Only pass RemoteObjects here so we can avoid this work. 397 if (parameter instanceof WebInspector.RemoteObject) 398 return parameter; 399 400 if (typeof parameter === "object") 401 return WebInspector.RemoteObject.fromPayload(parameter); 402 403 return WebInspector.RemoteObject.fromPrimitiveValue(parameter); 404 } 405 376 406 _appendFormattedArguments(element, parameters) 377 407 { … … 379 409 return; 380 410 381 // FIXME: Only pass RemoteObjects here so we can avoid this work. 382 for (var i = 0; i < parameters.length; ++i) { 383 if (parameters[i] instanceof WebInspector.RemoteObject) 384 continue; 385 386 if (typeof parameters[i] === "object") 387 parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]); 388 else 389 parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]); 390 } 411 for (var i = 0; i < parameters.length; ++i) 412 parameters[i] = this._createRemoteObjectIfNeeded(parameters[i]); 391 413 392 414 var builderElement = element.appendChild(document.createElement("span")); … … 624 646 _linkifyLocation(url, lineNumber, columnNumber) 625 647 { 648 return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url"); 649 } 650 651 _linkifyCallFrameLocation(url, lineNumber, columnNumber) 652 { 626 653 // ConsoleMessage stack trace line numbers are one-based. 627 654 lineNumber = lineNumber ? lineNumber - 1 : 0; 628 655 columnNumber = columnNumber ? columnNumber - 1 : 0; 629 return WebInspector.linkifyLocation(url, lineNumber, columnNumber, "console-message-url");656 return this._linkifyLocation(url, lineNumber, columnNumber); 630 657 } 631 658 … … 643 670 } 644 671 645 return this._linkify Location(url, lineNumber, columnNumber);672 return this._linkifyCallFrameLocation(url, lineNumber, columnNumber); 646 673 } 647 674
Note:
See TracChangeset
for help on using the changeset viewer.