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

Unified Diff: src/api.cc

Issue 443853002: v8::TryCatch should cancel the scheduled exception on Reset. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 4 months 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
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index bd49c84630b23748a747c13a867ef04d15ad5ee4..7098859de3cfa9fa85d786b29cf8eef56846f086 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1823,7 +1823,7 @@ v8::TryCatch::TryCatch()
capture_message_(true),
rethrow_(false),
has_terminated_(false) {
- Reset();
+ ResetInternal();
// Special handling for simulators which have a separate JS stack.
js_stack_comparable_address_ =
reinterpret_cast<void*>(v8::internal::SimulatorStack::RegisterCTryCatch(
@@ -1935,6 +1935,17 @@ v8::Local<v8::Message> v8::TryCatch::Message() const {
void v8::TryCatch::Reset() {
DCHECK(isolate_ == i::Isolate::Current());
+ if (!rethrow_ && HasCaught() && isolate_->has_scheduled_exception()) {
+ // If an exception was caught but is still scheduled because no API call
+ // promoted it, then it is canceled to prevent it from being propagated.
+ // Note that this will not cancel termination exceptions.
+ isolate_->CancelScheduledExceptionFromTryCatch(this);
+ }
+ ResetInternal();
+}
+
+
+void v8::TryCatch::ResetInternal() {
i::Object* the_hole = isolate_->heap()->the_hole_value();
exception_ = the_hole;
message_obj_ = the_hole;
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698