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

Unified Diff: src/api.cc

Issue 203223013: Introduce API to trigger exception on JS execution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 9 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') | src/assert-scope.h » ('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 381ca004b1f7c1dff24962723b479e97e6cc6672..871da871e28a7d3829319d33659361fafa50e5e5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6515,28 +6515,43 @@ void Isolate::Exit() {
Isolate::DisallowJavascriptExecutionScope::DisallowJavascriptExecutionScope(
- Isolate* isolate) {
+ Isolate* isolate,
+ 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_);
}
« include/v8.h ('K') | « include/v8.h ('k') | src/assert-scope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698