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

Unified Diff: src/messages.cc

Issue 6397011: Make exception thrown via v8 public API propagate to v8::TryCatch as JS thrown exceptions do. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 42fc3c9bd66fdd2742983340db3b41b0ad158114..91467ab5b9542655304e12442cdb73be31d6aba0 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -135,6 +135,9 @@ void MessageHandler::ReportMessage(MessageLocation* loc,
if (global_length == 0) {
DefaultMessageReport(loc, message);
} else {
+ // We are calling into embedder's code. Clean pending exception
+ // and ignore scheduled exceptions the callback can throw.
+ Top::clear_pending_exception();
Mads Ager (chromium) 2011/01/28 11:39:18 Should this be moved to the caller? I think we onl
antonm 2011/01/28 13:37:25 Let me try modified second approach: I'll move all
for (int i = 0; i < global_length; i++) {
HandleScope scope;
if (global_listeners.get(i)->IsUndefined()) continue;
@@ -144,6 +147,10 @@ void MessageHandler::ReportMessage(MessageLocation* loc,
FUNCTION_CAST<v8::MessageCallback>(callback_obj->proxy());
Handle<Object> callback_data(listener.get(1));
callback(api_message_obj, v8::Utils::ToLocal(callback_data));
+ if (Top::has_scheduled_exception()) {
+ // Consider logging it somehow.
Vitaly Repeshko 2011/01/28 14:03:33 What if we get an OOM or termination exception her
antonm 2011/01/28 14:43:18 That sounds like a very good point. I think we sh
+ Top::clear_scheduled_exception();
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698