| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| |
| #if ENABLE(MEDIA_STREAM) |
| |
| #include "JSOverconstrainedError.h" |
| |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "URL.h" |
| #include <runtime/Error.h> |
| #include <runtime/FunctionPrototype.h> |
| #include <runtime/JSString.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsOverconstrainedErrorMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsOverconstrainedErrorConstraint(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsOverconstrainedErrorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSOverconstrainedErrorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSOverconstrainedErrorPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSOverconstrainedErrorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSOverconstrainedErrorPrototype* ptr = new (NotNull, JSC::allocateCell<JSOverconstrainedErrorPrototype>(vm.heap)) JSOverconstrainedErrorPrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| { |
| return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| } |
| |
| private: |
| JSOverconstrainedErrorPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructor<JSOverconstrainedError> JSOverconstrainedErrorConstructor; |
| |
| /* Hash table */ |
| |
| static const struct CompactHashIndex JSOverconstrainedErrorTableIndex[4] = { |
| { -1, -1 }, |
| { -1, -1 }, |
| { 1, -1 }, |
| { 0, -1 }, |
| }; |
| |
| |
| static const HashTableValue JSOverconstrainedErrorTableValues[] = |
| { |
| { "message", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsOverconstrainedErrorMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "constraint", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsOverconstrainedErrorConstraint), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| }; |
| |
| static const HashTable JSOverconstrainedErrorTable = { 2, 3, true, JSOverconstrainedErrorTableValues, JSOverconstrainedErrorTableIndex }; |
| template<> EncodedJSValue JSC_HOST_CALL JSOverconstrainedErrorConstructor::construct(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| auto* castedThis = jsCast<JSOverconstrainedErrorConstructor*>(state->callee()); |
| ASSERT(castedThis); |
| auto constraint = state->argument(0).isUndefined() ? emptyString() : state->uncheckedArgument(0).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto message = state->argument(1).isUndefined() ? emptyString() : state->uncheckedArgument(1).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto object = OverconstrainedError::create(WTFMove(constraint), WTFMove(message)); |
| return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); |
| } |
| |
| template<> JSValue JSOverconstrainedErrorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| UNUSED_PARAM(vm); |
| return globalObject.functionPrototype(); |
| } |
| |
| template<> void JSOverconstrainedErrorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSOverconstrainedError::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("OverconstrainedError"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSOverconstrainedErrorConstructor::s_info = { "OverconstrainedError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSOverconstrainedErrorConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSOverconstrainedErrorPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsOverconstrainedErrorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOverconstrainedErrorConstructor) } }, |
| }; |
| |
| const ClassInfo JSOverconstrainedErrorPrototype::s_info = { "OverconstrainedErrorPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSOverconstrainedErrorPrototype) }; |
| |
| void JSOverconstrainedErrorPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSOverconstrainedErrorPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSOverconstrainedError::s_info = { "OverconstrainedError", &Base::s_info, &JSOverconstrainedErrorTable, CREATE_METHOD_TABLE(JSOverconstrainedError) }; |
| |
| JSOverconstrainedError::JSOverconstrainedError(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OverconstrainedError>&& impl) |
| : JSDOMWrapper<OverconstrainedError>(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSOverconstrainedError::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSOverconstrainedErrorPrototype::create(vm, globalObject, JSOverconstrainedErrorPrototype::createStructure(vm, globalObject, globalObject->errorPrototype())); |
| } |
| |
| JSObject* JSOverconstrainedError::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSOverconstrainedError>(vm, globalObject); |
| } |
| |
| void JSOverconstrainedError::destroy(JSC::JSCell* cell) |
| { |
| JSOverconstrainedError* thisObject = static_cast<JSOverconstrainedError*>(cell); |
| thisObject->JSOverconstrainedError::~JSOverconstrainedError(); |
| } |
| |
| EncodedJSValue jsOverconstrainedErrorMessage(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSOverconstrainedError*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "OverconstrainedError", "message"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.message()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsOverconstrainedErrorConstraint(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSOverconstrainedError*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "OverconstrainedError", "constraint"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.constraint()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsOverconstrainedErrorConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSOverconstrainedErrorPrototype* domObject = jsDynamicCast<JSOverconstrainedErrorPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSOverconstrainedError::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSOverconstrainedErrorConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSOverconstrainedErrorPrototype* domObject = jsDynamicCast<JSOverconstrainedErrorPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) { |
| throwVMTypeError(state, throwScope); |
| return false; |
| } |
| // Shadowing a built-in constructor |
| return domObject->putDirect(state->vm(), state->propertyNames().constructor, value); |
| } |
| |
| JSValue JSOverconstrainedError::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSOverconstrainedErrorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| bool JSOverconstrainedErrorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| UNUSED_PARAM(handle); |
| UNUSED_PARAM(visitor); |
| return false; |
| } |
| |
| void JSOverconstrainedErrorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsOverconstrainedError = jsCast<JSOverconstrainedError*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsOverconstrainedError->wrapped(), jsOverconstrainedError); |
| } |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<OverconstrainedError>&& impl) |
| { |
| #if COMPILER(CLANG) |
| // If you hit this failure the interface definition has the ImplementationLacksVTable |
| // attribute. You should remove that attribute. If the class has subclasses |
| // that may be passed through this toJS() function you should use the SkipVTableValidation |
| // attribute to OverconstrainedError. |
| static_assert(!__is_polymorphic(OverconstrainedError), "OverconstrainedError is polymorphic but the IDL claims it is not"); |
| #endif |
| return createWrapper<OverconstrainedError>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, OverconstrainedError& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| OverconstrainedError* JSOverconstrainedError::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSOverconstrainedError*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |
| |
| #endif // ENABLE(MEDIA_STREAM) |