Title: [200370] trunk/Source/WebInspectorUI
Revision
200370
Author
[email protected]
Date
2016-05-03 08:23:53 -0700 (Tue, 03 May 2016)

Log Message

Web Inspector: Allow format specifiers in console.assert and console.trace
https://bugs.webkit.org/show_bug.cgi?id=157295
<rdar://problem/26056039>

Patch by Joseph Pecoraro <[email protected]> on 2016-05-03
Reviewed by Timothy Hatcher.

* UserInterface/Views/ConsoleMessageView.js:
(WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
Treat the first argument as a format specifier.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (200369 => 200370)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-03 15:23:23 UTC (rev 200369)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-03 15:23:53 UTC (rev 200370)
@@ -1,3 +1,15 @@
+2016-05-03  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Allow format specifiers in console.assert and console.trace
+        https://bugs.webkit.org/show_bug.cgi?id=157295
+        <rdar://problem/26056039>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/ConsoleMessageView.js:
+        (WebInspector.ConsoleMessageView.prototype._appendMessageTextAndArguments):
+        Treat the first argument as a format specifier.
+
 2016-05-02  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r200337.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (200369 => 200370)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2016-05-03 15:23:23 UTC (rev 200369)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js	2016-05-03 15:23:53 UTC (rev 200370)
@@ -234,9 +234,10 @@
             case WebInspector.ConsoleMessage.MessageType.Trace:
                 var args = [WebInspector.UIString("Trace")];
                 if (this._message.parameters) {
-                    if (this._message.parameters[0].type === "string")
-                        args = [WebInspector.UIString("Trace: %s")].concat(this._message.parameters);
-                    else
+                    if (this._message.parameters[0].type === "string") {
+                        var prefixedFormatString = WebInspector.UIString("Trace: %s").format(this._message.parameters[0].description);
+                        args = [prefixedFormatString].concat(this._message.parameters.slice(1));
+                    } else
                         args = args.concat(this._message.parameters);
                 }
                 this._appendFormattedArguments(element, args);
@@ -245,9 +246,10 @@
             case WebInspector.ConsoleMessage.MessageType.Assert:
                 var args = [WebInspector.UIString("Assertion Failed")];
                 if (this._message.parameters) {
-                    if (this._message.parameters[0].type === "string")
-                        args = [WebInspector.UIString("Assertion Failed: %s")].concat(this._message.parameters);
-                    else
+                    if (this._message.parameters[0].type === "string") {
+                        var prefixedFormatString = WebInspector.UIString("Assertion Failed: %s").format(this._message.parameters[0].description);
+                        args = [prefixedFormatString].concat(this._message.parameters.slice(1));
+                    } else
                         args = args.concat(this._message.parameters);
                 }
                 this._appendFormattedArguments(element, args);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to