diff options
Diffstat (limited to 'WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp')
-rw-r--r-- | WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index 8c69e76..f4ea62a 100644 --- a/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -29,10 +29,10 @@ */ #include "config.h" -#include "V8Binding.h" #include "V8CustomVoidCallback.h" #include "Frame.h" +#include "V8Binding.h" namespace WebCore { @@ -64,7 +64,7 @@ void V8CustomVoidCallback::handleEvent() invokeCallback(m_callback, 0, 0, callbackReturnValue); } -static bool invokeCallbackHelper(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], v8::Handle<v8::Value>& returnValue) +bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue) { v8::TryCatch exceptionCatcher; @@ -73,9 +73,8 @@ static bool invokeCallbackHelper(v8::Persistent<v8::Object> callback, int argc, callbackFunction = v8::Local<v8::Function>::New(v8::Persistent<v8::Function>::Cast(callback)); } else if (callback->IsObject()) { v8::Local<v8::Value> handleEventFunction = callback->Get(v8::String::NewSymbol("handleEvent")); - if (handleEventFunction->IsFunction()) { + if (handleEventFunction->IsFunction()) callbackFunction = v8::Local<v8::Function>::Cast(handleEventFunction); - } } else return false; @@ -87,7 +86,8 @@ static bool invokeCallbackHelper(v8::Persistent<v8::Object> callback, int argc, V8Proxy* proxy = V8Proxy::retrieve(); ASSERT(proxy); - returnValue = proxy->callFunction(callbackFunction, thisObject, argc, argv); + v8::Handle<v8::Value> result = proxy->callFunction(callbackFunction, thisObject, argc, argv); + callbackReturnValue = !result.IsEmpty() && result->BooleanValue(); if (exceptionCatcher.HasCaught()) { v8::Local<v8::Message> message = exceptionCatcher.Message(); @@ -98,20 +98,4 @@ static bool invokeCallbackHelper(v8::Persistent<v8::Object> callback, int argc, return false; } -bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue) -{ - v8::Handle<v8::Value> returnValue; - bool result = invokeCallbackHelper(callback, argc, argv, returnValue); - callbackReturnValue = !returnValue.IsEmpty() && returnValue->IsBoolean() && returnValue->BooleanValue(); - return result; -} - -bool invokeCallbackTreatOnlyExplicitFalseAsFalse(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue) -{ - v8::Handle<v8::Value> returnValue; - bool result = invokeCallbackHelper(callback, argc, argv, returnValue); - callbackReturnValue = !returnValue.IsEmpty() && !returnValue->IsFalse(); - return result; -} - } // namespace WebCore |