Chromium Code Reviews| Index: Source/core/inspector/InjectedScriptSource.js |
| diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
| index 4660bb19cfaf3693edd895463ba1fbb2ef81a2d3..0a2da2966d249544c8560871bfbde8184de87d6b 100644 |
| --- a/Source/core/inspector/InjectedScriptSource.js |
| +++ b/Source/core/inspector/InjectedScriptSource.js |
| @@ -617,7 +617,7 @@ InjectedScript.prototype = { |
| result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue), |
| __proto__: null }; |
| } catch (e) { |
| - return this._createThrownValue(e, objectGroup); |
| + return this._createThrownValue(e, objectGroup, returnByValue, false); |
| } |
| }, |
| @@ -670,21 +670,25 @@ InjectedScript.prototype = { |
| result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview), |
| __proto__: null }; |
| } |
| - return this._createThrownValue(wrappedResult.result, objectGroup, wrappedResult.exceptionDetails); |
| + return this._createThrownValue(wrappedResult.result, objectGroup, returnByValue, generatePreview, wrappedResult.exceptionDetails); |
| }, |
| /** |
| * @param {*} value |
| * @param {string} objectGroup |
| + * @param {boolean} returnByValue |
| + * @param {boolean} generatePreview |
| * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails |
| * @return {!Object} |
| */ |
| - _createThrownValue: function(value, objectGroup, exceptionDetails) |
| + _createThrownValue: function(value, objectGroup, returnByValue, generatePreview, exceptionDetails) |
|
vsevik
2014/07/17 13:13:22
I am not sure whether the changes we do here are s
|
| { |
| - var remoteObject = this._wrapObject(value, objectGroup); |
| - try { |
| - remoteObject.description = toStringDescription(value); |
| - } catch (e) {} |
| + var remoteObject = this._wrapObject(value, objectGroup, returnByValue, generatePreview && !(value instanceof Error)); |
| + if (!remoteObject.description || value instanceof Error) { |
| + try { |
| + remoteObject.description = toStringDescription(value); |
| + } catch (e) {} |
| + } |
| return { wasThrown: true, result: remoteObject, exceptionDetails: exceptionDetails, __proto__: null }; |
| }, |