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 "JSAuthenticatorResponse.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertBufferSource.h" |
31 | #include "JSDOMExceptionHandling.h" |
32 | #include "JSDOMGlobalObject.h" |
33 | #include "JSDOMWrapperCache.h" |
34 | #include "ScriptExecutionContext.h" |
35 | #include <JavaScriptCore/FunctionPrototype.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 | |
43 | namespace WebCore { |
44 | using namespace JSC; |
45 | |
46 | // Attributes |
47 | |
48 | JSC::EncodedJSValue jsAuthenticatorResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
49 | bool setJSAuthenticatorResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
50 | JSC::EncodedJSValue jsAuthenticatorResponseClientDataJSON(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
51 | |
52 | class JSAuthenticatorResponsePrototype : public JSC::JSNonFinalObject { |
53 | public: |
54 | using Base = JSC::JSNonFinalObject; |
55 | static JSAuthenticatorResponsePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
56 | { |
57 | JSAuthenticatorResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSAuthenticatorResponsePrototype>(vm.heap)) JSAuthenticatorResponsePrototype(vm, globalObject, structure); |
58 | ptr->finishCreation(vm); |
59 | return ptr; |
60 | } |
61 | |
62 | DECLARE_INFO; |
63 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
64 | { |
65 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
66 | } |
67 | |
68 | private: |
69 | JSAuthenticatorResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
70 | : JSC::JSNonFinalObject(vm, structure) |
71 | { |
72 | } |
73 | |
74 | void finishCreation(JSC::VM&); |
75 | }; |
76 | |
77 | using JSAuthenticatorResponseConstructor = JSDOMConstructorNotConstructable<JSAuthenticatorResponse>; |
78 | |
79 | template<> JSValue JSAuthenticatorResponseConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
80 | { |
81 | UNUSED_PARAM(vm); |
82 | return globalObject.functionPrototype(); |
83 | } |
84 | |
85 | template<> void JSAuthenticatorResponseConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
86 | { |
87 | putDirect(vm, vm.propertyNames->prototype, JSAuthenticatorResponse::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
88 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AuthenticatorResponse"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
89 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
90 | } |
91 | |
92 | template<> const ClassInfo JSAuthenticatorResponseConstructor::s_info = { "AuthenticatorResponse" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorResponseConstructor) }; |
93 | |
94 | /* Hash table for prototype */ |
95 | |
96 | static const HashTableValue JSAuthenticatorResponsePrototypeTableValues[] = |
97 | { |
98 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorResponseConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAuthenticatorResponseConstructor) } }, |
99 | { "clientDataJSON" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAuthenticatorResponseClientDataJSON), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
100 | }; |
101 | |
102 | const ClassInfo JSAuthenticatorResponsePrototype::s_info = { "AuthenticatorResponsePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorResponsePrototype) }; |
103 | |
104 | void JSAuthenticatorResponsePrototype::finishCreation(VM& vm) |
105 | { |
106 | Base::finishCreation(vm); |
107 | reifyStaticProperties(vm, JSAuthenticatorResponse::info(), JSAuthenticatorResponsePrototypeTableValues, *this); |
108 | } |
109 | |
110 | const ClassInfo JSAuthenticatorResponse::s_info = { "AuthenticatorResponse" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAuthenticatorResponse) }; |
111 | |
112 | JSAuthenticatorResponse::JSAuthenticatorResponse(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AuthenticatorResponse>&& impl) |
113 | : JSDOMWrapper<AuthenticatorResponse>(structure, globalObject, WTFMove(impl)) |
114 | { |
115 | } |
116 | |
117 | void JSAuthenticatorResponse::finishCreation(VM& vm) |
118 | { |
119 | Base::finishCreation(vm); |
120 | ASSERT(inherits(vm, info())); |
121 | |
122 | } |
123 | |
124 | JSObject* JSAuthenticatorResponse::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
125 | { |
126 | return JSAuthenticatorResponsePrototype::create(vm, &globalObject, JSAuthenticatorResponsePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
127 | } |
128 | |
129 | JSObject* JSAuthenticatorResponse::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
130 | { |
131 | return getDOMPrototype<JSAuthenticatorResponse>(vm, globalObject); |
132 | } |
133 | |
134 | JSValue JSAuthenticatorResponse::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
135 | { |
136 | return getDOMConstructor<JSAuthenticatorResponseConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
137 | } |
138 | |
139 | void JSAuthenticatorResponse::destroy(JSC::JSCell* cell) |
140 | { |
141 | JSAuthenticatorResponse* thisObject = static_cast<JSAuthenticatorResponse*>(cell); |
142 | thisObject->JSAuthenticatorResponse::~JSAuthenticatorResponse(); |
143 | } |
144 | |
145 | template<> inline JSAuthenticatorResponse* IDLAttribute<JSAuthenticatorResponse>::cast(ExecState& state, EncodedJSValue thisValue) |
146 | { |
147 | return jsDynamicCast<JSAuthenticatorResponse*>(state.vm(), JSValue::decode(thisValue)); |
148 | } |
149 | |
150 | EncodedJSValue jsAuthenticatorResponseConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
151 | { |
152 | VM& vm = state->vm(); |
153 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
154 | auto* prototype = jsDynamicCast<JSAuthenticatorResponsePrototype*>(vm, JSValue::decode(thisValue)); |
155 | if (UNLIKELY(!prototype)) |
156 | return throwVMTypeError(state, throwScope); |
157 | return JSValue::encode(JSAuthenticatorResponse::getConstructor(state->vm(), prototype->globalObject())); |
158 | } |
159 | |
160 | bool setJSAuthenticatorResponseConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
161 | { |
162 | VM& vm = state->vm(); |
163 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
164 | auto* prototype = jsDynamicCast<JSAuthenticatorResponsePrototype*>(vm, JSValue::decode(thisValue)); |
165 | if (UNLIKELY(!prototype)) { |
166 | throwVMTypeError(state, throwScope); |
167 | return false; |
168 | } |
169 | // Shadowing a built-in constructor |
170 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
171 | } |
172 | |
173 | static inline JSValue jsAuthenticatorResponseClientDataJSONGetter(ExecState& state, JSAuthenticatorResponse& thisObject, ThrowScope& throwScope) |
174 | { |
175 | UNUSED_PARAM(throwScope); |
176 | UNUSED_PARAM(state); |
177 | auto& impl = thisObject.wrapped(); |
178 | JSValue result = toJS<IDLArrayBuffer>(state, *thisObject.globalObject(), throwScope, impl.clientDataJSON()); |
179 | return result; |
180 | } |
181 | |
182 | EncodedJSValue jsAuthenticatorResponseClientDataJSON(ExecState* state, EncodedJSValue thisValue, PropertyName) |
183 | { |
184 | return IDLAttribute<JSAuthenticatorResponse>::get<jsAuthenticatorResponseClientDataJSONGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "clientDataJSON" ); |
185 | } |
186 | |
187 | void JSAuthenticatorResponse::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
188 | { |
189 | auto* thisObject = jsCast<JSAuthenticatorResponse*>(cell); |
190 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
191 | if (thisObject->scriptExecutionContext()) |
192 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
193 | Base::heapSnapshot(cell, builder); |
194 | } |
195 | |
196 | bool JSAuthenticatorResponseOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
197 | { |
198 | UNUSED_PARAM(handle); |
199 | UNUSED_PARAM(visitor); |
200 | UNUSED_PARAM(reason); |
201 | return false; |
202 | } |
203 | |
204 | void JSAuthenticatorResponseOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
205 | { |
206 | auto* jsAuthenticatorResponse = static_cast<JSAuthenticatorResponse*>(handle.slot()->asCell()); |
207 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
208 | uncacheWrapper(world, &jsAuthenticatorResponse->wrapped(), jsAuthenticatorResponse); |
209 | } |
210 | |
211 | AuthenticatorResponse* JSAuthenticatorResponse::toWrapped(JSC::VM& vm, JSC::JSValue value) |
212 | { |
213 | if (auto* wrapper = jsDynamicCast<JSAuthenticatorResponse*>(vm, value)) |
214 | return &wrapper->wrapped(); |
215 | return nullptr; |
216 | } |
217 | |
218 | } |
219 | |
220 | #endif // ENABLE(WEB_AUTHN) |
221 | |