| Index: src/api.cc
|
| ===================================================================
|
| --- src/api.cc (revision 14909)
|
| +++ src/api.cc (working copy)
|
| @@ -2052,7 +2052,10 @@
|
| : isolate_(i::Isolate::Current()),
|
| next_(isolate_->try_catch_handler_address()),
|
| exception_(isolate_->heap()->the_hole_value()),
|
| - message_(i::Smi::FromInt(0)),
|
| + message_obj_(i::Smi::FromInt(0)),
|
| + message_script_(i::Smi::FromInt(0)),
|
| + message_start_pos_(0),
|
| + message_end_pos_(0),
|
| is_verbose_(false),
|
| can_continue_(true),
|
| capture_message_(true),
|
| @@ -2068,6 +2071,17 @@
|
| v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_));
|
| v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
|
| isolate_->UnregisterTryCatchHandler(this);
|
| + if (HasCaught() && capture_message_) {
|
| + // If an exception was caught and rethrow_ is indicated, the saved
|
| + // message, script, and location need to be restored to Isolate TLS
|
| + // so that DoThrow() does not overwrite the values from the original
|
| + // exception with new ones computed at the current location.
|
| + i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
|
| + i::Script* script = message_script_ ?
|
| + reinterpret_cast<i::Script*>(message_script_) : NULL;
|
| + isolate_->RestoreMessage(message, script,
|
| + message_start_pos_, message_end_pos_);
|
| + }
|
| v8::ThrowException(exc);
|
| } else {
|
| isolate_->UnregisterTryCatchHandler(this);
|
| @@ -2129,8 +2143,8 @@
|
|
|
| v8::Local<v8::Message> v8::TryCatch::Message() const {
|
| ASSERT(isolate_ == i::Isolate::Current());
|
| - if (HasCaught() && message_ != i::Smi::FromInt(0)) {
|
| - i::Object* message = reinterpret_cast<i::Object*>(message_);
|
| + if (HasCaught() && message_obj_ != i::Smi::FromInt(0)) {
|
| + i::Object* message = reinterpret_cast<i::Object*>(message_obj_);
|
| return v8::Utils::MessageToLocal(i::Handle<i::Object>(message, isolate_));
|
| } else {
|
| return v8::Local<v8::Message>();
|
| @@ -2141,7 +2155,10 @@
|
| void v8::TryCatch::Reset() {
|
| ASSERT(isolate_ == i::Isolate::Current());
|
| exception_ = isolate_->heap()->the_hole_value();
|
| - message_ = i::Smi::FromInt(0);
|
| + message_obj_ = i::Smi::FromInt(0);
|
| + message_script_ = i::Smi::FromInt(0);
|
| + message_start_pos_ = 0;
|
| + message_end_pos_ = 0;
|
| }
|
|
|
|
|
|
|