Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Unified Diff: src/isolate.cc

Issue 11365200: Correctly handle uncaught exception objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index eec5a54d737e902caddfcfe5679dcb33656c8dd1..73a6310b4c084a8280e2d085cdc38521cf9be7b7 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1228,18 +1228,22 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
stack_trace_for_uncaught_exceptions_options_);
}
}
- // Stringify custom error objects for the message object.
+
+ Handle<Object> exception_arg = exception_handle;
+ // If the exception argument is a custom object, turn it into a string
+ // before throwing as uncaught exception. Note that the pending
+ // exception object to be set later must not be turned into a string.
if (exception_handle->IsJSObject() && !IsErrorObject(exception_handle)) {
bool failed = false;
- exception_handle = Execution::ToString(exception_handle, &failed);
+ exception_arg = Execution::ToString(exception_arg, &failed);
if (failed) {
- exception_handle = factory()->LookupAsciiSymbol("exception");
+ exception_arg = factory()->LookupAsciiSymbol("exception");
}
}
Handle<Object> message_obj = MessageHandler::MakeMessageObject(
"uncaught_exception",
location,
- HandleVector<Object>(&exception_handle, 1),
+ HandleVector<Object>(&exception_arg, 1),
stack_trace,
stack_trace_object);
thread_local_top()->pending_message_obj_ = *message_obj;
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698