[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 00:48:28 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 514cc76bdcefcd1491a076c9a3faf162a0dd931c
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 24 10:38:27 2009 +0000

    2009-12-23  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: Console dumps strings in escaped form.
    
            https://bugs.webkit.org/show_bug.cgi?id=32488
    
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleMessage.prototype._formatIndividualValue):
            * inspector/console-format-expected.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52544 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fafbc09..0bc756c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-23  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Console dumps strings in escaped form.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32488
+
+        * inspector/console-format-expected.txt:
+
 2009-12-23  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/inspector/console-format-expected.txt b/LayoutTests/inspector/console-format-expected.txt
index d48c966..6333b3d 100644
--- a/LayoutTests/inspector/console-format-expected.txt
+++ b/LayoutTests/inspector/console-format-expected.txt
@@ -1,70 +1,79 @@
 CONSOLE MESSAGE: line 12: Message format number %i, %d and %f
 CONSOLE MESSAGE: line 13: Message %s for %s
 CONSOLE MESSAGE: line 14: Object %o
-CONSOLE MESSAGE: line 19: test,test2,,,test4
-CONSOLE MESSAGE: line 49: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
-CONSOLE MESSAGE: line 50: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
-CONSOLE MESSAGE: line 49: /foo\\bar\sbaz/i
-CONSOLE MESSAGE: line 50: /foo\\bar\sbaz/i
-CONSOLE MESSAGE: line 49: test
-CONSOLE MESSAGE: line 50: test
-CONSOLE MESSAGE: line 49: Error: Unknown error
-CONSOLE MESSAGE: line 50: Error: Unknown error
-CONSOLE MESSAGE: line 49: [object HTMLBodyElement]
-CONSOLE MESSAGE: line 50: [object HTMLBodyElement]
-CONSOLE MESSAGE: line 49: function () { return 1; }
-CONSOLE MESSAGE: line 50: function () { return 1; }
-CONSOLE MESSAGE: line 49: function () {
+CONSOLE MESSAGE: line 20: test,test2,,,test4
+CONSOLE MESSAGE: line 21: %o
+CONSOLE MESSAGE: line 22: %O
+CONSOLE MESSAGE: line 52: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+CONSOLE MESSAGE: line 53: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+CONSOLE MESSAGE: line 52: /foo\\bar\sbaz/i
+CONSOLE MESSAGE: line 53: /foo\\bar\sbaz/i
+CONSOLE MESSAGE: line 52: test
+CONSOLE MESSAGE: line 53: test
+CONSOLE MESSAGE: line 52: test named "test"
+CONSOLE MESSAGE: line 53: test named "test"
+CONSOLE MESSAGE: line 52: Error: Unknown error
+CONSOLE MESSAGE: line 53: Error: Unknown error
+CONSOLE MESSAGE: line 52: [object HTMLBodyElement]
+CONSOLE MESSAGE: line 53: [object HTMLBodyElement]
+CONSOLE MESSAGE: line 52: function () { return 1; }
+CONSOLE MESSAGE: line 53: function () { return 1; }
+CONSOLE MESSAGE: line 52: function () {
         return 2;
     }
-CONSOLE MESSAGE: line 50: function () {
+CONSOLE MESSAGE: line 53: function () {
         return 2;
     }
-CONSOLE MESSAGE: line 49: 0.12
-CONSOLE MESSAGE: line 50: 0.12
-CONSOLE MESSAGE: line 49: http://webkit.org/
-CONSOLE MESSAGE: line 50: http://webkit.org/
-CONSOLE MESSAGE: line 49: null
-CONSOLE MESSAGE: line 50: 
-CONSOLE MESSAGE: line 49: undefined
-CONSOLE MESSAGE: line 50: 
+CONSOLE MESSAGE: line 52: 0.12
+CONSOLE MESSAGE: line 53: 0.12
+CONSOLE MESSAGE: line 52: http://webkit.org/
+CONSOLE MESSAGE: line 53: http://webkit.org/
+CONSOLE MESSAGE: line 52: null
+CONSOLE MESSAGE: line 53: 
+CONSOLE MESSAGE: line 52: undefined
+CONSOLE MESSAGE: line 53: 
 Tests that console logging dumps proper messages.
 
 console-format.html:12Message format number 1, 2 and 3.5
 console-format.html:13Message format for string
 console-format.html:14Object Object
-console-format.html:19["test", "test2", undefined, undefined, "test4"]
-console-format.html:49/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
-console-format.html:50[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
-"/^url\(\s*(?:(?:\"(?:[^\\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*\"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i"
-console-format.html:49/foo\\bar\sbaz/i
-console-format.html:50[/foo\\bar\sbaz/i]
+console-format.html:20["test", "test2", undefined, undefined, "test4"]
+console-format.html:21["test", "test2", undefined, undefined, "test4"]
+console-format.html:22Array
+console-format.html:52/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+console-format.html:53[/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
+"/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i"
+console-format.html:52/foo\\bar\sbaz/i
+console-format.html:53[/foo\\bar\sbaz/i]
 "/foo\\bar\sbaz/i"
-console-format.html:49test
-console-format.html:50["test"]
+console-format.html:52test
+console-format.html:53["test"]
 "test"
-console-format.html:49Error: Unknown error
-console-format.html:50[Error: Unknown error]
+console-format.html:52test named "test"
+console-format.html:53["test named "test""]
+"test named "test""
+console-format.html:52Error: Unknown error
+console-format.html:53[Error: Unknown error]
 Error: Unknown error
-console-format.html:49<body onload="onload()">
-console-format.html:50[<body onload="onload()">]
+console-format.html:52<body onload="onload()">
+console-format.html:53[<body onload="onload()">]
 "HTMLBodyElement"
-console-format.html:49function () { return 1; }
-console-format.html:50[function () { return 1; }]
+console-format.html:52function () { return 1; }
+console-format.html:53[function () { return 1; }]
 "function () { return 1; }"
-console-format.html:49function () { return 2; }
-console-format.html:50[function () {]
+console-format.html:52function () { return 2; }
+console-format.html:53[function () { return 2; }]
 "function () {<br> return 2;<br> }"
-console-format.html:490.12
-console-format.html:50[0.12]
+console-format.html:520.12
+console-format.html:53[0.12]
 "0.12"
-console-format.html:49http://webkit.org/
-console-format.html:50["http://webkit.org/"]
+console-format.html:52http://webkit.org/
+console-format.html:53["http://webkit.org/"]
 "http://webkit.org/"
-console-format.html:49null
-console-format.html:50[null]
+console-format.html:52null
+console-format.html:53[null]
 "null"
-console-format.html:49undefined
-console-format.html:50[undefined]
+console-format.html:52undefined
+console-format.html:53[undefined]
 "undefined"
 
diff --git a/LayoutTests/inspector/console-format.html b/LayoutTests/inspector/console-format.html
index db60a8b..0bbdbe7 100755
--- a/LayoutTests/inspector/console-format.html
+++ b/LayoutTests/inspector/console-format.html
@@ -14,14 +14,18 @@ function doit()
     console.log('Object %o', {'foo' : 'bar' });
 
     var array = ["test", "test2"];
-    array.foo = "bar";
+    array.foo = "bar"; 
     array[4] = "test4";
+
     console.log(array);
+    console.log("%o", array);
+    console.log("%O", array);
 
     // Populate Globals
     var regex1 = /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i;
     var regex2 = new RegExp("foo\\\\bar\\sbaz", "i");
     var str = "test";
+    var str2 = "test named \"test\"";
     var error = new Error;
     var node = document.body;
     var func = function() { return 1; };
@@ -31,7 +35,7 @@ function doit()
     var num = 1.2e-1;
     var linkify = "http://webkit.org/";
 
-    globals = [regex1, regex2, str, error, node, func, multilinefunc, num, linkify, null, undefined];
+    globals = [regex1, regex2, str, str2, error, node, func, multilinefunc, num, linkify, null, undefined];
     loopOverGlobals(0);
 }
 
@@ -45,7 +49,6 @@ function loopOverGlobals(current)
         else
             loopOverGlobals(next);
     }
-
     console.log(globals[current]);
     console.log([globals[current]]);
     evaluateInWebInspector("frontend_evaluateGlobal", advance);
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f0a70ef..91630bd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-23  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Console dumps strings in escaped form.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32488
+
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleMessage.prototype._formatIndividualValue):
+
 2009-12-23  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 4449472..9ab1f7f 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -1872,6 +1872,6 @@ void InspectorController::deleteCookie(const String& cookieName, const String& d
     }
 }
 
-} // namespace WebCore
+}  // namespace WebCore
     
 #endif // ENABLE(INSPECTOR)
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 0cf4a75..14be255 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -109,7 +109,8 @@ WebInspector.ConsoleView = function(drawer)
     this._customFormatters = {
         "object": this._formatobject,
         "array":  this._formatarray,
-        "node":   this._formatnode
+        "node":   this._formatnode,
+        "string": this._formatstring
     };
 }
 
@@ -496,7 +497,6 @@ WebInspector.ConsoleView.prototype = {
         if (!formatter || !isProxy) {
             formatter = this._formatvalue;
             output = output.description || output;
-            type = "undecorated";
         }
 
         var span = document.createElement("span");
@@ -535,7 +535,20 @@ WebInspector.ConsoleView.prototype = {
 
     _formatarray: function(arr, elem)
     {
-        InjectedScriptAccess.getProperties(arr, false, this._printArray.bind(this, elem));
+        InjectedScriptAccess.getProperties(arr, false, false, this._printArray.bind(this, elem));
+    },
+
+    _formatstring: function(output, elem)
+    {
+        var span = document.createElement("span");
+        span.className = "console-formatted-string source-code";
+        span.appendChild(WebInspector.linkifyStringAsFragment(output.description));
+
+        // Make black quotes.
+        elem.removeStyleClass("console-formatted-string");
+        elem.appendChild(document.createTextNode("\""));
+        elem.appendChild(span);
+        elem.appendChild(document.createTextNode("\""));
     },
 
     _printArray: function(elem, properties)
@@ -626,9 +639,13 @@ WebInspector.ConsoleMessage.prototype = {
             if (typeof parameters[i] !== "object" && typeof parameters[i] !== "function")
                 parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]);
 
+        // There can be string log and string eval result. We distinguish between them based on message type.
+        var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
+
         // Multiple parameters with the first being a format string. Save unused substitutions.
-        if (parameters.length > 1 && Object.proxyType(parameters[0]) === "string") {
-            var result = this._formatWithSubstitutionString(parameters, formattedResult)
+        if (shouldFormatMessage) {
+            // Multiple parameters with the first being a format string. Save unused substitutions.
+            var result = this._formatWithSubstitutionString(parameters, formattedResult);
             parameters = result.unusedSubstitutions;
             if (parameters.length)
                 formattedResult.appendChild(document.createTextNode(" "));
@@ -636,11 +653,14 @@ WebInspector.ConsoleMessage.prototype = {
 
         // Single parameter, or unused substitutions from above.
         for (var i = 0; i < parameters.length; ++i) {
-            this._formatIndividualValue(parameters[i], formattedResult);
+            // Inline strings when formatting.
+            if (shouldFormatMessage && parameters[i].type === "string")
+                formattedResult.appendChild(document.createTextNode(parameters[i].description));
+            else
+                formattedResult.appendChild(WebInspector.console._format(parameters[i]));
             if (i < parameters.length - 1)
                 formattedResult.appendChild(document.createTextNode(" "));
         }
-
         return formattedResult;
     },
 
@@ -677,18 +697,6 @@ WebInspector.ConsoleMessage.prototype = {
         return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
     },
 
-    _formatIndividualValue: function(param, formattedResult)
-    {
-        if (Object.proxyType(param) === "string") {
-            if (this.originatingCommand && this.level === WebInspector.ConsoleMessage.MessageLevel.Log) {
-                var quotedString = "\"" + param.description.replace(/"/g, "\\\"") + "\"";
-                formattedResult.appendChild(WebInspector.linkifyStringAsFragment(quotedString));
-            } else
-                formattedResult.appendChild(WebInspector.linkifyStringAsFragment(param.description));
-        } else
-            formattedResult.appendChild(WebInspector.console._format(param));
-    },
-
     toMessageElement: function()
     {
         if (this._element)
@@ -833,6 +841,9 @@ WebInspector.ConsoleMessage.prototype = {
             case WebInspector.ConsoleMessage.MessageType.Assert:
                 typeString = "Assert";
                 break;
+            case WebInspector.ConsoleMessage.MessageType.Result:
+                typeString = "Result";
+                break;
         }
         
         var levelString;
@@ -889,7 +900,8 @@ WebInspector.ConsoleMessage.MessageType = {
     Trace: 2,
     StartGroup: 3,
     EndGroup: 4,
-    Assert: 5
+    Assert: 5,
+    Result: 6
 }
 
 WebInspector.ConsoleMessage.MessageLevel = {
@@ -933,12 +945,17 @@ WebInspector.ConsoleCommandResult = function(result, exception, originatingComma
 {
     var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
     var message = result;
+    if (exception) {
+        // Distinguish between strings and errors (no need to quote latter).
+        message = WebInspector.ObjectProxy.wrapPrimitiveValue(result);
+        message.type = "error";
+    }
     var line = (exception ? result.line : -1);
     var url = (exception ? result.sourceURL : null);
 
     this.originatingCommand = originatingCommand;
 
-    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, line, url, null, 1, message);
+    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, message);
 }
 
 WebInspector.ConsoleCommandResult.prototype = {
diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js
index 4f4168b..6ad3289 100644
--- a/WebCore/inspector/front-end/InjectedScript.js
+++ b/WebCore/inspector/front-end/InjectedScript.js
@@ -442,7 +442,7 @@ InjectedScript.getPrototypes = function(nodeId)
     return result;
 }
 
-InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty)
+InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate)
 {
     var object = InjectedScript._resolveObject(objectProxy);
     if (!object)
@@ -461,7 +461,7 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty)
         var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
         if (!property.isGetter) {
             var childObject = object[propertyName];
-            var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, true);
+            var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
             childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
             childObjectProxy.path.push(propertyName);
             childObjectProxy.protoDepth = objectProxy.protoDepth || 0;
diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js
index 7bdf17f..fcfd4cf 100644
--- a/WebCore/inspector/front-end/ObjectPropertiesSection.js
+++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js
@@ -50,7 +50,7 @@ WebInspector.ObjectPropertiesSection.prototype = {
                 return;
             self.updateProperties(properties);
         };
-        InjectedScriptAccess.getProperties(this.object, this.ignoreHasOwnProperty, callback);
+        InjectedScriptAccess.getProperties(this.object, this.ignoreHasOwnProperty, true, callback);
     },
 
     updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
@@ -147,7 +147,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
                 this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
             }
         };
