Title: [151738] trunk/Source/WebInspectorUI
- Revision
- 151738
- Author
- [email protected]
- Date
- 2013-06-19 10:29:58 -0700 (Wed, 19 Jun 2013)
Log Message
Web Inspector: Copying array or object output does not contain values
https://bugs.webkit.org/show_bug.cgi?id=117669
ConsoleCommandResult was overriding toClipboardString() but wasn't using the complex code
in ConsoleMessageImpl's toClipboardString() to provide a nicely formatted output for objects.
We now use a "clipboarPrefixString" property to customize the prefix used in the clipboard
and, additionally, only use that prefix if we're copying more than a single message since it's
the only situation where it's useful to have the ">" or "<" prefix shown. Console messages with
a log level always print the level and when saving the console log using Cmd+S, all messages
contain their prefix as well.
Reviewed by Timothy Hatcher.
* UserInterface/ConsoleCommand.js:
(WebInspector.ConsoleCommand.prototype.toClipboardString):
Handle the new isPrefixOptional argument.
* UserInterface/ConsoleCommandResult.js:
(WebInspector.ConsoleCommandResult.prototype.get clipboarPrefixString):
Provide a custom "< " prefix and set "enforcesClipboardPrefixString" to false such that
the prefix isn't printed out in situations when it may not.
* UserInterface/ConsoleMessageImpl.js:
Set "enforcesClipboardPrefixString" to true since we always want to log the log level
prefix in all situations.
(WebInspector.ConsoleMessageImpl.prototype.get clipboarPrefixString):
Implement this new getter to return our clipboard string such that subclasses may
customize it.
(WebInspector.ConsoleMessageImpl.prototype.toClipboardString):
Take into account both isPrefixOptional and the "enforcesClipboardPrefixString" property
to only log the prefix if necessary.
* UserInterface/LogContentView.js:
(WebInspector.LogContentView.prototype._formatMessagesAsData):
Make the logging of prefix optional when we have a single message selected and we're
not saving via Cmd+S.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (151737 => 151738)
--- trunk/Source/WebInspectorUI/ChangeLog 2013-06-19 17:20:46 UTC (rev 151737)
+++ trunk/Source/WebInspectorUI/ChangeLog 2013-06-19 17:29:58 UTC (rev 151738)
@@ -1,3 +1,44 @@
+2013-06-19 Antoine Quint <[email protected]>
+
+ Web Inspector: Copying array or object output does not contain values
+ https://bugs.webkit.org/show_bug.cgi?id=117669
+
+ ConsoleCommandResult was overriding toClipboardString() but wasn't using the complex code
+ in ConsoleMessageImpl's toClipboardString() to provide a nicely formatted output for objects.
+ We now use a "clipboarPrefixString" property to customize the prefix used in the clipboard
+ and, additionally, only use that prefix if we're copying more than a single message since it's
+ the only situation where it's useful to have the ">" or "<" prefix shown. Console messages with
+ a log level always print the level and when saving the console log using Cmd+S, all messages
+ contain their prefix as well.
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/ConsoleCommand.js:
+ (WebInspector.ConsoleCommand.prototype.toClipboardString):
+ Handle the new isPrefixOptional argument.
+
+ * UserInterface/ConsoleCommandResult.js:
+ (WebInspector.ConsoleCommandResult.prototype.get clipboarPrefixString):
+ Provide a custom "< " prefix and set "enforcesClipboardPrefixString" to false such that
+ the prefix isn't printed out in situations when it may not.
+
+ * UserInterface/ConsoleMessageImpl.js:
+ Set "enforcesClipboardPrefixString" to true since we always want to log the log level
+ prefix in all situations.
+
+ (WebInspector.ConsoleMessageImpl.prototype.get clipboarPrefixString):
+ Implement this new getter to return our clipboard string such that subclasses may
+ customize it.
+
+ (WebInspector.ConsoleMessageImpl.prototype.toClipboardString):
+ Take into account both isPrefixOptional and the "enforcesClipboardPrefixString" property
+ to only log the prefix if necessary.
+
+ * UserInterface/LogContentView.js:
+ (WebInspector.LogContentView.prototype._formatMessagesAsData):
+ Make the logging of prefix optional when we have a single message selected and we're
+ not saving via Cmd+S.
+
2013-06-18 Joseph Pecoraro <[email protected]>
Web Inspector: Infrequent uncaught exception with debugger popovers breaks inspector
Modified: trunk/Source/WebInspectorUI/UserInterface/ConsoleCommand.js (151737 => 151738)
--- trunk/Source/WebInspectorUI/UserInterface/ConsoleCommand.js 2013-06-19 17:20:46 UTC (rev 151737)
+++ trunk/Source/WebInspectorUI/UserInterface/ConsoleCommand.js 2013-06-19 17:29:58 UTC (rev 151738)
@@ -89,9 +89,9 @@
this._formattedCommand.textContent = this.command;
},
- toClipboardString: function()
+ toClipboardString: function(isPrefixOptional)
{
- return "> " + this.command;
+ return (isPrefixOptional ? "" : "> ") + this.command;
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/ConsoleCommandResult.js (151737 => 151738)
--- trunk/Source/WebInspectorUI/UserInterface/ConsoleCommandResult.js 2013-06-19 17:20:46 UTC (rev 151737)
+++ trunk/Source/WebInspectorUI/UserInterface/ConsoleCommandResult.js 2013-06-19 17:29:58 UTC (rev 151738)
@@ -40,16 +40,18 @@
// Public
+ enforcesClipboardPrefixString: false,
+
toMessageElement: function()
{
var element = WebInspector.ConsoleMessageImpl.prototype.toMessageElement.call(this);
element.classList.add("console-user-command-result");
return element;
},
-
- toClipboardString: function()
+
+ get clipboarPrefixString ()
{
- return "< " + this._parameters[0].description;
+ return "< ";
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/ConsoleMessageImpl.js (151737 => 151738)
--- trunk/Source/WebInspectorUI/UserInterface/ConsoleMessageImpl.js 2013-06-19 17:20:46 UTC (rev 151737)
+++ trunk/Source/WebInspectorUI/UserInterface/ConsoleMessageImpl.js 2013-06-19 17:29:58 UTC (rev 151738)
@@ -48,6 +48,9 @@
}
WebInspector.ConsoleMessageImpl.prototype = {
+
+ enforcesClipboardPrefixString: true,
+
_formatMessage: function()
{
this._formattedMessage = document.createElement("span");
@@ -656,8 +659,13 @@
}
},
- toClipboardString: function()
+ get clipboarPrefixString ()
{
+ return "[" + this.levelString + "] ";
+ },
+
+ toClipboardString: function(isPrefixOptional)
+ {
var isTrace = this._shouldDumpStackTrace();
var clipboardString = "";
@@ -666,7 +674,8 @@
else
clipboardString = this.type === WebInspector.ConsoleMessage.MessageType.Trace ? "console.trace()" : this._message || this._messageText;
- clipboardString = "[" + this.levelString + "] " + clipboardString;
+ if (!isPrefixOptional || this.enforcesClipboardPrefixString)
+ clipboardString = this.clipboarPrefixString + clipboardString;
if (isTrace) {
this._stackTrace.forEach(function(frame) {
Modified: trunk/Source/WebInspectorUI/UserInterface/LogContentView.js (151737 => 151738)
--- trunk/Source/WebInspectorUI/UserInterface/LogContentView.js 2013-06-19 17:20:46 UTC (rev 151737)
+++ trunk/Source/WebInspectorUI/UserInterface/LogContentView.js 2013-06-19 17:29:58 UTC (rev 151738)
@@ -264,6 +264,7 @@
var data = ""
+ var isPrefixOptional = messages.length <= 1 && onlySelected;
messages.forEach(function (messageElement, index) {
var messageObject = messageElement.message;
if (!messageObject)
@@ -273,7 +274,7 @@
if (index > 0)
data += "\n"
- data += messageObject.toClipboardString();
+ data += messageObject.toClipboardString(isPrefixOptional);
});
return data;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes