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()); }
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(); }
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; }
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; }
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; }
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())); }
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); }
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()); }
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); }
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); }
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); }
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); }
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()); }
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); }
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(); }