Changeset 52544 in webkit
- Timestamp:
- Dec 24, 2009 2:38:27 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r52542 r52544 1 2009-12-23 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Console dumps strings in escaped form. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32488 8 9 * inspector/console-format-expected.txt: 10 1 11 2009-12-23 Alexey Proskuryakov <ap@apple.com> 2 12 -
trunk/LayoutTests/inspector/console-format-expected.txt
r51506 r52544 2 2 CONSOLE MESSAGE: line 13: Message %s for %s 3 3 CONSOLE MESSAGE: line 14: Object %o 4 CONSOLE MESSAGE: line 19: test,test2,,,test4 5 CONSOLE MESSAGE: line 49: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 6 CONSOLE MESSAGE: line 50: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 7 CONSOLE MESSAGE: line 49: /foo\\bar\sbaz/i 8 CONSOLE MESSAGE: line 50: /foo\\bar\sbaz/i 9 CONSOLE MESSAGE: line 49: test 10 CONSOLE MESSAGE: line 50: test 11 CONSOLE MESSAGE: line 49: Error: Unknown error 12 CONSOLE MESSAGE: line 50: Error: Unknown error 13 CONSOLE MESSAGE: line 49: [object HTMLBodyElement] 14 CONSOLE MESSAGE: line 50: [object HTMLBodyElement] 15 CONSOLE MESSAGE: line 49: function () { return 1; } 16 CONSOLE MESSAGE: line 50: function () { return 1; } 17 CONSOLE MESSAGE: line 49: function () { 4 CONSOLE MESSAGE: line 20: test,test2,,,test4 5 CONSOLE MESSAGE: line 21: %o 6 CONSOLE MESSAGE: line 22: %O 7 CONSOLE MESSAGE: line 52: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 8 CONSOLE MESSAGE: line 53: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 9 CONSOLE MESSAGE: line 52: /foo\\bar\sbaz/i 10 CONSOLE MESSAGE: line 53: /foo\\bar\sbaz/i 11 CONSOLE MESSAGE: line 52: test 12 CONSOLE MESSAGE: line 53: test 13 CONSOLE MESSAGE: line 52: test named "test" 14 CONSOLE MESSAGE: line 53: test named "test" 15 CONSOLE MESSAGE: line 52: Error: Unknown error 16 CONSOLE MESSAGE: line 53: Error: Unknown error 17 CONSOLE MESSAGE: line 52: [object HTMLBodyElement] 18 CONSOLE MESSAGE: line 53: [object HTMLBodyElement] 19 CONSOLE MESSAGE: line 52: function () { return 1; } 20 CONSOLE MESSAGE: line 53: function () { return 1; } 21 CONSOLE MESSAGE: line 52: function () { 18 22 return 2; 19 23 } 20 CONSOLE MESSAGE: line 5 0: function () {24 CONSOLE MESSAGE: line 53: function () { 21 25 return 2; 22 26 } 23 CONSOLE MESSAGE: line 49: 0.1224 CONSOLE MESSAGE: line 5 0: 0.1225 CONSOLE MESSAGE: line 49: http://webkit.org/26 CONSOLE MESSAGE: line 5 0: http://webkit.org/27 CONSOLE MESSAGE: line 49: null28 CONSOLE MESSAGE: line 5 0:29 CONSOLE MESSAGE: line 49: undefined30 CONSOLE MESSAGE: line 5 0:27 CONSOLE MESSAGE: line 52: 0.12 28 CONSOLE MESSAGE: line 53: 0.12 29 CONSOLE MESSAGE: line 52: http://webkit.org/ 30 CONSOLE MESSAGE: line 53: http://webkit.org/ 31 CONSOLE MESSAGE: line 52: null 32 CONSOLE MESSAGE: line 53: 33 CONSOLE MESSAGE: line 52: undefined 34 CONSOLE MESSAGE: line 53: 31 35 Tests that console logging dumps proper messages. 32 36 … … 34 38 console-format.html:13Message format for string 35 39 console-format.html:14Object Object 36 console-format.html:19["test", "test2", undefined, undefined, "test4"] 37 console-format.html:49/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 38 console-format.html:50[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i] 39 "/^url\(\s*(?:(?:\"(?:[^\\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*\"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i" 40 console-format.html:49/foo\\bar\sbaz/i 41 console-format.html:50[/foo\\bar\sbaz/i] 40 console-format.html:20["test", "test2", undefined, undefined, "test4"] 41 console-format.html:21["test", "test2", undefined, undefined, "test4"] 42 console-format.html:22Array 43 console-format.html:52/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i 44 console-format.html:53[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i] 45 "/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i" 46 console-format.html:52/foo\\bar\sbaz/i 47 console-format.html:53[/foo\\bar\sbaz/i] 42 48 "/foo\\bar\sbaz/i" 43 console-format.html: 49test44 console-format.html:5 0["test"]49 console-format.html:52test 50 console-format.html:53["test"] 45 51 "test" 46 console-format.html:49Error: Unknown error 47 console-format.html:50[Error: Unknown error] 52 console-format.html:52test named "test" 53 console-format.html:53["test named "test""] 54 "test named "test"" 55 console-format.html:52Error: Unknown error 56 console-format.html:53[Error: Unknown error] 48 57 Error: Unknown error 49 console-format.html: 49<body onload="onload()">50 console-format.html:5 0[<body onload="onload()">]58 console-format.html:52<body onload="onload()"> 59 console-format.html:53[<body onload="onload()">] 51 60 "HTMLBodyElement" 52 console-format.html: 49function () { return 1; }53 console-format.html:5 0[function () { return 1; }]61 console-format.html:52function () { return 1; } 62 console-format.html:53[function () { return 1; }] 54 63 "function () { return 1; }" 55 console-format.html: 49function () { return 2; }56 console-format.html:5 0[function () {]64 console-format.html:52function () { return 2; } 65 console-format.html:53[function () { return 2; }] 57 66 "function () {<br> return 2;<br> }" 58 console-format.html: 490.1259 console-format.html:5 0[0.12]67 console-format.html:520.12 68 console-format.html:53[0.12] 60 69 "0.12" 61 console-format.html: 49http://webkit.org/62 console-format.html:5 0["http://webkit.org/"]70 console-format.html:52http://webkit.org/ 71 console-format.html:53["http://webkit.org/"] 63 72 "http://webkit.org/" 64 console-format.html: 49null65 console-format.html:5 0[null]73 console-format.html:52null 74 console-format.html:53[null] 66 75 "null" 67 console-format.html: 49undefined68 console-format.html:5 0[undefined]76 console-format.html:52undefined 77 console-format.html:53[undefined] 69 78 "undefined" 70 79 -
trunk/LayoutTests/inspector/console-format.html
r51506 r52544 15 15 16 16 var array = ["test", "test2"]; 17 array.foo = "bar"; 17 array.foo = "bar"; 18 18 array[4] = "test4"; 19 19 20 console.log(array); 21 console.log("%o", array); 22 console.log("%O", array); 20 23 21 24 // Populate Globals … … 23 26 var regex2 = new RegExp("foo\\\\bar\\sbaz", "i"); 24 27 var str = "test"; 28 var str2 = "test named \"test\""; 25 29 var error = new Error; 26 30 var node = document.body; … … 32 36 var linkify = "http://webkit.org/"; 33 37 34 globals = [regex1, regex2, str, error, node, func, multilinefunc, num, linkify, null, undefined];38 globals = [regex1, regex2, str, str2, error, node, func, multilinefunc, num, linkify, null, undefined]; 35 39 loopOverGlobals(0); 36 40 } … … 46 50 loopOverGlobals(next); 47 51 } 48 49 52 console.log(globals[current]); 50 53 console.log([globals[current]]); -
trunk/WebCore/ChangeLog
r52542 r52544 1 2009-12-23 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Console dumps strings in escaped form. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32488 8 9 * inspector/front-end/ConsoleView.js: 10 (WebInspector.ConsoleMessage.prototype._formatIndividualValue): 11 1 12 2009-12-23 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/WebCore/inspector/InspectorController.cpp
r52415 r52544 1873 1873 } 1874 1874 1875 } // namespace WebCore1875 } // namespace WebCore 1876 1876 1877 1877 #endif // ENABLE(INSPECTOR) -
trunk/WebCore/inspector/front-end/ConsoleView.js
r52217 r52544 110 110 "object": this._formatobject, 111 111 "array": this._formatarray, 112 "node": this._formatnode 112 "node": this._formatnode, 113 "string": this._formatstring 113 114 }; 114 115 } … … 497 498 formatter = this._formatvalue; 498 499 output = output.description || output; 499 type = "undecorated";500 500 } 501 501 … … 536 536 _formatarray: function(arr, elem) 537 537 { 538 InjectedScriptAccess.getProperties(arr, false, this._printArray.bind(this, elem)); 538 InjectedScriptAccess.getProperties(arr, false, false, this._printArray.bind(this, elem)); 539 }, 540 541 _formatstring: function(output, elem) 542 { 543 var span = document.createElement("span"); 544 span.className = "console-formatted-string source-code"; 545 span.appendChild(WebInspector.linkifyStringAsFragment(output.description)); 546 547 // Make black quotes. 548 elem.removeStyleClass("console-formatted-string"); 549 elem.appendChild(document.createTextNode("\"")); 550 elem.appendChild(span); 551 elem.appendChild(document.createTextNode("\"")); 539 552 }, 540 553 … … 627 640 parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]); 628 641 642 // There can be string log and string eval result. We distinguish between them based on message type. 643 var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result; 644 629 645 // Multiple parameters with the first being a format string. Save unused substitutions. 630 if (parameters.length > 1 && Object.proxyType(parameters[0]) === "string") { 631 var result = this._formatWithSubstitutionString(parameters, formattedResult) 646 if (shouldFormatMessage) { 647 // Multiple parameters with the first being a format string. Save unused substitutions. 648 var result = this._formatWithSubstitutionString(parameters, formattedResult); 632 649 parameters = result.unusedSubstitutions; 633 650 if (parameters.length) … … 637 654 // Single parameter, or unused substitutions from above. 638 655 for (var i = 0; i < parameters.length; ++i) { 639 this._formatIndividualValue(parameters[i], formattedResult); 656 // Inline strings when formatting. 657 if (shouldFormatMessage && parameters[i].type === "string") 658 formattedResult.appendChild(document.createTextNode(parameters[i].description)); 659 else 660 formattedResult.appendChild(WebInspector.console._format(parameters[i])); 640 661 if (i < parameters.length - 1) 641 662 formattedResult.appendChild(document.createTextNode(" ")); 642 663 } 643 644 664 return formattedResult; 645 665 }, … … 678 698 }, 679 699 680 _formatIndividualValue: function(param, formattedResult)681 {682 if (Object.proxyType(param) === "string") {683 if (this.originatingCommand && this.level === WebInspector.ConsoleMessage.MessageLevel.Log) {684 var quotedString = "\"" + param.description.replace(/"/g, "\\\"") + "\"";685 formattedResult.appendChild(WebInspector.linkifyStringAsFragment(quotedString));686 } else687 formattedResult.appendChild(WebInspector.linkifyStringAsFragment(param.description));688 } else689 formattedResult.appendChild(WebInspector.console._format(param));690 },691 692 700 toMessageElement: function() 693 701 { … … 833 841 case WebInspector.ConsoleMessage.MessageType.Assert: 834 842 typeString = "Assert"; 843 break; 844 case WebInspector.ConsoleMessage.MessageType.Result: 845 typeString = "Result"; 835 846 break; 836 847 } … … 890 901 StartGroup: 3, 891 902 EndGroup: 4, 892 Assert: 5 903 Assert: 5, 904 Result: 6 893 905 } 894 906 … … 934 946 var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log); 935 947 var message = result; 948 if (exception) { 949 // Distinguish between strings and errors (no need to quote latter). 950 message = WebInspector.ObjectProxy.wrapPrimitiveValue(result); 951 message.type = "error"; 952 } 936 953 var line = (exception ? result.line : -1); 937 954 var url = (exception ? result.sourceURL : null); … … 939 956 this.originatingCommand = originatingCommand; 940 957 941 WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType. Log, level, line, url, null, 1, message);958 WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, message); 942 959 } 943 960 -
trunk/WebCore/inspector/front-end/InjectedScript.js
r52108 r52544 443 443 } 444 444 445 InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty )445 InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate) 446 446 { 447 447 var object = InjectedScript._resolveObject(objectProxy); … … 462 462 if (!property.isGetter) { 463 463 var childObject = object[propertyName]; 464 var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, true);464 var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate); 465 465 childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : []; 466 466 childObjectProxy.path.push(propertyName); -
trunk/WebCore/inspector/front-end/ObjectPropertiesSection.js
r51946 r52544 51 51 self.updateProperties(properties); 52 52 }; 53 InjectedScriptAccess.getProperties(this.object, this.ignoreHasOwnProperty, callback);53 InjectedScriptAccess.getProperties(this.object, this.ignoreHasOwnProperty, true, callback); 54 54 }, 55 55 … … 148 148 } 149 149 }; 150 InjectedScriptAccess.getProperties(this.property.value, false, callback.bind(this));150 InjectedScriptAccess.getProperties(this.property.value, false, true, callback.bind(this)); 151 151 }, 152 152 -
trunk/WebCore/inspector/front-end/ObjectProxy.js
r51420 r52544 61 61 callback(result); 62 62 }; 63 InjectedScriptAccess.getProperties(objectProxy, true, createPropertiesMapThenCallback);63 InjectedScriptAccess.getProperties(objectProxy, true, false, createPropertiesMapThenCallback); 64 64 } 65 65 -
trunk/WebCore/inspector/front-end/inspector.css
r52427 r52544 721 721 } 722 722 723 .console-formatted-number { 724 color: rgb(28, 0, 207); 725 } 726 727 .console-formatted-string, .console-formatted-regexp { 728 color: rgb(196, 26, 22); 729 } 730 731 .console-formatted-null, .console-formatted-undefined { 732 color: rgb(128, 128, 128); 733 } 734 723 735 .error-message { 724 736 color: red;
Note: See TracChangeset
for help on using the changeset viewer.