Example #1
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;
}
Example #2
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()));
}
Example #3
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);
}
Example #4
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());
}
Example #5
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();
}