Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 381ca004b1f7c1dff24962723b479e97e6cc6672..3eab31c0028322f373df9e052673f97c6fac5ddc 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -6515,28 +6515,43 @@ void Isolate::Exit() { |
Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope( |
- Isolate* isolate) { |
+ Isolate* isolate, |
pmarch
2014/03/19 12:55:42
4-space indent?
Yang
2014/03/19 13:05:23
Done.
|
+ Isolate::DisallowJavascriptExecutionScope::OnFailure on_failure) |
+ : on_failure_(on_failure) { |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
- internal_ = reinterpret_cast<void*>( |
- new i::DisallowJavascriptExecution(i_isolate)); |
+ if (on_failure_ == CRASH_ON_FAILURE) { |
+ internal_ = reinterpret_cast<void*>( |
+ new i::DisallowJavascriptExecution(i_isolate)); |
+ } else { |
+ ASSERT_EQ(THROW_ON_FAILURE, on_failure); |
+ internal_ = reinterpret_cast<void*>( |
+ new i::ThrowOnJavascriptExecution(i_isolate)); |
+ } |
} |
Isolate::DisallowJavascriptExecutionScope::~DisallowJavascriptExecutionScope() { |
- delete reinterpret_cast<i::DisallowJavascriptExecution*>(internal_); |
+ if (on_failure_ == CRASH_ON_FAILURE) { |
+ delete reinterpret_cast<i::DisallowJavascriptExecution*>(internal_); |
+ } else { |
+ delete reinterpret_cast<i::ThrowOnJavascriptExecution*>(internal_); |
+ } |
} |
Isolate::AllowJavascriptExecutionScope::AllowJavascriptExecutionScope( |
Isolate* isolate) { |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
- internal_ = reinterpret_cast<void*>( |
+ internal_assert_ = reinterpret_cast<void*>( |
new i::AllowJavascriptExecution(i_isolate)); |
+ internal_throws_ = reinterpret_cast<void*>( |
+ new i::NoThrowOnJavascriptExecution(i_isolate)); |
} |
Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() { |
- delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_); |
+ delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_assert_); |
+ delete reinterpret_cast<i::NoThrowOnJavascriptExecution*>(internal_throws_); |
} |