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

Issue 15669003: Fix TryCatch.ReThrow() to not clobber Message. (Closed)

Created:
7 years, 6 months ago by apaprocki
Modified:
7 years, 5 months ago
Reviewers:
Yang
CC:
v8-dev
Visibility:
Public.

Description

Fix 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -8 lines) Patch
M include/v8.h View 1 chunk +4 lines, -1 line 0 comments Download
M src/api.cc View 4 chunks +21 lines, -4 lines 0 comments Download
M src/isolate.h View 3 chunks +5 lines, -0 lines 0 comments Download
M src/isolate.cc View 5 chunks +35 lines, -3 lines 0 comments Download
M test/cctest/test-api.cc View 1 chunk +31 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
apaprocki
This change removes the need for this hack in Node: https://github.com/joyent/node/blob/master/src/node_script.cc#L414 As a result of ...
7 years, 6 months ago (2013-06-01 22:09:38 UTC) #1
apaprocki
7 years, 6 months ago (2013-06-03 12:09:08 UTC) #2
Yang
7 years, 6 months ago (2013-06-25 15:51:19 UTC) #3
On 2013/06/03 12:09:08, apaprocki wrote:

LGTM, but I wanted to change somethings, so I created a new CL based on this
one: https://codereview.chromium.org/17694002/

Please take a look there before I land it. Thanks!

Powered by Google App Engine
This is Rietveld 408576698