Index: Source/core/inspector/InjectedScriptSource.js |
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
index 5a8b55725a598bbe4fbc7c94ec62126c03476211..64c39f7c5585f4e420d80bdd10f3a5de88e87e1b 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 (injectedScript.isPrimitiveValue(object)) { |
+ string = toString(object); |
+ } else { |
+ try { |
+ string = JSON.stringify(object, null, " "); |
+ } catch (e) { |
+ string = toString(object); |
+ } |
+ } |
+ |
var hints = { copyToClipboard: true }; |
var remoteObject = injectedScript._wrapObject(string, "") |
InjectedScriptHost.inspect(remoteObject, hints); |