Ejemplo n.º 1
0
EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionWebkitGetUserMedia(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSNavigator::info());
    Navigator& impl = castedThis->impl();
    if (exec->argumentCount() < 2)
        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    ExceptionCode ec = 0;
    Dictionary options(exec, exec->argument(0));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    if (!exec->argument(1).isFunction())
        return throwVMTypeError(exec);
    RefPtr<NavigatorUserMediaSuccessCallback> successCallback = JSNavigatorUserMediaSuccessCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
    RefPtr<NavigatorUserMediaErrorCallback> errorCallback;
    if (!exec->argument(2).isUndefinedOrNull()) {
        if (!exec->uncheckedArgument(2).isFunction())
            return throwVMTypeError(exec);
        errorCallback = JSNavigatorUserMediaErrorCallback::create(asObject(exec->uncheckedArgument(2)), castedThis->globalObject());
    }
    NavigatorMediaStream::webkitGetUserMedia(&impl, options, successCallback, errorCallback, ec);
    setDOMException(exec, ec);
    return JSValue::encode(jsUndefined());
}
Ejemplo n.º 2
0
void JSNavigatorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
    JSNavigator* jsNavigator = jsCast<JSNavigator*>(handle.get().asCell());
    DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
    uncacheWrapper(world, &jsNavigator->impl(), jsNavigator);
    jsNavigator->releaseImpl();
}
Ejemplo n.º 3
0
JSValue jsNavigatorOnLine(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    Navigator* imp = static_cast<Navigator*>(castedThis->impl());
    JSValue result = jsBoolean(imp->onLine());
    return result;
}
Ejemplo n.º 4
0
JSValue jsNavigatorVendorSub(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    Navigator* imp = static_cast<Navigator*>(castedThis->impl());
    JSValue result = jsString(exec, imp->vendorSub());
    return result;
}
Ejemplo n.º 5
0
JSValue jsNavigatorMimeTypes(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    Navigator* imp = static_cast<Navigator*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->mimeTypes()));
    return result;
}
Ejemplo n.º 6
0
EncodedJSValue jsNavigatorConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSNavigator* domObject = jsDynamicCast<JSNavigator*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSNavigator::getConstructor(exec->vm(), domObject->globalObject()));
}
Ejemplo n.º 7
0
bool JSNavigatorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
    JSNavigator* jsNavigator = jsCast<JSNavigator*>(handle.get().asCell());
    if (!isObservable(jsNavigator))
        return false;
    Frame* root = jsNavigator->impl().frame();
    if (!root)
        return false;
    return visitor.containsOpaqueRoot(root);
}
Ejemplo n.º 8
0
EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionGetStorageUpdates(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSNavigator::info());
    Navigator& impl = castedThis->impl();
    impl.getStorageUpdates();
    return JSValue::encode(jsUndefined());
}
Ejemplo n.º 9
0
EncodedJSValue jsNavigatorOnLine(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    Navigator& impl = castedThis->impl();
    JSValue result = jsBoolean(impl.onLine());
    return JSValue::encode(result);
}
Ejemplo n.º 10
0
EncodedJSValue jsNavigatorVendorSub(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    Navigator& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.vendorSub());
    return JSValue::encode(result);
}
Ejemplo n.º 11
0
EncodedJSValue jsNavigatorWebkitPersistentStorage(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    Navigator& impl = castedThis->impl();
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(NavigatorStorageQuota::webkitPersistentStorage(&impl)));
    return JSValue::encode(result);
}
Ejemplo n.º 12
0
EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionJavaEnabled(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(thisValue);
    if (!castedThis)
        return throwVMTypeError(exec);
    ASSERT_GC_OBJECT_INHERITS(castedThis, JSNavigator::info());
    Navigator& impl = castedThis->impl();

    JSC::JSValue result = jsBoolean(impl.javaEnabled());
    return JSValue::encode(result);
}
Ejemplo n.º 13
0
EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionGetStorageUpdates(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSNavigator::s_info))
        return throwVMTypeError(exec);
    JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNavigator::s_info);
    Navigator* imp = static_cast<Navigator*>(castedThis->impl());

    imp->getStorageUpdates();
    return JSValue::encode(jsUndefined());
}
Ejemplo n.º 14
0
EncodedJSValue JSC_HOST_CALL jsNavigatorPrototypeFunctionJavaEnabled(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSNavigator::s_info))
        return throwVMTypeError(exec);
    JSNavigator* castedThis = static_cast<JSNavigator*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSNavigator::s_info);
    Navigator* imp = static_cast<Navigator*>(castedThis->impl());


    JSC::JSValue result = jsBoolean(imp->javaEnabled());
    return JSValue::encode(result);
}
Ejemplo n.º 15
0
JSValue JSNavigator::webkitGetUserMedia(ExecState* exec)
{
    if (exec->argumentCount() < 2) {
        throwVMError(exec, createNotEnoughArgumentsError(exec));
        return jsUndefined();
    }

    Dictionary options(exec, exec->argument(0));
    if (exec->hadException())
        return jsUndefined();

    if (!options.isObject()) {
        throwVMError(exec, createTypeError(exec, "First argument of webkitGetUserMedia must be a valid Dictionary"));
        return jsUndefined();
    }

    if (!exec->argument(1).isFunction()) {
        throwVMTypeError(exec, "Argument 2 ('successCallback') to Navigator.webkitGetUserMedia must be a function");
        return jsUndefined();
    }

    JSNavigator* castedThis = jsDynamicCast<JSNavigator*>(exec->thisValue());
    RefPtr<NavigatorUserMediaErrorCallback> errorCallback;
    if (!exec->argument(2).isUndefinedOrNull()) {
        if (!exec->uncheckedArgument(2).isFunction()) {
            throwVMTypeError(exec, "Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function");
            return jsUndefined();
        }
        errorCallback = JSNavigatorUserMediaErrorCallback::create(asObject(exec->uncheckedArgument(2)), castedThis->globalObject());
    }

    RefPtr<NavigatorUserMediaSuccessCallback> successCallback = JSNavigatorUserMediaSuccessCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
    Navigator& impl = castedThis->impl();
    ExceptionCode ec = 0;
    NavigatorMediaStream::webkitGetUserMedia(&impl, options, successCallback, errorCallback, ec);
    setDOMException(exec, ec);
    return jsUndefined();
}