| /* |
| 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" |
| #include "JSSVGException.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 { |
| |
| // Functions |
| |
| JSC::EncodedJSValue JSC_HOST_CALL jsSVGExceptionPrototypeFunctionToString(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsSVGExceptionCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsSVGExceptionName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsSVGExceptionMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsSVGExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSSVGExceptionConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSSVGExceptionPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSSVGExceptionPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSSVGExceptionPrototype* ptr = new (NotNull, JSC::allocateCell<JSSVGExceptionPrototype>(vm.heap)) JSSVGExceptionPrototype(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: |
| JSSVGExceptionPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSSVGException> JSSVGExceptionConstructor; |
| |
| /* Hash table */ |
| |
| static const struct CompactHashIndex JSSVGExceptionTableIndex[9] = { |
| { -1, -1 }, |
| { 0, 8 }, |
| { -1, -1 }, |
| { -1, -1 }, |
| { -1, -1 }, |
| { -1, -1 }, |
| { -1, -1 }, |
| { 2, -1 }, |
| { 1, -1 }, |
| }; |
| |
| |
| static const HashTableValue JSSVGExceptionTableValues[] = |
| { |
| { "code", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGExceptionCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "name", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGExceptionName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "message", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGExceptionMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| }; |
| |
| static const HashTable JSSVGExceptionTable = { 3, 7, true, JSSVGExceptionTableValues, JSSVGExceptionTableIndex }; |
| /* Hash table for constructor */ |
| |
| static const HashTableValue JSSVGExceptionConstructorTableValues[] = |
| { |
| { "SVG_WRONG_TYPE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "SVG_INVALID_VALUE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "SVG_MATRIX_NOT_INVERTABLE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| }; |
| |
| template<> JSValue JSSVGExceptionConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| UNUSED_PARAM(vm); |
| return globalObject.functionPrototype(); |
| } |
| |
| template<> void JSSVGExceptionConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSSVGException::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("SVGException"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| reifyStaticProperties(vm, JSSVGExceptionConstructorTableValues, *this); |
| } |
| |
| template<> const ClassInfo JSSVGExceptionConstructor::s_info = { "SVGException", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGExceptionConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSSVGExceptionPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSVGExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSVGExceptionConstructor) } }, |
| { "toString", DontEnum | JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsSVGExceptionPrototypeFunctionToString), (intptr_t) (0) } }, |
| { "SVG_WRONG_TYPE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } }, |
| { "SVG_INVALID_VALUE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } }, |
| { "SVG_MATRIX_NOT_INVERTABLE", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } }, |
| }; |
| |
| const ClassInfo JSSVGExceptionPrototype::s_info = { "SVGExceptionPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSVGExceptionPrototype) }; |
| |
| void JSSVGExceptionPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSSVGExceptionPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSSVGException::s_info = { "SVGException", &Base::s_info, &JSSVGExceptionTable, CREATE_METHOD_TABLE(JSSVGException) }; |
| |
| JSSVGException::JSSVGException(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SVGException>&& impl) |
| : JSDOMWrapper<SVGException>(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSSVGException::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSSVGExceptionPrototype::create(vm, globalObject, JSSVGExceptionPrototype::createStructure(vm, globalObject, globalObject->errorPrototype())); |
| } |
| |
| JSObject* JSSVGException::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSSVGException>(vm, globalObject); |
| } |
| |
| void JSSVGException::destroy(JSC::JSCell* cell) |
| { |
| JSSVGException* thisObject = static_cast<JSSVGException*>(cell); |
| thisObject->JSSVGException::~JSSVGException(); |
| } |
| |
| EncodedJSValue jsSVGExceptionCode(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<JSSVGException*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "SVGException", "code"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.code()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsSVGExceptionName(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<JSSVGException*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "SVGException", "name"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.name()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsSVGExceptionMessage(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<JSSVGException*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "SVGException", "message"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.message()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsSVGExceptionConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSSVGExceptionPrototype* domObject = jsDynamicCast<JSSVGExceptionPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSSVGException::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSSVGExceptionConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSSVGExceptionPrototype* domObject = jsDynamicCast<JSSVGExceptionPrototype*>(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 JSSVGException::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSSVGExceptionConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsSVGExceptionPrototypeFunctionToString(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSSVGException*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "SVGException", "toString"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSSVGException::info()); |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.toString()); |
| return JSValue::encode(result); |
| } |
| |
| bool JSSVGExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| UNUSED_PARAM(handle); |
| UNUSED_PARAM(visitor); |
| return false; |
| } |
| |
| void JSSVGExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsSVGException = jsCast<JSSVGException*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsSVGException->wrapped(), jsSVGException); |
| } |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SVGException>&& 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 SVGException. |
| static_assert(!__is_polymorphic(SVGException), "SVGException is polymorphic but the IDL claims it is not"); |
| #endif |
| return createWrapper<SVGException>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SVGException& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| SVGException* JSSVGException::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSSVGException*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |