diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp index ea47c64..6178509 100644 --- a/src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp +++ b/src/3rdparty/webkit/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp @@ -32,70 +32,51 @@ #if ENABLE(DATABASE) #include "Frame.h" -#include "ScriptController.h" +#include "JSCallbackData.h" #include "JSSQLError.h" #include "JSSQLTransaction.h" +#include "ScriptController.h" #include <runtime/JSLock.h> +#include <wtf/MainThread.h> namespace WebCore { using namespace JSC; JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject) - : m_callback(callback) - , m_globalObject(globalObject) + : m_data(new JSCallbackData(callback, globalObject)) { } - -bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error) + +JSCustomSQLStatementErrorCallback::~JSCustomSQLStatementErrorCallback() { - ASSERT(m_callback); - ASSERT(m_globalObject); - - ExecState* exec = m_globalObject->globalExec(); - - JSC::JSLock lock(SilenceAssertionsOnly); - - JSValue handleEventFunction = m_callback->get(exec, Identifier(exec, "handleEvent")); - CallData handleEventCallData; - CallType handleEventCallType = handleEventFunction.getCallData(handleEventCallData); - CallData callbackCallData; - CallType callbackCallType = CallTypeNone; + callOnMainThread(JSCallbackData::deleteData, m_data); +#ifndef NDEBUG + m_data = 0; +#endif +} - if (handleEventCallType == CallTypeNone) { - callbackCallType = m_callback->getCallData(callbackCallData); - if (callbackCallType == CallTypeNone) { - // FIXME: Should an exception be thrown here? - return true; - } - } +bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error) +{ + ASSERT(m_data); RefPtr<JSCustomSQLStatementErrorCallback> protect(this); + JSC::JSLock lock(SilenceAssertionsOnly); + ExecState* exec = m_data->globalObject()->globalExec(); MarkedArgumentBuffer args; args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction)); args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error)); - - JSValue result; - m_globalObject->globalData()->timeoutChecker.start(); - if (handleEventCallType != CallTypeNone) - result = call(exec, handleEventFunction, handleEventCallType, handleEventCallData, m_callback, args); - else - result = call(exec, m_callback, callbackCallType, callbackCallData, m_callback, args); - m_globalObject->globalData()->timeoutChecker.stop(); - - if (exec->hadException()) { - reportCurrentException(exec); - + + bool raisedException = false; + JSValue result = m_data->invokeCallback(args, &raisedException); + if (raisedException) { // The spec says: // "If the error callback returns false, then move on to the next statement..." // "Otherwise, the error callback did not return false, or there was no error callback" // Therefore an exception and returning true are the same thing - so, return true on an exception return true; } - - Document::updateStyleForAllDocuments(); - return result.toBoolean(exec); } |