Index: src/messages.cc |
diff --git a/src/messages.cc b/src/messages.cc |
index 801930d2b3f4b86b2dacb9b5ffe2ef3b5b6c6560..7b0a4d41a40cbbffab0d1ae79efbcb90ea1add74 100644 |
--- a/src/messages.cc |
+++ b/src/messages.cc |
@@ -132,13 +132,17 @@ void MessageHandler::ReportMessage(Isolate* isolate, |
for (int i = 0; i < global_length; i++) { |
HandleScope scope; |
if (global_listeners.get(i)->IsUndefined()) continue; |
- Handle<Foreign> callback_obj(Foreign::cast(global_listeners.get(i))); |
+ v8::NeanderObject listener(JSObject::cast(global_listeners.get(i))); |
+ Handle<Foreign> callback_obj(Foreign::cast(listener.get(0))); |
v8::MessageCallback callback = |
FUNCTION_CAST<v8::MessageCallback>(callback_obj->foreign_address()); |
+ Handle<Object> callback_data(listener.get(1)); |
{ |
// Do not allow exceptions to propagate. |
v8::TryCatch try_catch; |
- callback(api_message_obj, api_exception_obj); |
+ callback(api_message_obj, callback_data->IsUndefined() |
+ ? api_exception_obj |
+ : v8::Utils::ToLocal(callback_data)); |
} |
if (isolate->has_scheduled_exception()) { |
isolate->clear_scheduled_exception(); |