Changeset 89415 in webkit
- Timestamp:
- Jun 22, 2011 2:35:35 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r89407 r89415 1 2011-06-17 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: use stack trace to create anchors for console messages. 6 https://bugs.webkit.org/show_bug.cgi?id=62856 7 8 * inspector/front-end/ConsoleView.js: 9 (WebInspector.ConsoleView.prototype._completions.reportCompletions): 10 (WebInspector.ConsoleView.prototype._completions): 11 (WebInspector.ConsoleMessage.prototype._formatMessage): 12 * inspector/front-end/DebuggerPresentationModel.js: 13 (WebInspector.DebuggerPresentationModel.prototype._updateAnchor): 14 * inspector/front-end/Panel.js: 15 (WebInspector.Panel.prototype.createAnchor): 16 * inspector/front-end/ScriptsPanel.js: 17 (WebInspector.ScriptsPanel.prototype.createAnchor): 18 (WebInspector.ScriptsPanel.prototype.showAnchorLocation): 19 (WebInspector.ScriptsPanel.prototype._updateAnchor): 20 * inspector/front-end/inspector.js: 21 (WebInspector.linkifyResourceAsNode): 22 (WebInspector.linkifyCallFrameAsNode): 23 1 24 2011-06-21 Kent Tamura <tkent@chromium.org> 2 25 -
trunk/Source/WebCore/inspector/front-end/ConsoleView.js
r88815 r89415 399 399 propertyNames[commandLineAPI[i]] = true; 400 400 } 401 401 402 402 this._reportCompletions(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, Object.keys(propertyNames)); 403 403 } … … 784 784 this._formattedMessage.className = "console-message-text source-code"; 785 785 786 if (this.url && this.url !== "undefined") { 786 if (this._stackTrace && this._stackTrace.length && this._stackTrace[0].url) { 787 var urlElement = WebInspector.linkifyCallFrameAsNode(this._stackTrace[0], "console-message-url"); 788 this._formattedMessage.appendChild(urlElement); 789 } else if (this.url && this.url !== "undefined") { 787 790 var urlElement = WebInspector.linkifyResourceAsNode(this.url, "scripts", this.line, "console-message-url"); 788 791 this._formattedMessage.appendChild(urlElement); -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r89350 r89415 116 116 return; 117 117 118 function didGetUILocation(sourceFileId, lineNumber) 119 { 120 anchor.updateHandler(sourceFile.url, lineNumber); 121 } 122 this.scriptLocationToUILocation(anchor.sourceURL, anchor.sourceId, anchor.lineNumber, anchor.columnNumber, didGetUILocation); 118 this.scriptLocationToUILocation(anchor.sourceURL, anchor.sourceId, anchor.lineNumber, anchor.columnNumber, anchor.updateHandler); 123 119 }, 124 120 -
trunk/Source/WebCore/inspector/front-end/Panel.js
r88927 r89415 389 389 }, 390 390 391 createAnchor: function(url, lineNumber, c lasses, tooltipText)391 createAnchor: function(url, lineNumber, columnNumber, classes, tooltipText) 392 392 { 393 393 var linkText = this.formatAnchorText(url, lineNumber); 394 394 var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText); 395 anchor.setAttribute("preferred_panel", "resources"); 395 396 if (lineNumber !== undefined) 396 397 anchor.setAttribute("line_number", lineNumber); -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r89386 r89415 521 521 }, 522 522 523 createAnchor: function(url, lineNumber, classes, tooltipText) 524 { 525 var anchor = WebInspector.Panel.prototype.createAnchor.call(this, url, lineNumber, classes, tooltipText); 526 if (lineNumber !== undefined) { 527 function updateAnchor(url, lineNumber) 528 { 529 anchor.textContent = this.formatAnchorText(url, lineNumber) 530 } 531 this._presentationModel.registerAnchor(url, null, lineNumber, 0, updateAnchor.bind(this)); 532 } 523 createAnchor: function(url, lineNumber, columnNumber, classes, tooltipText) 524 { 525 var anchor = WebInspector.Panel.prototype.createAnchor.call(this, url, lineNumber, columnNumber, classes, tooltipText); 526 if (lineNumber !== undefined) 527 this._presentationModel.registerAnchor(url, null, lineNumber, columnNumber, this._updateAnchor.bind(this, anchor)); 533 528 return anchor; 534 529 }, … … 541 536 showAnchorLocation: function(anchor) 542 537 { 543 var anchorLineNumber = anchor.hasAttribute("line_number") ? parseInt(anchor.getAttribute("line_number")) : 0; 544 545 function didGetUILocation(sourceFileId, lineNumber) 546 { 547 if (anchor.hasAttribute("line_number")) 548 this._showSourceLine(sourceFileId, lineNumber); 549 else 550 this._showSourceFrameAndAddToHistory(sourceFileId); 551 } 552 this._presentationModel.scriptLocationToUILocation(anchor.href, null, anchorLineNumber, 0, didGetUILocation.bind(this)); 538 this._showSourceLine(anchor.getAttribute("source_file_id"), parseInt(anchor.getAttribute("line_number"))); 539 }, 540 541 _updateAnchor: function(anchor, sourceFileId, lineNumber) 542 { 543 var sourceFile = this._presentationModel.sourceFile(sourceFileId); 544 var url = sourceFile.url || WebInspector.UIString("(program)"); 545 anchor.textContent = this.formatAnchorText(url, lineNumber) 546 // Used for showing anchor location. 547 anchor.setAttribute("preferred_panel", "scripts"); 548 anchor.setAttribute("source_file_id", sourceFileId); 549 anchor.setAttribute("line_number", lineNumber); 553 550 }, 554 551 -
trunk/Source/WebCore/inspector/front-end/inspector.js
r89348 r89415 1284 1284 // FIXME(62725): stack trace line/column numbers are one-based. 1285 1285 var lineNumber = oneBasedLineNumber ? oneBasedLineNumber - 1 : undefined; 1286 var node = this.panels[preferredPanel].createAnchor(url, lineNumber, classes, tooltipText); 1287 node.setAttribute("preferred_panel", preferredPanel); 1288 return node; 1286 return this.panels[preferredPanel].createAnchor(url, lineNumber, 0, classes, tooltipText); 1287 } 1288 1289 WebInspector.linkifyCallFrameAsNode = function(callFrame, classes, tooltipText) 1290 { 1291 // FIXME(62725): stack trace line/column numbers are one-based. 1292 var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0; 1293 return this.panels.scripts.createAnchor(callFrame.url, callFrame.lineNumber - 1, columnNumber, classes, tooltipText); 1289 1294 } 1290 1295
Note: See TracChangeset
for help on using the changeset viewer.