| /* |
| 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 "JSTestDefaultToJSONInherit.h" |
| |
| #include "ActiveDOMObject.h" |
| #include "ExtendedDOMClientIsoSubspaces.h" |
| #include "ExtendedDOMIsoSubspaces.h" |
| #include "JSDOMAttribute.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructorNotConstructable.h" |
| #include "JSDOMConvertBoolean.h" |
| #include "JSDOMConvertInterface.h" |
| #include "JSDOMConvertNullable.h" |
| #include "JSDOMConvertNumbers.h" |
| #include "JSDOMConvertRecord.h" |
| #include "JSDOMConvertSequences.h" |
| #include "JSDOMConvertStrings.h" |
| #include "JSDOMExceptionHandling.h" |
| #include "JSDOMGlobalObject.h" |
| #include "JSDOMGlobalObjectInlines.h" |
| #include "JSDOMOperation.h" |
| #include "JSDOMWrapperCache.h" |
| #include "JSTestDefaultToJSONIndirectInheritance.h" |
| #include "JSTestDefaultToJSONInheritFinal.h" |
| #include "RuntimeEnabledFeatures.h" |
| #include "ScriptExecutionContext.h" |
| #include "WebCoreJSClientData.h" |
| #include <JavaScriptCore/HeapAnalyzer.h> |
| #include <JavaScriptCore/JSArray.h> |
| #include <JavaScriptCore/JSCInlines.h> |
| #include <JavaScriptCore/JSDestructibleObjectHeapCellType.h> |
| #include <JavaScriptCore/ObjectConstructor.h> |
| #include <JavaScriptCore/SlotVisitorMacros.h> |
| #include <JavaScriptCore/SubspaceInlines.h> |
| #include <wtf/GetPtr.h> |
| #include <wtf/PointerPreparations.h> |
| #include <wtf/URL.h> |
| #include <wtf/Vector.h> |
| |
| #if ENABLE(TEST_CONDITIONAL) |
| #include "JSDOMConvertEnumeration.h" |
| #include "JSTestDefaultToJSONEnum.h" |
| #endif |
| |
| |
| namespace WebCore { |
| using namespace JSC; |
| |
| // Functions |
| |
| static JSC_DECLARE_HOST_FUNCTION(jsTestDefaultToJSONInheritPrototypeFunction_toJSON); |
| |
| // Attributes |
| |
| static JSC_DECLARE_CUSTOM_GETTER(jsTestDefaultToJSONInheritConstructor); |
| static JSC_DECLARE_CUSTOM_GETTER(jsTestDefaultToJSONInherit_inheritLongAttribute); |
| static JSC_DECLARE_CUSTOM_SETTER(setJSTestDefaultToJSONInherit_inheritLongAttribute); |
| |
| class JSTestDefaultToJSONInheritPrototype final : public JSC::JSNonFinalObject { |
| public: |
| using Base = JSC::JSNonFinalObject; |
| static JSTestDefaultToJSONInheritPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSTestDefaultToJSONInheritPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestDefaultToJSONInheritPrototype>(vm)) JSTestDefaultToJSONInheritPrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| template<typename CellType, JSC::SubspaceAccess> |
| static JSC::GCClient::IsoSubspace* subspaceFor(JSC::VM& vm) |
| { |
| STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestDefaultToJSONInheritPrototype, Base); |
| return &vm.plainObjectSpace(); |
| } |
| 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: |
| JSTestDefaultToJSONInheritPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestDefaultToJSONInheritPrototype, JSTestDefaultToJSONInheritPrototype::Base); |
| |
| using JSTestDefaultToJSONInheritDOMConstructor = JSDOMConstructorNotConstructable<JSTestDefaultToJSONInherit>; |
| |
| template<> const ClassInfo JSTestDefaultToJSONInheritDOMConstructor::s_info = { "TestDefaultToJSONInherit"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestDefaultToJSONInheritDOMConstructor) }; |
| |
| template<> JSValue JSTestDefaultToJSONInheritDOMConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSTestDefaultToJSON::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSTestDefaultToJSONInheritDOMConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| JSString* nameString = jsNontrivialString(vm, "TestDefaultToJSONInherit"_s); |
| m_originalName.set(vm, this, nameString); |
| putDirect(vm, vm.propertyNames->name, nameString, JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| putDirect(vm, vm.propertyNames->prototype, JSTestDefaultToJSONInherit::prototype(vm, globalObject), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum | JSC::PropertyAttribute::DontDelete); |
| } |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSTestDefaultToJSONInheritPrototypeTableValues[] = |
| { |
| { "constructor"_s, static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestDefaultToJSONInheritConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "inheritLongAttribute"_s, static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestDefaultToJSONInherit_inheritLongAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestDefaultToJSONInherit_inheritLongAttribute) } }, |
| { "toJSON"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestDefaultToJSONInheritPrototypeFunction_toJSON), (intptr_t) (0) } }, |
| }; |
| |
| const ClassInfo JSTestDefaultToJSONInheritPrototype::s_info = { "TestDefaultToJSONInherit"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestDefaultToJSONInheritPrototype) }; |
| |
| void JSTestDefaultToJSONInheritPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSTestDefaultToJSONInherit::info(), JSTestDefaultToJSONInheritPrototypeTableValues, *this); |
| JSC_TO_STRING_TAG_WITHOUT_TRANSITION(); |
| } |
| |
| const ClassInfo JSTestDefaultToJSONInherit::s_info = { "TestDefaultToJSONInherit"_s, &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestDefaultToJSONInherit) }; |
| |
| JSTestDefaultToJSONInherit::JSTestDefaultToJSONInherit(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestDefaultToJSONInherit>&& impl) |
| : JSTestDefaultToJSON(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| void JSTestDefaultToJSONInherit::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| ASSERT(inherits(info())); |
| |
| static_assert(!std::is_base_of<ActiveDOMObject, TestDefaultToJSONInherit>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject."); |
| |
| } |
| |
| JSObject* JSTestDefaultToJSONInherit::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| return JSTestDefaultToJSONInheritPrototype::create(vm, &globalObject, JSTestDefaultToJSONInheritPrototype::createStructure(vm, &globalObject, JSTestDefaultToJSON::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSTestDefaultToJSONInherit::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| return getDOMPrototype<JSTestDefaultToJSONInherit>(vm, globalObject); |
| } |
| |
| JSValue JSTestDefaultToJSONInherit::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSTestDefaultToJSONInheritDOMConstructor, DOMConstructorID::TestDefaultToJSONInherit>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| JSC_DEFINE_CUSTOM_GETTER(jsTestDefaultToJSONInheritConstructor, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)) |
| { |
| VM& vm = JSC::getVM(lexicalGlobalObject); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| auto* prototype = jsDynamicCast<JSTestDefaultToJSONInheritPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!prototype)) |
| return throwVMTypeError(lexicalGlobalObject, throwScope); |
| return JSValue::encode(JSTestDefaultToJSONInherit::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject())); |
| } |
| |
| static inline JSValue jsTestDefaultToJSONInherit_inheritLongAttributeGetter(JSGlobalObject& lexicalGlobalObject, JSTestDefaultToJSONInherit& thisObject) |
| { |
| auto& vm = JSC::getVM(&lexicalGlobalObject); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| auto& impl = thisObject.wrapped(); |
| RELEASE_AND_RETURN(throwScope, (toJS<IDLLong>(lexicalGlobalObject, throwScope, impl.inheritLongAttribute()))); |
| } |
| |
| JSC_DEFINE_CUSTOM_GETTER(jsTestDefaultToJSONInherit_inheritLongAttribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName attributeName)) |
| { |
| return IDLAttribute<JSTestDefaultToJSONInherit>::get<jsTestDefaultToJSONInherit_inheritLongAttributeGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, attributeName); |
| } |
| |
| static inline bool setJSTestDefaultToJSONInherit_inheritLongAttributeSetter(JSGlobalObject& lexicalGlobalObject, JSTestDefaultToJSONInherit& thisObject, JSValue value) |
| { |
| auto& vm = JSC::getVM(&lexicalGlobalObject); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| auto& impl = thisObject.wrapped(); |
| auto nativeValue = convert<IDLLong>(lexicalGlobalObject, value); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| invokeFunctorPropagatingExceptionIfNecessary(lexicalGlobalObject, throwScope, [&] { |
| return impl.setInheritLongAttribute(WTFMove(nativeValue)); |
| }); |
| return true; |
| } |
| |
| JSC_DEFINE_CUSTOM_SETTER(setJSTestDefaultToJSONInherit_inheritLongAttribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue, PropertyName attributeName)) |
| { |
| return IDLAttribute<JSTestDefaultToJSONInherit>::set<setJSTestDefaultToJSONInherit_inheritLongAttributeSetter>(*lexicalGlobalObject, thisValue, encodedValue, attributeName); |
| } |
| |
| static inline EncodedJSValue jsTestDefaultToJSONInheritPrototypeFunction_toJSONBody(JSGlobalObject* lexicalGlobalObject, CallFrame*, JSTestDefaultToJSONInherit* castedThis) |
| { |
| auto& vm = JSC::getVM(lexicalGlobalObject); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| auto& impl = castedThis->wrapped(); |
| auto* result = constructEmptyObject(lexicalGlobalObject, castedThis->globalObject()->objectPrototype()); |
| if (RuntimeEnabledFeatures::sharedFeatures().testRuntimeEnabledEnabled()) { |
| auto longAttributeValue = toJS<IDLLong>(*lexicalGlobalObject, throwScope, impl.longAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "longAttribute"_s), longAttributeValue); |
| } |
| if (jsCast<JSDOMGlobalObject*>(castedThis->globalObject())->scriptExecutionContext()->settingsValues().testSettingEnabled) { |
| auto enabledBySettingsAttributeValue = toJS<IDLUnsignedShort>(*lexicalGlobalObject, throwScope, impl.enabledBySettingsAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "enabledBySettingsAttribute"_s), enabledBySettingsAttributeValue); |
| } |
| #if ENABLE(TEST_CONDITIONAL) |
| auto enabledByConditionalAttributeValue = toJS<IDLEnumeration<TestDefaultToJSONEnum>>(*lexicalGlobalObject, throwScope, impl.enabledByConditionalAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "enabledByConditionalAttribute"_s), enabledByConditionalAttributeValue); |
| #endif |
| |
| auto firstStringAttributeValue = toJS<IDLDOMString>(*lexicalGlobalObject, throwScope, impl.firstStringAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "firstStringAttribute"_s), firstStringAttributeValue); |
| auto secondLongAttributeValue = toJS<IDLLong>(*lexicalGlobalObject, throwScope, impl.secondLongAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "secondLongAttribute"_s), secondLongAttributeValue); |
| auto fourthUnrestrictedDoubleAttributeValue = toJS<IDLUnrestrictedDouble>(*lexicalGlobalObject, throwScope, impl.fourthUnrestrictedDoubleAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "fourthUnrestrictedDoubleAttribute"_s), fourthUnrestrictedDoubleAttributeValue); |
| auto fifthLongClampedAttributeValue = toJS<IDLClampAdaptor<IDLLong>>(*lexicalGlobalObject, throwScope, impl.fifthLongClampedAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "fifthLongClampedAttribute"_s), fifthLongClampedAttributeValue); |
| auto sixthTypedefAttributeValue = toJS<IDLDouble>(*lexicalGlobalObject, throwScope, impl.sixthTypedefAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "sixthTypedefAttribute"_s), sixthTypedefAttributeValue); |
| auto seventhDirectlyToJSONableAttributeValue = toJS<IDLInterface<TestDefaultToJSONInheritFinal>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.seventhDirectlyToJSONableAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "seventhDirectlyToJSONableAttribute"_s), seventhDirectlyToJSONableAttributeValue); |
| auto eighthIndirectlyAttributeValue = toJS<IDLInterface<TestDefaultToJSONIndirectInheritance>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.eighthIndirectlyAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "eighthIndirectlyAttribute"_s), eighthIndirectlyAttributeValue); |
| auto ninthOptionalDirectlyToJSONableAttributeValue = toJS<IDLNullable<IDLInterface<TestDefaultToJSONInheritFinal>>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.ninthOptionalDirectlyToJSONableAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "ninthOptionalDirectlyToJSONableAttribute"_s), ninthOptionalDirectlyToJSONableAttributeValue); |
| auto tenthFrozenArrayAttributeValue = toJS<IDLFrozenArray<IDLBoolean>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.tenthFrozenArrayAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "tenthFrozenArrayAttribute"_s), tenthFrozenArrayAttributeValue); |
| auto eleventhSequenceAttributeValue = toJS<IDLSequence<IDLDOMString>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.eleventhSequenceAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "eleventhSequenceAttribute"_s), eleventhSequenceAttributeValue); |
| auto twelfthInterfaceSequenceAttributeValue = toJS<IDLSequence<IDLInterface<TestDefaultToJSONInheritFinal>>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.twelfthInterfaceSequenceAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "twelfthInterfaceSequenceAttribute"_s), twelfthInterfaceSequenceAttributeValue); |
| auto thirteenthRecordAttributeValue = toJS<IDLRecord<IDLDOMString, IDLUnsignedShort>>(*lexicalGlobalObject, *castedThis->globalObject(), throwScope, impl.thirteenthRecordAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "thirteenthRecordAttribute"_s), thirteenthRecordAttributeValue); |
| auto inheritLongAttributeValue = toJS<IDLLong>(*lexicalGlobalObject, throwScope, impl.inheritLongAttribute()); |
| RETURN_IF_EXCEPTION(throwScope, { }); |
| result->putDirect(vm, Identifier::fromString(vm, "inheritLongAttribute"_s), inheritLongAttributeValue); |
| return JSValue::encode(result); |
| } |
| |
| JSC_DEFINE_HOST_FUNCTION(jsTestDefaultToJSONInheritPrototypeFunction_toJSON, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)) |
| { |
| return IDLOperation<JSTestDefaultToJSONInherit>::call<jsTestDefaultToJSONInheritPrototypeFunction_toJSONBody>(*lexicalGlobalObject, *callFrame, "toJSON"); |
| } |
| |
| JSC::GCClient::IsoSubspace* JSTestDefaultToJSONInherit::subspaceForImpl(JSC::VM& vm) |
| { |
| return WebCore::subspaceForImpl<JSTestDefaultToJSONInherit, UseCustomHeapCellType::No>(vm, |
| [] (auto& spaces) { return spaces.m_clientSubspaceForTestDefaultToJSONInherit.get(); }, |
| [] (auto& spaces, auto&& space) { spaces.m_clientSubspaceForTestDefaultToJSONInherit = WTFMove(space); }, |
| [] (auto& spaces) { return spaces.m_subspaceForTestDefaultToJSONInherit.get(); }, |
| [] (auto& spaces, auto&& space) { spaces.m_subspaceForTestDefaultToJSONInherit = WTFMove(space); } |
| ); |
| } |
| |
| void JSTestDefaultToJSONInherit::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer) |
| { |
| auto* thisObject = jsCast<JSTestDefaultToJSONInherit*>(cell); |
| analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| if (thisObject->scriptExecutionContext()) |
| analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| Base::analyzeHeap(cell, analyzer); |
| } |
| |
| |
| } |