DescriptionFix TryCatch.ReThrow() to not clobber Message.
TryCatch.ReThrow() sets a flag which, in the TryCatch destructor,
throws the caught exception using the public v8::ThrowException().
When the TryCatch catches the exception, the pending Message
object is saved internally, but the MessageLocation information is
not. When the TryCatch is destructed, the Message object is not
re-set in the engine, so the Isolate::DoThrow() that the ReThrow()
triggers winds up creating a new Message object. This alters the
reported location of the re-thrown exception to be the location of
the TryCatch.
This patch modifies the TryCatch to store the MessageLocation data
as well as the Message object and adds a new Isolate::RestoreMessage()
call which the destructor uses to re-set the Message object and
MessageLocation data within the Isolate TLS prior to calling the
public v8::ThrowException(). Since Isolate::RestoreMessage() is
always followed by a Isolate::DoThrow(), a restore_message_ flag is
set and Isolate::DoThrow() does not re-create the Message if set.
TEST=cctest/test-api/TryCatchNestedSyntax
Patch Set 1 #
Messages
Total messages: 3 (0 generated)
|