Revision: 6430
Author: [email protected]
Date: Fri Jan 21 06:11:35 2011
Log: Change recursive error printing to just replace recursively
encountered error objects with the empty string. This actually does
match the Safari behaviour.
Review URL: http://codereview.chromium.org/6259010
http://code.google.com/p/v8/source/detail?r=6430
Modified:
/branches/bleeding_edge/src/messages.js
/branches/bleeding_edge/test/mjsunit/cyclic-error-to-string.js
=======================================
--- /branches/bleeding_edge/src/messages.js Fri Jan 21 03:44:29 2011
+++ /branches/bleeding_edge/src/messages.js Fri Jan 21 06:11:35 2011
@@ -1033,19 +1033,16 @@
}
function errorToString() {
- // These helper functions are needed because access to properties on
+ // This helper function is needed because access to properties on
// the builtins object do not work inside of a catch clause.
function isCyclicErrorMarker(o) { return o === cyclic_error_marker; }
- function isVisitedErrorsEmpty() { return visited_errors.length === 0; }
try {
return %_CallFunction(this, errorToStringDetectCycle);
} catch(e) {
- // Propagate cyclic_error_marker exception until all error
- // formatting is finished and then return the empty string. Safari
- // and Firefox also returns the empty string when converting a
- // cyclic error to a string.
- if (isCyclicErrorMarker(e) && isVisitedErrorsEmpty()) return '';
+ // If this error message was encountered already return the empty
+ // string for it instead of recursively formatting it.
+ if (isCyclicErrorMarker(e)) return '';
else throw e;
}
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/cyclic-error-to-string.js Fri Jan
21 03:44:29 2011
+++ /branches/bleeding_edge/test/mjsunit/cyclic-error-to-string.js Fri Jan
21 06:11:35 2011
@@ -36,11 +36,11 @@
e.message = e;
e.stack = e;
e.arguments = e;
-assertEquals('', e + '');
+assertEquals(': ', e + '');
e = new Error();
e.name = [ e ];
e.message = [ e ];
e.stack = [ e ];
e.arguments = [ e ];
-assertEquals('', e + '');
+assertEquals(': ', e + '');
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev