diff options
Diffstat (limited to 'WebCore/bindings/js/JSCustomSQLStatementCallback.cpp')
-rw-r--r-- | WebCore/bindings/js/JSCustomSQLStatementCallback.cpp | 53 |
1 files changed, 16 insertions, 37 deletions
diff --git a/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp index d0943de..1f6bd95 100644 --- a/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp +++ b/WebCore/bindings/js/JSCustomSQLStatementCallback.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "JSCustomSQLStatementCallback.h" + #if ENABLE(DATABASE) #include "Frame.h" @@ -35,60 +36,38 @@ #include "JSSQLResultSet.h" #include "JSSQLTransaction.h" #include <runtime/JSLock.h> +#include <wtf/MainThread.h> namespace WebCore { using namespace JSC; -JSCustomSQLStatementCallback::JSCustomSQLStatementCallback(JSObject* callback, Frame* frame) - : m_callback(callback) - , m_frame(frame) +JSCustomSQLStatementCallback::JSCustomSQLStatementCallback(JSObject* callback, JSDOMGlobalObject* globalObject) + : m_data(new JSCallbackData(callback, globalObject)) { } -void JSCustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException) +JSCustomSQLStatementCallback::~JSCustomSQLStatementCallback() { - ASSERT(m_callback); - ASSERT(m_frame); - - if (!m_frame->script()->isEnabled()) - return; - - // FIXME: This is likely the wrong globalObject (for prototype chains at least) - JSGlobalObject* globalObject = m_frame->script()->globalObject(); - ExecState* exec = globalObject->globalExec(); - - JSC::JSLock lock(SilenceAssertionsOnly); + callOnMainThread(JSCallbackData::deleteData, m_data); +#ifndef NDEBUG + m_data = 0; +#endif +} - JSValue function = m_callback->get(exec, Identifier(exec, "handleEvent")); - CallData callData; - CallType callType = function.getCallData(callData); - if (callType == CallTypeNone) { - callType = m_callback->getCallData(callData); - if (callType == CallTypeNone) { - // FIXME: Should an exception be thrown here? - return; - } - function = m_callback; - } +void JSCustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLResultSet* resultSet, bool& raisedException) +{ + ASSERT(m_data); RefPtr<JSCustomSQLStatementCallback> 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), resultSet)); - - globalObject->globalData()->timeoutChecker.start(); - call(exec, function, callType, callData, m_callback, args); - globalObject->globalData()->timeoutChecker.stop(); - - if (exec->hadException()) { - reportCurrentException(exec); - - raisedException = true; - } - Document::updateStyleForAllDocuments(); + m_data->invokeCallback(args, &raisedException); } } |