Commit bb9c9fe9 authored by ager@chromium.org's avatar ager@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6430 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7e423ec8
......@@ -1033,19 +1033,16 @@ function errorToStringDetectCycle() {
}
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;
}
}
......
......@@ -36,11 +36,11 @@ e.name = e;
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 + '');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment