Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 5a8b55725a598bbe4fbc7c94ec62126c03476211..3f3ef320832c0a61ae807afea399130a238fadc7 100644 |
--- a/Source/core/inspector/InjectedScriptSource.js |
+++ b/Source/core/inspector/InjectedScriptSource.js |
@@ -1383,9 +1383,19 @@ CommandLineAPIImpl.prototype = { |
copy: function(object) |
{ |
- if (injectedScript._subtype(object) === "node") |
- object = object.outerHTML; |
- var string = toString(object); |
+ var string; |
+ if (injectedScript._subtype(object) === "node") { |
+ string = object.outerHTML; |
+ } else if (typeof object === "string") { |
pfeldman
2013/12/03 17:47:52
Why special-casing the string?
Dmitry Zvorygin
2013/12/04 11:12:48
JSON.stringify(str) would put "str" into quotes.
|
+ string = object; |
+ } else { |
+ try { |
+ string = JSON.stringify(object, null, " "); |
aandrey
2013/12/03 17:49:42
1) string can be undefined after this: JSON.string
Dmitry Zvorygin
2013/12/04 11:12:48
Done.
|
+ } catch (e) { |
+ string = toString(object); |
+ } |
+ } |
+ |
var hints = { copyToClipboard: true }; |
var remoteObject = injectedScript._wrapObject(string, "") |
InjectedScriptHost.inspect(remoteObject, hints); |