Esempio n. 1
0
void JSGeolocationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSGeolocation* jsGeolocation = jsCast<JSGeolocation*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsGeolocation->impl(), jsGeolocation);
    jsGeolocation->releaseImpl();
}
Esempio n. 2
0
EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSGeolocation::s_info))
        return throwVMTypeError(exec);
    JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue));
    return JSValue::encode(castedThis->watchPosition(exec));
}
Esempio n. 3
0
EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSGeolocation* castedThis = jsDynamicCast<JSGeolocation*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSGeolocation::info());
    return JSValue::encode(castedThis->getCurrentPosition(exec));
}
Esempio n. 4
0
bool JSGeolocationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSGeolocation* jsGeolocation = jsCast<JSGeolocation*>(handle.get().asCell());
    if (!isObservable(jsGeolocation))
        return false;
    Frame* root = jsGeolocation->impl().frame();
    if (!root)
        return false;
    return visitor.containsOpaqueRoot(root);
}
Esempio n. 5
0
EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSGeolocation::s_info))
        return throwVMTypeError(exec);
    JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue));
    Geolocation* imp = static_cast<Geolocation*>(castedThis->impl());
    int watchId = exec->argument(0).toInt32(exec);

    imp->clearWatch(watchId);
    return JSValue::encode(jsUndefined());
}
Esempio n. 6
0
EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSGeolocation* castedThis = jsDynamicCast<JSGeolocation*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSGeolocation::info());
    Geolocation& impl = castedThis->impl();
    if (exec->argumentCount() < 1)
        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    int watchID(toInt32(exec, exec->argument(0), NormalConversion));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    impl.clearWatch(watchID);
    return JSValue::encode(jsUndefined());
}