Changeset 88927 in webkit
- Timestamp:
- Jun 15, 2011 7:30:22 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88924 r88927 1 2011-06-15 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: script links are displayed with original line number in pretty-print mode. 6 https://bugs.webkit.org/show_bug.cgi?id=62282 7 8 * inspector/debugger/script-formatter-expected.txt: 9 * inspector/debugger/script-formatter.html: 10 1 11 2011-06-15 Kent Tamura <tkent@chromium.org> 2 12 -
trunk/LayoutTests/inspector/debugger/script-formatter-expected.txt
r85321 r88927 1 CONSOLE MESSAGE: line 24: Test message. 1 2 Tests the script formatting functionality. 2 3 … … 31 32 1) (script-formatter.html:1) 32 33 Script execution resumed. 34 35 Running: testConsoleMessagesForFormattedScripts 36 script-formatter.html:24 37 script-formatter.html:32 33 38 Debugger was disabled. 34 39 -
trunk/LayoutTests/inspector/debugger/script-formatter.html
r87071 r88927 18 18 var x = 0; 19 19 return 0; 20 } 21 22 function f3() 23 { 24 console.log("Test message."); 20 25 } 21 26 … … 152 157 // There should be no breakpoint in f1 since script is pretty-printed now. 153 158 InspectorTest.evaluateInPageWithTimeout("f1()"); 154 155 159 InspectorTest.setBreakpoint(panel.visibleView, 24, "", true); 156 160 InspectorTest.waitUntilPaused(pausedInF2); … … 161 165 { 162 166 InspectorTest.captureStackTrace(callFrames); 167 panel._toggleFormatSourceFiles(); 168 InspectorTest.resumeExecution(next); 169 } 170 }, 171 172 function testConsoleMessagesForFormattedScripts(next) 173 { 174 function dumpConsoleMessageURLs() 175 { 176 var messages = WebInspector.console.messages; 177 for (var i = 0; i < messages.length; ++i) { 178 var element = messages[i].toMessageElement(); 179 var anchor = element.query("//*//a[contains(@class, 'console-message-url')]"); 180 InspectorTest.addResult(anchor.textContent); 181 } 182 } 183 InspectorTest.evaluateInPage("f3()", didEvaluate); 184 185 function didEvaluate() 186 { 187 dumpConsoleMessageURLs(); 188 InspectorTest.addSniffer(panel, "formatAnchorText", InspectorTest.runAfterPendingDispatches.bind(InspectorTest, didFormatAnchorText)); 189 panel._toggleFormatSourceFiles(); 190 } 191 192 function didFormatAnchorText() 193 { 194 dumpConsoleMessageURLs(); 163 195 next(); 164 196 } -
trunk/Source/WebCore/ChangeLog
r88925 r88927 1 2011-06-15 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: script links are displayed with original line number in pretty-print mode. 6 https://bugs.webkit.org/show_bug.cgi?id=62282 7 8 * inspector/front-end/DebuggerPresentationModel.js: 9 (WebInspector.DebuggerPresentationModel): 10 (WebInspector.DebuggerPresentationModel.prototype.registerAnchor): 11 (WebInspector.DebuggerPresentationModel.prototype._updateAnchor.didGetUILocation): 12 (WebInspector.DebuggerPresentationModel.prototype._updateAnchor): 13 (WebInspector.DebuggerPresentationModel.prototype.setFormatSourceFiles): 14 (WebInspector.DebuggerPresentationModel.prototype._debuggerReset): 15 * inspector/front-end/NetworkPanel.js: 16 (WebInspector.NetworkPanel.prototype.showAnchorLocation): 17 (WebInspector.NetworkPanel.prototype._showResource): 18 * inspector/front-end/Panel.js: 19 (WebInspector.Panel.prototype.createAnchor): 20 (WebInspector.Panel.prototype.formatAnchorText): 21 * inspector/front-end/ResourcesPanel.js: 22 (WebInspector.ResourcesPanel.prototype.showAnchorLocation): 23 * inspector/front-end/ScriptsPanel.js: 24 (WebInspector.ScriptsPanel.prototype.createAnchor.): 25 (WebInspector.ScriptsPanel.prototype.createAnchor): 26 (WebInspector.ScriptsPanel.prototype.showAnchorLocation.didGetUILocation): 27 (WebInspector.ScriptsPanel.prototype.showAnchorLocation): 28 * inspector/front-end/inspector.js: 29 (WebInspector._showAnchorLocation): 30 (WebInspector.linkifyResourceAsNode): 31 1 32 2011-06-14 Hans Wennborg <hans@chromium.org> 2 33 -
trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
r88344 r88927 33 33 this._sourceFiles = {}; 34 34 this._messages = []; 35 this._anchors = []; 35 36 this._breakpointsByDebuggerId = {}; 36 37 this._breakpointsWithoutSourceFile = {}; … … 100 101 { 101 102 this._sourceFiles[sourceFileId].requestContent(callback); 103 }, 104 105 registerAnchor: function(sourceURL, sourceId, lineNumber, columnNumber, updateHandler) 106 { 107 var anchor = { sourceURL: sourceURL, sourceId: sourceId, lineNumber: lineNumber, columnNumber: columnNumber, updateHandler: updateHandler }; 108 this._anchors.push(anchor); 109 this._updateAnchor(anchor); 110 }, 111 112 _updateAnchor: function(anchor) 113 { 114 var sourceFile = this._sourceFileForScript(anchor.sourceURL, anchor.sourceId); 115 if (!sourceFile) 116 return; 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); 102 123 }, 103 124 … … 247 268 this._addConsoleMessage(messages[i]); 248 269 270 for (var i = 0; i < this._anchors.length; ++i) 271 this._updateAnchor(this._anchors[i]); 272 249 273 if (WebInspector.debuggerModel.callFrames) 250 274 this._debuggerPaused(); … … 616 640 { 617 641 this._reset(); 642 this._anchors = []; 618 643 this._presentationCallFrames = []; 619 644 this._selectedCallFrameIndex = 0; -
trunk/Source/WebCore/inspector/front-end/NetworkPanel.js
r88705 r88927 804 804 showAnchorLocation: function(anchor) 805 805 { 806 this._showResource(this._resourcesByURL[anchor.href] , anchor.getAttribute("line_number") - 1);807 }, 808 809 _showResource: function(resource , line)806 this._showResource(this._resourcesByURL[anchor.href]); 807 }, 808 809 _showResource: function(resource) 810 810 { 811 811 if (!resource) -
trunk/Source/WebCore/inspector/front-end/Panel.js
r88805 r88927 389 389 }, 390 390 391 createAnchor: function(url, lineNumber, classes, tooltipText) 392 { 393 var linkText = this.formatAnchorText(url, lineNumber); 394 var anchor = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText); 395 if (lineNumber !== undefined) 396 anchor.setAttribute("line_number", lineNumber); 397 return anchor; 398 }, 399 400 formatAnchorText: function(url, lineNumber) 401 { 402 var text = WebInspector.displayNameForURL(url); 403 if (lineNumber !== undefined) 404 text += ":" + (lineNumber + 1); 405 return text; 406 }, 407 391 408 canShowAnchorLocation: function(anchor) 392 409 { -
trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js
r87681 r88927 351 351 return; 352 352 } 353 var lineNumber = parseInt(anchor.getAttribute("line_number"));354 this.showResource(resource, lineNumber !== NaN ? lineNumber - 1 : undefined);353 var lineNumber = anchor.hasAttribute("line_number") ? parseInt(anchor.getAttribute("line_number")) : undefined; 354 this.showResource(resource, lineNumber); 355 355 }, 356 356 -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r88916 r88927 522 522 }, 523 523 524 createAnchor: function(url, lineNumber, classes, tooltipText) 525 { 526 var anchor = WebInspector.Panel.prototype.createAnchor.call(this, url, lineNumber, classes, tooltipText); 527 if (lineNumber !== undefined) { 528 function updateAnchor(url, lineNumber) 529 { 530 anchor.textContent = this.formatAnchorText(url, lineNumber) 531 } 532 this._presentationModel.registerAnchor(url, null, lineNumber, 0, updateAnchor.bind(this)); 533 } 534 return anchor; 535 }, 536 524 537 canShowAnchorLocation: function(anchor) 525 538 { … … 529 542 showAnchorLocation: function(anchor) 530 543 { 531 var anchorLineNumber = parseInt(anchor.getAttribute("line_number")); 532 var hasAnchorLineNumber = anchorLineNumber !== NaN; 533 var lineNumber = hasAnchorLineNumber ? anchorLineNumber - 1 : 0; 544 var anchorLineNumber = anchor.hasAttribute("line_number") ? parseInt(anchor.getAttribute("line_number")) : 0; 534 545 535 546 function didGetUILocation(sourceFileId, lineNumber) 536 547 { 537 if ( hasAnchorLineNumber)548 if (anchor.hasAttribute("line_number")) 538 549 this._showSourceLine(sourceFileId, lineNumber); 539 550 else 540 551 this._showSourceFrameAndAddToHistory(sourceFileId); 541 552 } 542 this._presentationModel.scriptLocationToUILocation(anchor.href, null, lineNumber, 0, didGetUILocation.bind(this));553 this._presentationModel.scriptLocationToUILocation(anchor.href, null, anchorLineNumber, 0, didGetUILocation.bind(this)); 543 554 }, 544 555 -
trunk/Source/WebCore/inspector/front-end/inspector.js
r88920 r88927 1173 1173 WebInspector._showAnchorLocation = function(anchor) 1174 1174 { 1175 var preferedPanel = this.panels[anchor.getAttribute("preferred_panel") || "scripts"];1175 var preferedPanel = this.panels[anchor.getAttribute("preferred_panel")]; 1176 1176 if (WebInspector._showAnchorLocationInPanel(anchor, preferedPanel)) 1177 1177 return true; … … 1276 1276 } 1277 1277 1278 WebInspector.linkifyResourceAsNode = function(url, preferredPanel, lineNumber, classes, tooltipText) 1279 { 1280 var linkText = WebInspector.displayNameForURL(url); 1281 if (lineNumber) 1282 linkText += ":" + lineNumber; 1283 var node = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText); 1284 node.setAttribute("line_number", lineNumber); 1278 WebInspector.linkifyResourceAsNode = function(url, preferredPanel, oneBasedLineNumber, classes, tooltipText) 1279 { 1280 preferredPanel = preferredPanel || "scripts"; 1281 // FIXME(62725): stack trace line/column numbers are one-based. 1282 var lineNumber = oneBasedLineNumber ? oneBasedLineNumber - 1 : undefined; 1283 var node = this.panels[preferredPanel].createAnchor(url, lineNumber, classes, tooltipText); 1285 1284 node.setAttribute("preferred_panel", preferredPanel); 1286 1285 return node;
Note: See TracChangeset
for help on using the changeset viewer.