1/*
2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "config.h"
22
23#if ENABLE(WEB_AUTHN)
24
25#include "JSAuthenticatorAssertionResponse.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertBufferSource.h"
31#include "JSDOMConvertNullable.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMWrapperCache.h"
35#include "ScriptExecutionContext.h"
36#include <JavaScriptCore/HeapSnapshotBuilder.h>
37#include <JavaScriptCore/JSCInlines.h>
38#include <wtf/GetPtr.h>
39#include <wtf/PointerPreparations.h>
40#include <wtf/URL.h>
41
42
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsAuthenticatorAssertionResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSAuthenticatorAssertionResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsAuthenticatorAssertionResponseAuthenticatorData(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsAuthenticatorAssertionResponseSignature(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsAuthenticatorAssertionResponseUserHandle(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53
54class JSAuthenticatorAssertionResponsePrototype : public JSC::JSNonFinalObject {
55public:
56 using Base = JSC::JSNonFinalObject;
57 static JSAuthenticatorAssertionResponsePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58 {
59 JSAuthenticatorAssertionResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSAuthenticatorAssertionResponsePrototype>(vm.heap)) JSAuthenticatorAssertionResponsePrototype(vm, globalObject, structure);
60 ptr->finishCreation(vm);
61 return ptr;
62 }
63
64 DECLARE_INFO;
65 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66 {
67 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68 }
69
70private:
71 JSAuthenticatorAssertionResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72 : JSC::JSNonFinalObject(vm, structure)
73 {
74 }
75
76 void finishCreation(JSC::VM&);
77};
78
79using JSAuthenticatorAssertionResponseConstructor = JSDOMConstructorNotConstructable<JSAuthenticatorAssertionResponse>;
80
81template<> JSValue JSAuthenticatorAssertionResponseConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
82{
83 return JSAuthenticatorResponse::getConstructor(vm, &globalObject);
84}
85
86template<> void JSAuthenticatorAssertionResponseConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
87{
88 putDirect(vm, vm.propertyNames->prototype, JSAuthenticatorAssertionResponse::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
89 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AuthenticatorAssertionResponse"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91}
92
93template<> const ClassInfo JSAuthenticatorAssertionResponseConstructor::s_info = { "AuthenticatorAssertionResponse", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorAssertionResponseConstructor) };
94
95/* Hash table for prototype */
96
97static const HashTableValue JSAuthenticatorAssertionResponsePrototypeTableValues[] =
98{
99 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorAssertionResponseConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAuthenticatorAssertionResponseConstructor) } },
100 { "authenticatorData", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorAssertionResponseAuthenticatorData), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
101 { "signature", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorAssertionResponseSignature), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
102 { "userHandle", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorAssertionResponseUserHandle), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
103};
104
105const ClassInfo JSAuthenticatorAssertionResponsePrototype::s_info = { "AuthenticatorAssertionResponsePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorAssertionResponsePrototype) };
106
107void JSAuthenticatorAssertionResponsePrototype::finishCreation(VM& vm)
108{
109 Base::finishCreation(vm);
110 reifyStaticProperties(vm, JSAuthenticatorAssertionResponse::info(), JSAuthenticatorAssertionResponsePrototypeTableValues, *this);
111}
112
113const ClassInfo JSAuthenticatorAssertionResponse::s_info = { "AuthenticatorAssertionResponse", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorAssertionResponse) };
114
115JSAuthenticatorAssertionResponse::JSAuthenticatorAssertionResponse(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AuthenticatorAssertionResponse>&& impl)
116 : JSAuthenticatorResponse(structure, globalObject, WTFMove(impl))
117{
118}
119
120void JSAuthenticatorAssertionResponse::finishCreation(VM& vm)
121{
122 Base::finishCreation(vm);
123 ASSERT(inherits(vm, info()));
124
125}
126
127JSObject* JSAuthenticatorAssertionResponse::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
128{
129 return JSAuthenticatorAssertionResponsePrototype::create(vm, &globalObject, JSAuthenticatorAssertionResponsePrototype::createStructure(vm, &globalObject, JSAuthenticatorResponse::prototype(vm, globalObject)));
130}
131
132JSObject* JSAuthenticatorAssertionResponse::prototype(VM& vm, JSDOMGlobalObject& globalObject)
133{
134 return getDOMPrototype<JSAuthenticatorAssertionResponse>(vm, globalObject);
135}
136
137JSValue JSAuthenticatorAssertionResponse::getConstructor(VM& vm, const JSGlobalObject* globalObject)
138{
139 return getDOMConstructor<JSAuthenticatorAssertionResponseConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
140}
141
142template<> inline JSAuthenticatorAssertionResponse* IDLAttribute<JSAuthenticatorAssertionResponse>::cast(ExecState& state, EncodedJSValue thisValue)
143{
144 return jsDynamicCast<JSAuthenticatorAssertionResponse*>(state.vm(), JSValue::decode(thisValue));
145}
146
147EncodedJSValue jsAuthenticatorAssertionResponseConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
148{
149 VM& vm = state->vm();
150 auto throwScope = DECLARE_THROW_SCOPE(vm);
151 auto* prototype = jsDynamicCast<JSAuthenticatorAssertionResponsePrototype*>(vm, JSValue::decode(thisValue));
152 if (UNLIKELY(!prototype))
153 return throwVMTypeError(state, throwScope);
154 return JSValue::encode(JSAuthenticatorAssertionResponse::getConstructor(state->vm(), prototype->globalObject()));
155}
156
157bool setJSAuthenticatorAssertionResponseConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
158{
159 VM& vm = state->vm();
160 auto throwScope = DECLARE_THROW_SCOPE(vm);
161 auto* prototype = jsDynamicCast<JSAuthenticatorAssertionResponsePrototype*>(vm, JSValue::decode(thisValue));
162 if (UNLIKELY(!prototype)) {
163 throwVMTypeError(state, throwScope);
164 return false;
165 }
166 // Shadowing a built-in constructor
167 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
168}
169
170static inline JSValue jsAuthenticatorAssertionResponseAuthenticatorDataGetter(ExecState& state, JSAuthenticatorAssertionResponse& thisObject, ThrowScope& throwScope)
171{
172 UNUSED_PARAM(throwScope);
173 UNUSED_PARAM(state);
174 auto& impl = thisObject.wrapped();
175 JSValue result = toJS<IDLArrayBuffer>(state, *thisObject.globalObject(), throwScope, impl.authenticatorData());
176 return result;
177}
178
179EncodedJSValue jsAuthenticatorAssertionResponseAuthenticatorData(ExecState* state, EncodedJSValue thisValue, PropertyName)
180{
181 return IDLAttribute<JSAuthenticatorAssertionResponse>::get<jsAuthenticatorAssertionResponseAuthenticatorDataGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "authenticatorData");
182}
183
184static inline JSValue jsAuthenticatorAssertionResponseSignatureGetter(ExecState& state, JSAuthenticatorAssertionResponse& thisObject, ThrowScope& throwScope)
185{
186 UNUSED_PARAM(throwScope);
187 UNUSED_PARAM(state);
188 auto& impl = thisObject.wrapped();
189 JSValue result = toJS<IDLArrayBuffer>(state, *thisObject.globalObject(), throwScope, impl.signature());
190 return result;
191}
192
193EncodedJSValue jsAuthenticatorAssertionResponseSignature(ExecState* state, EncodedJSValue thisValue, PropertyName)
194{
195 return IDLAttribute<JSAuthenticatorAssertionResponse>::get<jsAuthenticatorAssertionResponseSignatureGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "signature");
196}
197
198static inline JSValue jsAuthenticatorAssertionResponseUserHandleGetter(ExecState& state, JSAuthenticatorAssertionResponse& thisObject, ThrowScope& throwScope)
199{
200 UNUSED_PARAM(throwScope);
201 UNUSED_PARAM(state);
202 auto& impl = thisObject.wrapped();
203 JSValue result = toJS<IDLNullable<IDLArrayBuffer>>(state, *thisObject.globalObject(), throwScope, impl.userHandle());
204 return result;
205}
206
207EncodedJSValue jsAuthenticatorAssertionResponseUserHandle(ExecState* state, EncodedJSValue thisValue, PropertyName)
208{
209 return IDLAttribute<JSAuthenticatorAssertionResponse>::get<jsAuthenticatorAssertionResponseUserHandleGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "userHandle");
210}
211
212void JSAuthenticatorAssertionResponse::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
213{
214 auto* thisObject = jsCast<JSAuthenticatorAssertionResponse*>(cell);
215 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
216 if (thisObject->scriptExecutionContext())
217 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
218 Base::heapSnapshot(cell, builder);
219}
220
221
222}
223
224#endif // ENABLE(WEB_AUTHN)
225