-        InjectedScriptAccess.getProperties(this.property.value, false, callback.bind(this));
+        InjectedScriptAccess.getProperties(this.property.value, false, true, callback.bind(this));
     },
 
     ondblclick: function(event)
diff --git a/WebCore/inspector/front-end/ObjectProxy.js b/WebCore/inspector/front-end/ObjectProxy.js
index f4a59a7..5129287 100644
--- a/WebCore/inspector/front-end/ObjectProxy.js
+++ b/WebCore/inspector/front-end/ObjectProxy.js
@@ -60,7 +60,7 @@ WebInspector.ObjectProxy.getPropertiesAsync = function(objectProxy, propertiesTo
                 result[propertiesPayload[i].name] = propertiesPayload[i].value.description;
         callback(result);
     };
-    InjectedScriptAccess.getProperties(objectProxy, true, createPropertiesMapThenCallback);
+    InjectedScriptAccess.getProperties(objectProxy, true, false, createPropertiesMapThenCallback);
 }
 
 WebInspector.ObjectPropertyProxy = function(name, value)
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index f7e1b90..e5bd9dd 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -720,6 +720,18 @@ body.drawer-visible #drawer {
     padding-left: 0 !important;
 }
 
+.console-formatted-number {
+    color: rgb(28, 0, 207);
+}
+
+.console-formatted-string, .console-formatted-regexp {
+    color: rgb(196, 26, 22);
+}
+
+.console-formatted-null, .console-formatted-undefined {
+    color: rgb(128, 128, 128);
+}
+
 .error-message {
     color: red;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list