Changeset 87071 in webkit
- Timestamp:
- May 23, 2011 6:41:24 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87070 r87071 1 2011-05-18 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: source mapping for pretty-printed scripts is sometimes inaccurate after indented comments. 6 https://bugs.webkit.org/show_bug.cgi?id=61037 7 8 * http/tests/inspector/inspector-test.js: 9 (initialize_InspectorTest): 10 * inspector/debugger/resources/obfuscated.js: 11 (withComments): 12 * inspector/debugger/script-formatter.html: 13 1 14 2011-05-23 Mike West <mkwst@chromium.org> 2 15 -
trunk/LayoutTests/http/tests/inspector/inspector-test.js
r86959 r87071 236 236 } 237 237 238 InspectorTest.assertTrue = function(found, message) 239 { 240 InspectorTest.assertEquals(true, !!found); 241 } 242 238 243 InspectorTest.safeWrap = function(func, onexception) 239 244 { -
trunk/LayoutTests/inspector/debugger/resources/obfuscated.js
r86443 r87071 2 2 { 3 3 var variable1 = 0; 4 } 5 6 function withComments() 7 { 8 // comment 9 return "functionWithComments"; 4 10 } 5 11 -
trunk/LayoutTests/inspector/debugger/script-formatter.html
r86443 r87071 60 60 function testMapping(string) 61 61 { 62 var originalLocation = WebInspector.ScriptFormatter.positionToLocation(source.lineEndings(), source.indexOf(string)); 62 var originalPosition = source.indexOf(string); 63 InspectorTest.assertTrue(originalPosition !== -1); 64 var originalLocation = WebInspector.ScriptFormatter.positionToLocation(source.lineEndings(), originalPosition); 63 65 var formattedLocation = mapping.originalToFormatted(originalLocation); 64 66 var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(formattedSource.lineEndings(), formattedLocation); 65 67 var expectedFormattedPosition = formattedSource.indexOf(string); 66 InspectorTest.assertEquals(expectedFormattedPosition, formattedPosition );68 InspectorTest.assertEquals(expectedFormattedPosition, formattedPosition, "wrong mapping for <" + string + ">"); 67 69 } 68 70 … … 70 72 testMapping("formatted1"); 71 73 testMapping("variable1"); 74 75 testMapping(" return \"functionWithComments\""); 72 76 73 77 testMapping("onmessage"); -
trunk/Source/WebCore/ChangeLog
r87070 r87071 1 2011-05-18 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: source mapping for pretty-printed scripts is sometimes inaccurate after indented comments. 6 https://bugs.webkit.org/show_bug.cgi?id=61037 7 8 * inspector/front-end/JavaScriptFormatter.js: 9 (FormattedContentBuilder.prototype.addToken): 10 (FormattedContentBuilder.prototype._addComment): 11 (FormattedContentBuilder.prototype._addText): 12 (FormattedContentBuilder.prototype._addMappingIfNeeded): 13 1 14 2011-05-23 Mike West <mkwst@chromium.org> 2 15 -
trunk/Source/WebCore/inspector/front-end/JavaScriptFormatter.js
r84625 r87071 65 65 } 66 66 67 if (token.pos - this._lastOriginalPosition !== this._formattedContentLength - this._lastFormattedPosition) { 68 this._mapping.original.push(this._originalOffset + token.pos); 69 this._lastOriginalPosition = token.pos; 70 this._mapping.formatted.push(this._formattedOffset + this._formattedContentLength); 71 this._lastFormattedPosition = this._formattedContentLength; 72 } 73 67 this._addMappingIfNeeded(token.pos); 74 68 this._addText(this._originalContent.substring(token.pos, token.endPos)); 75 69 this._lineNumber = token.endLine; … … 123 117 this.addSpace(); 124 118 119 this._addMappingIfNeeded(comment.pos); 125 120 if (comment.type === "comment1") 126 121 this._addText("//"); … … 142 137 this._formattedContent.push(text); 143 138 this._formattedContentLength += text.length; 139 }, 140 141 _addMappingIfNeeded: function(originalPosition) 142 { 143 if (originalPosition - this._lastOriginalPosition === this._formattedContentLength - this._lastFormattedPosition) 144 return; 145 this._mapping.original.push(this._originalOffset + originalPosition); 146 this._lastOriginalPosition = originalPosition; 147 this._mapping.formatted.push(this._formattedOffset + this._formattedContentLength); 148 this._lastFormattedPosition = this._formattedContentLength; 144 149 } 145 150 }
Note: See TracChangeset
for help on using the changeset viewer.