[V8] Run-time exception in onmessage handler is not forwarded to the
[WebKit-https.git] / WebCore / bindings / v8 / V8AbstractEventListener.cpp
index 588ea6c..c0efea5 100644 (file)
@@ -82,10 +82,17 @@ void V8AbstractEventListener::invokeEventHandler(v8::Handle<v8::Context> v8Conte
         tryCatch.Reset();
 
         // Call the event handler.
+        tryCatch.SetVerbose(false); // We do not want to report the exception to the inspector console.
         returnValue = callListenerFunction(jsEvent, event, isWindowEvent);
-        tryCatch.Reset();
+
+        // If an error occurs while handling the event, it should be reported.
+        if (tryCatch.HasCaught()) {
+            reportException(0, tryCatch);
+            tryCatch.Reset();
+        }
 
         // Restore the old event. This must be done for all exit paths through this method.
+        tryCatch.SetVerbose(true);
         if (savedEvent.IsEmpty())
             v8Context->Global()->SetHiddenValue(eventSymbol, v8::Undefined());
         else