summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp')
-rw-r--r--WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
index 4d5de79..a2ba52a 100644
--- a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
@@ -35,16 +35,17 @@
#include "JSCallbackData.h"
#include "JSSQLError.h"
#include "JSSQLTransaction.h"
-#include "ScriptController.h"
+#include "ScriptExecutionContext.h"
#include <runtime/JSLock.h>
#include <wtf/MainThread.h>
namespace WebCore {
-
+
using namespace JSC;
-
+
JSCustomSQLStatementErrorCallback::JSCustomSQLStatementErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
: m_data(new JSCallbackData(callback, globalObject))
+ , m_isolatedWorld(globalObject->world())
{
}
@@ -56,18 +57,23 @@ JSCustomSQLStatementErrorCallback::~JSCustomSQLStatementErrorCallback()
#endif
}
-bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
+bool JSCustomSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
{
ASSERT(m_data);
-
+ ASSERT(context);
+
RefPtr<JSCustomSQLStatementErrorCallback> protect(this);
-
+
JSC::JSLock lock(SilenceAssertionsOnly);
- ExecState* exec = m_data->globalObject()->globalExec();
+ JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
+ if (!globalObject)
+ return true; // if we cannot invoke the callback, roll back the transaction
+
+ ExecState* exec = globalObject->globalExec();
MarkedArgumentBuffer args;
args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
-
+
bool raisedException = false;
JSValue result = m_data->invokeCallback(args, &raisedException);
if (raisedException) {
@@ -77,7 +83,7 @@ bool JSCustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction,
// Therefore an exception and returning true are the same thing - so, return true on an exception
return true;
}
- return !result.isFalse();
+ return result.toBoolean(exec);
}
}