bool JSFileReaderOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) { JSFileReader* jsFileReader = jsCast<JSFileReader*>(handle.get().asCell()); if (jsFileReader->impl().hasPendingActivity()) return true; if (jsFileReader->impl().isFiringEventListeners()) return true; UNUSED_PARAM(visitor); return false; }
void setJSFileReaderOnloadend(ExecState* exec, JSObject* thisObject, JSValue value) { UNUSED_PARAM(exec); JSFileReader* castedThis = static_cast<JSFileReader*>(thisObject); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); imp->setOnloadend(createJSAttributeEventListener(exec, value, thisObject)); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionReadAsText(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSFileReader::info()); FileReader& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); ExceptionCode ec = 0; Blob* blob(toBlob(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); size_t argsCount = exec->argumentCount(); if (argsCount <= 1) { impl.readAsText(blob, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); } const String& encoding(exec->argument(1).isEmpty() ? String() : exec->argument(1).toString(exec)->value(exec)); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl.readAsText(blob, encoding, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); }
void JSFileReaderOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { JSFileReader* jsFileReader = jsCast<JSFileReader*>(handle.get().asCell()); DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, &jsFileReader->impl(), jsFileReader); jsFileReader->releaseImpl(); }
JSValue jsFileReaderReadyState(ExecState* exec, JSValue slotBase, const Identifier&) { JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(slotBase)); UNUSED_PARAM(exec); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); JSValue result = jsNumber(imp->readyState()); return result; }
JSValue jsFileReaderError(ExecState* exec, JSValue slotBase, const Identifier&) { JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(slotBase)); UNUSED_PARAM(exec); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->error())); return result; }
void JSFileReader::visitChildren(JSCell* cell, SlotVisitor& visitor) { JSFileReader* thisObject = jsCast<JSFileReader*>(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, info()); COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); Base::visitChildren(thisObject, visitor); thisObject->impl().visitJSEventListeners(visitor); }
bool JSFileReaderOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) { JSFileReader* jsFileReader = static_cast<JSFileReader*>(handle.get().asCell()); if (jsFileReader->impl()->hasPendingActivity()) return true; if (!isObservable(jsFileReader)) return false; UNUSED_PARAM(visitor); return false; }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionAbort(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSFileReader::info()); FileReader& impl = castedThis->impl(); impl.abort(); return JSValue::encode(jsUndefined()); }
EncodedJSValue jsFileReaderError(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); FileReader& impl = castedThis->impl(); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.error())); return JSValue::encode(result); }
EncodedJSValue jsFileReaderReadyState(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); FileReader& impl = castedThis->impl(); JSValue result = jsNumber(impl.readyState()); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionAbort(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSFileReader::s_info)) return throwVMTypeError(exec); JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(thisValue)); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); imp->abort(); return JSValue::encode(jsUndefined()); }
JSValue jsFileReaderOnloadend(ExecState* exec, JSValue slotBase, const Identifier&) { JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(slotBase)); UNUSED_PARAM(exec); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); if (EventListener* listener = imp->onloadend()) { if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) return jsFunction; } } return jsNull(); }
void setJSFileReaderOnloadend(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue) { JSValue value = JSValue::decode(encodedValue); UNUSED_PARAM(exec); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(JSValue::decode(thisValue)); if (!castedThis) { throwVMTypeError(exec); return; } UNUSED_PARAM(exec); FileReader& impl = castedThis->impl(); impl.setOnloadend(createJSAttributeEventListener(exec, value, castedThis)); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionRemoveEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSFileReader::info()); FileReader& impl = castedThis->impl(); JSValue listener = exec->argument(1); if (!listener.isObject()) return JSValue::encode(jsUndefined()); impl.removeEventListener(exec->argument(0).toString(exec)->value(exec), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionReadAsDataURL(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSFileReader::s_info)) return throwVMTypeError(exec); JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(thisValue)); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); Blob* blob(toBlob(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->readAsDataURL(blob); return JSValue::encode(jsUndefined()); }
EncodedJSValue jsFileReaderOnloadend(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName) { JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(JSValue::decode(thisValue)); UNUSED_PARAM(slotBase); if (!castedThis) return throwVMTypeError(exec); UNUSED_PARAM(exec); FileReader& impl = castedThis->impl(); if (EventListener* listener = impl.onloadend()) { if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext())) return JSValue::encode(jsFunction); } } return JSValue::encode(jsNull()); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionReadAsDataURL(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSFileReader::info()); FileReader& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); ExceptionCode ec = 0; Blob* blob(toBlob(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl.readAsDataURL(blob, ec); setDOMException(exec, ec); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionDispatchEvent(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); JSFileReader* castedThis = jsDynamicCast<JSFileReader*>(thisValue); if (!castedThis) return throwVMTypeError(exec); ASSERT_GC_OBJECT_INHERITS(castedThis, JSFileReader::info()); FileReader& impl = castedThis->impl(); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); ExceptionCode ec = 0; Event* evt(toEvent(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = jsBoolean(impl.dispatchEvent(evt, ec)); setDOMException(exec, ec); return JSValue::encode(result); }
EncodedJSValue JSC_HOST_CALL jsFileReaderPrototypeFunctionReadAsText(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSFileReader::s_info)) return throwVMTypeError(exec); JSFileReader* castedThis = static_cast<JSFileReader*>(asObject(thisValue)); FileReader* imp = static_cast<FileReader*>(castedThis->impl()); Blob* blob(toBlob(exec->argument(0))); if (exec->hadException()) return JSValue::encode(jsUndefined()); int argsCount = exec->argumentCount(); if (argsCount <= 1) { imp->readAsText(blob); return JSValue::encode(jsUndefined()); } const String& encoding(ustringToString(exec->argument(1).toString(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); imp->readAsText(blob, encoding); return JSValue::encode(jsUndefined()); }