From 377c793d7f2f00841bc549f4831059755004e4c4 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Fri, 28 Aug 2009 13:10:33 +0100 Subject: Update V8 bindings to report exceptions thrown from callbacks. --- WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'WebCore') diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index 925271f..b538b33 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -29,6 +29,7 @@ */ #include "config.h" +#include "V8Binding.h" #include "V8CustomVoidCallback.h" #include "Frame.h" @@ -66,7 +67,6 @@ void V8CustomVoidCallback::handleEvent() bool invokeCallback(v8::Persistent callback, int argc, v8::Handle argv[], bool& callbackReturnValue) { - // FIXME: If an exception was thrown by the callback, we should report it v8::TryCatch exceptionCatcher; v8::Local callbackFunction; @@ -92,7 +92,13 @@ bool invokeCallback(v8::Persistent callback, int argc, v8::HandleIsBoolean() && result->BooleanValue(); - return exceptionCatcher.HasCaught(); + if (exceptionCatcher.HasCaught()) { + v8::Local message = exceptionCatcher.Message(); + proxy->frame()->document()->reportException(toWebCoreString(message->Get()), message->GetLineNumber(), toWebCoreString(message->GetScriptResourceName())); + return true; + } + + return false; } } // namespace WebCore -- cgit v1.1