Chromium Code Reviews| Index: src/messages.js | 
| diff --git a/src/messages.js b/src/messages.js | 
| index b586d24882b02a5e46528efef9dded04ac510540..1561e4abab0011d2dc704e3129ebc7b9255b8dcc 100644 | 
| --- a/src/messages.js | 
| +++ b/src/messages.js | 
| @@ -228,7 +228,11 @@ function NoSideEffectToString(obj) { | 
| } | 
| } | 
| } | 
| - if (IsNativeErrorObject(obj)) return %_CallFunction(obj, ErrorToString); | 
| + var objToString = GetPropertyWithoutInvokingMonkeyGetters(obj, "toString"); | 
| 
 
Michael Starzinger
2013/08/02 12:16:02
Yep, better, final nit: Can we move this into the
 
 | 
| + if (IsNativeErrorObject(obj) || | 
| + (obj instanceof $Error && objToString === ErrorToString)) { | 
| + return %_CallFunction(obj, ErrorToString); | 
| + } | 
| return %_CallFunction(obj, ObjectToString); | 
| } | 
| @@ -257,7 +261,9 @@ function IsNativeErrorObject(obj) { | 
| // the error to string method. This is to avoid leaking error | 
| // objects between script tags in a browser setting. | 
| function ToStringCheckErrorObject(obj) { | 
| - if (IsNativeErrorObject(obj)) { | 
| + var objToString = GetPropertyWithoutInvokingMonkeyGetters(obj, "toString"); | 
| + if (IsNativeErrorObject(obj) || | 
| + (obj instanceof $Error && objToString === ErrorToString)) { | 
| return %_CallFunction(obj, ErrorToString); | 
| } else { | 
| return ToString(obj); |