JSCustomPositionCallback.cpp [plain text]
#include "config.h"
#include "JSCustomPositionCallback.h"
#include "Frame.h"
#include "JSGeoposition.h"
#include "ScriptController.h"
#include <runtime/JSLock.h>
namespace WebCore {
using namespace JSC;
JSCustomPositionCallback::JSCustomPositionCallback(JSObject* callback, Frame* frame)
: m_callback(callback)
, m_frame(frame)
{
}
void JSCustomPositionCallback::handleEvent(Geoposition* geoposition, bool& raisedException)
{
ASSERT(m_callback);
ASSERT(m_frame);
if (!m_frame->script()->isEnabled())
return;
JSGlobalObject* globalObject = m_frame->script()->globalObject();
ExecState* exec = globalObject->globalExec();
JSC::JSLock lock(false);
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) {
return;
}
function = m_callback;
}
RefPtr<JSCustomPositionCallback> protect(this);
MarkedArgumentBuffer args;
args.append(toJS(exec, geoposition));
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();
}
}