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#include "JSPerformanceTiming.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertNumbers.h"
28#include "JSDOMExceptionHandling.h"
29#include "JSDOMOperation.h"
30#include "JSDOMWrapperCache.h"
31#include "ScriptExecutionContext.h"
32#include <JavaScriptCore/FunctionPrototype.h>
33#include <JavaScriptCore/HeapSnapshotBuilder.h>
34#include <JavaScriptCore/JSCInlines.h>
35#include <JavaScriptCore/ObjectConstructor.h>
36#include <wtf/GetPtr.h>
37#include <wtf/PointerPreparations.h>
38#include <wtf/URL.h>
39
40
41namespace WebCore {
42using namespace JSC;
43
44// Functions
45
46JSC::EncodedJSValue JSC_HOST_CALL jsPerformanceTimingPrototypeFunctionToJSON(JSC::ExecState*);
47
48// Attributes
49
50JSC::EncodedJSValue jsPerformanceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51bool setJSPerformanceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52JSC::EncodedJSValue jsPerformanceTimingNavigationStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53JSC::EncodedJSValue jsPerformanceTimingUnloadEventStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54JSC::EncodedJSValue jsPerformanceTimingUnloadEventEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55JSC::EncodedJSValue jsPerformanceTimingRedirectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56JSC::EncodedJSValue jsPerformanceTimingRedirectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57JSC::EncodedJSValue jsPerformanceTimingFetchStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58JSC::EncodedJSValue jsPerformanceTimingDomainLookupStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
59JSC::EncodedJSValue jsPerformanceTimingDomainLookupEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60JSC::EncodedJSValue jsPerformanceTimingConnectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
61JSC::EncodedJSValue jsPerformanceTimingConnectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62JSC::EncodedJSValue jsPerformanceTimingSecureConnectionStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
63JSC::EncodedJSValue jsPerformanceTimingRequestStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64JSC::EncodedJSValue jsPerformanceTimingResponseStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
65JSC::EncodedJSValue jsPerformanceTimingResponseEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66JSC::EncodedJSValue jsPerformanceTimingDomLoading(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
67JSC::EncodedJSValue jsPerformanceTimingDomInteractive(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68JSC::EncodedJSValue jsPerformanceTimingDomContentLoadedEventStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
69JSC::EncodedJSValue jsPerformanceTimingDomContentLoadedEventEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
70JSC::EncodedJSValue jsPerformanceTimingDomComplete(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
71JSC::EncodedJSValue jsPerformanceTimingLoadEventStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
72JSC::EncodedJSValue jsPerformanceTimingLoadEventEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
73
74class JSPerformanceTimingPrototype : public JSC::JSNonFinalObject {
75public:
76 using Base = JSC::JSNonFinalObject;
77 static JSPerformanceTimingPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
78 {
79 JSPerformanceTimingPrototype* ptr = new (NotNull, JSC::allocateCell<JSPerformanceTimingPrototype>(vm.heap)) JSPerformanceTimingPrototype(vm, globalObject, structure);
80 ptr->finishCreation(vm);
81 return ptr;
82 }
83
84 DECLARE_INFO;
85 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
86 {
87 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
88 }
89
90private:
91 JSPerformanceTimingPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
92 : JSC::JSNonFinalObject(vm, structure)
93 {
94 }
95
96 void finishCreation(JSC::VM&);
97};
98
99using JSPerformanceTimingConstructor = JSDOMConstructorNotConstructable<JSPerformanceTiming>;
100
101template<> JSValue JSPerformanceTimingConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
102{
103 UNUSED_PARAM(vm);
104 return globalObject.functionPrototype();
105}
106
107template<> void JSPerformanceTimingConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
108{
109 putDirect(vm, vm.propertyNames->prototype, JSPerformanceTiming::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
110 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PerformanceTiming"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
111 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
112}
113
114template<> const ClassInfo JSPerformanceTimingConstructor::s_info = { "PerformanceTiming", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceTimingConstructor) };
115
116/* Hash table for prototype */
117
118static const HashTableValue JSPerformanceTimingPrototypeTableValues[] =
119{
120 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPerformanceTimingConstructor) } },
121 { "navigationStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingNavigationStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
122 { "unloadEventStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingUnloadEventStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
123 { "unloadEventEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingUnloadEventEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
124 { "redirectStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingRedirectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
125 { "redirectEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingRedirectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
126 { "fetchStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingFetchStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
127 { "domainLookupStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomainLookupStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
128 { "domainLookupEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomainLookupEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
129 { "connectStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingConnectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
130 { "connectEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingConnectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
131 { "secureConnectionStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingSecureConnectionStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
132 { "requestStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingRequestStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
133 { "responseStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingResponseStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
134 { "responseEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingResponseEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
135 { "domLoading", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomLoading), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
136 { "domInteractive", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomInteractive), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
137 { "domContentLoadedEventStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomContentLoadedEventStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
138 { "domContentLoadedEventEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomContentLoadedEventEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
139 { "domComplete", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingDomComplete), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
140 { "loadEventStart", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingLoadEventStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
141 { "loadEventEnd", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTimingLoadEventEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
142 { "toJSON", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPerformanceTimingPrototypeFunctionToJSON), (intptr_t) (0) } },
143};
144
145const ClassInfo JSPerformanceTimingPrototype::s_info = { "PerformanceTimingPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceTimingPrototype) };
146
147void JSPerformanceTimingPrototype::finishCreation(VM& vm)
148{
149 Base::finishCreation(vm);
150 reifyStaticProperties(vm, JSPerformanceTiming::info(), JSPerformanceTimingPrototypeTableValues, *this);
151}
152
153const ClassInfo JSPerformanceTiming::s_info = { "PerformanceTiming", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceTiming) };
154
155JSPerformanceTiming::JSPerformanceTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PerformanceTiming>&& impl)
156 : JSDOMWrapper<PerformanceTiming>(structure, globalObject, WTFMove(impl))
157{
158}
159
160void JSPerformanceTiming::finishCreation(VM& vm)
161{
162 Base::finishCreation(vm);
163 ASSERT(inherits(vm, info()));
164
165}
166
167JSObject* JSPerformanceTiming::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
168{
169 return JSPerformanceTimingPrototype::create(vm, &globalObject, JSPerformanceTimingPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
170}
171
172JSObject* JSPerformanceTiming::prototype(VM& vm, JSDOMGlobalObject& globalObject)
173{
174 return getDOMPrototype<JSPerformanceTiming>(vm, globalObject);
175}
176
177JSValue JSPerformanceTiming::getConstructor(VM& vm, const JSGlobalObject* globalObject)
178{
179 return getDOMConstructor<JSPerformanceTimingConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
180}
181
182void JSPerformanceTiming::destroy(JSC::JSCell* cell)
183{
184 JSPerformanceTiming* thisObject = static_cast<JSPerformanceTiming*>(cell);
185 thisObject->JSPerformanceTiming::~JSPerformanceTiming();
186}
187
188template<> inline JSPerformanceTiming* IDLAttribute<JSPerformanceTiming>::cast(ExecState& state, EncodedJSValue thisValue)
189{
190 return jsDynamicCast<JSPerformanceTiming*>(state.vm(), JSValue::decode(thisValue));
191}
192
193template<> inline JSPerformanceTiming* IDLOperation<JSPerformanceTiming>::cast(ExecState& state)
194{
195 return jsDynamicCast<JSPerformanceTiming*>(state.vm(), state.thisValue());
196}
197
198EncodedJSValue jsPerformanceTimingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
199{
200 VM& vm = state->vm();
201 auto throwScope = DECLARE_THROW_SCOPE(vm);
202 auto* prototype = jsDynamicCast<JSPerformanceTimingPrototype*>(vm, JSValue::decode(thisValue));
203 if (UNLIKELY(!prototype))
204 return throwVMTypeError(state, throwScope);
205 return JSValue::encode(JSPerformanceTiming::getConstructor(state->vm(), prototype->globalObject()));
206}
207
208bool setJSPerformanceTimingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
209{
210 VM& vm = state->vm();
211 auto throwScope = DECLARE_THROW_SCOPE(vm);
212 auto* prototype = jsDynamicCast<JSPerformanceTimingPrototype*>(vm, JSValue::decode(thisValue));
213 if (UNLIKELY(!prototype)) {
214 throwVMTypeError(state, throwScope);
215 return false;
216 }
217 // Shadowing a built-in constructor
218 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
219}
220
221static inline JSValue jsPerformanceTimingNavigationStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
222{
223 UNUSED_PARAM(throwScope);
224 UNUSED_PARAM(state);
225 auto& impl = thisObject.wrapped();
226 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.navigationStart());
227 return result;
228}
229
230EncodedJSValue jsPerformanceTimingNavigationStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
231{
232 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingNavigationStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "navigationStart");
233}
234
235static inline JSValue jsPerformanceTimingUnloadEventStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
236{
237 UNUSED_PARAM(throwScope);
238 UNUSED_PARAM(state);
239 auto& impl = thisObject.wrapped();
240 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.unloadEventStart());
241 return result;
242}
243
244EncodedJSValue jsPerformanceTimingUnloadEventStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
245{
246 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingUnloadEventStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "unloadEventStart");
247}
248
249static inline JSValue jsPerformanceTimingUnloadEventEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
250{
251 UNUSED_PARAM(throwScope);
252 UNUSED_PARAM(state);
253 auto& impl = thisObject.wrapped();
254 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.unloadEventEnd());
255 return result;
256}
257
258EncodedJSValue jsPerformanceTimingUnloadEventEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
259{
260 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingUnloadEventEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "unloadEventEnd");
261}
262
263static inline JSValue jsPerformanceTimingRedirectStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
264{
265 UNUSED_PARAM(throwScope);
266 UNUSED_PARAM(state);
267 auto& impl = thisObject.wrapped();
268 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.redirectStart());
269 return result;
270}
271
272EncodedJSValue jsPerformanceTimingRedirectStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
273{
274 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingRedirectStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "redirectStart");
275}
276
277static inline JSValue jsPerformanceTimingRedirectEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
278{
279 UNUSED_PARAM(throwScope);
280 UNUSED_PARAM(state);
281 auto& impl = thisObject.wrapped();
282 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.redirectEnd());
283 return result;
284}
285
286EncodedJSValue jsPerformanceTimingRedirectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
287{
288 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingRedirectEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "redirectEnd");
289}
290
291static inline JSValue jsPerformanceTimingFetchStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
292{
293 UNUSED_PARAM(throwScope);
294 UNUSED_PARAM(state);
295 auto& impl = thisObject.wrapped();
296 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.fetchStart());
297 return result;
298}
299
300EncodedJSValue jsPerformanceTimingFetchStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
301{
302 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingFetchStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fetchStart");
303}
304
305static inline JSValue jsPerformanceTimingDomainLookupStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
306{
307 UNUSED_PARAM(throwScope);
308 UNUSED_PARAM(state);
309 auto& impl = thisObject.wrapped();
310 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domainLookupStart());
311 return result;
312}
313
314EncodedJSValue jsPerformanceTimingDomainLookupStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
315{
316 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomainLookupStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domainLookupStart");
317}
318
319static inline JSValue jsPerformanceTimingDomainLookupEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
320{
321 UNUSED_PARAM(throwScope);
322 UNUSED_PARAM(state);
323 auto& impl = thisObject.wrapped();
324 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domainLookupEnd());
325 return result;
326}
327
328EncodedJSValue jsPerformanceTimingDomainLookupEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
329{
330 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomainLookupEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domainLookupEnd");
331}
332
333static inline JSValue jsPerformanceTimingConnectStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
334{
335 UNUSED_PARAM(throwScope);
336 UNUSED_PARAM(state);
337 auto& impl = thisObject.wrapped();
338 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.connectStart());
339 return result;
340}
341
342EncodedJSValue jsPerformanceTimingConnectStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
343{
344 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingConnectStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "connectStart");
345}
346
347static inline JSValue jsPerformanceTimingConnectEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
348{
349 UNUSED_PARAM(throwScope);
350 UNUSED_PARAM(state);
351 auto& impl = thisObject.wrapped();
352 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.connectEnd());
353 return result;
354}
355
356EncodedJSValue jsPerformanceTimingConnectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
357{
358 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingConnectEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "connectEnd");
359}
360
361static inline JSValue jsPerformanceTimingSecureConnectionStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
362{
363 UNUSED_PARAM(throwScope);
364 UNUSED_PARAM(state);
365 auto& impl = thisObject.wrapped();
366 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.secureConnectionStart());
367 return result;
368}
369
370EncodedJSValue jsPerformanceTimingSecureConnectionStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
371{
372 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingSecureConnectionStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "secureConnectionStart");
373}
374
375static inline JSValue jsPerformanceTimingRequestStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
376{
377 UNUSED_PARAM(throwScope);
378 UNUSED_PARAM(state);
379 auto& impl = thisObject.wrapped();
380 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.requestStart());
381 return result;
382}
383
384EncodedJSValue jsPerformanceTimingRequestStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
385{
386 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingRequestStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "requestStart");
387}
388
389static inline JSValue jsPerformanceTimingResponseStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
390{
391 UNUSED_PARAM(throwScope);
392 UNUSED_PARAM(state);
393 auto& impl = thisObject.wrapped();
394 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.responseStart());
395 return result;
396}
397
398EncodedJSValue jsPerformanceTimingResponseStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
399{
400 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingResponseStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "responseStart");
401}
402
403static inline JSValue jsPerformanceTimingResponseEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
404{
405 UNUSED_PARAM(throwScope);
406 UNUSED_PARAM(state);
407 auto& impl = thisObject.wrapped();
408 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.responseEnd());
409 return result;
410}
411
412EncodedJSValue jsPerformanceTimingResponseEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
413{
414 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingResponseEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "responseEnd");
415}
416
417static inline JSValue jsPerformanceTimingDomLoadingGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
418{
419 UNUSED_PARAM(throwScope);
420 UNUSED_PARAM(state);
421 auto& impl = thisObject.wrapped();
422 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domLoading());
423 return result;
424}
425
426EncodedJSValue jsPerformanceTimingDomLoading(ExecState* state, EncodedJSValue thisValue, PropertyName)
427{
428 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomLoadingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domLoading");
429}
430
431static inline JSValue jsPerformanceTimingDomInteractiveGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
432{
433 UNUSED_PARAM(throwScope);
434 UNUSED_PARAM(state);
435 auto& impl = thisObject.wrapped();
436 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domInteractive());
437 return result;
438}
439
440EncodedJSValue jsPerformanceTimingDomInteractive(ExecState* state, EncodedJSValue thisValue, PropertyName)
441{
442 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomInteractiveGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domInteractive");
443}
444
445static inline JSValue jsPerformanceTimingDomContentLoadedEventStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
446{
447 UNUSED_PARAM(throwScope);
448 UNUSED_PARAM(state);
449 auto& impl = thisObject.wrapped();
450 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domContentLoadedEventStart());
451 return result;
452}
453
454EncodedJSValue jsPerformanceTimingDomContentLoadedEventStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
455{
456 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomContentLoadedEventStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domContentLoadedEventStart");
457}
458
459static inline JSValue jsPerformanceTimingDomContentLoadedEventEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
460{
461 UNUSED_PARAM(throwScope);
462 UNUSED_PARAM(state);
463 auto& impl = thisObject.wrapped();
464 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domContentLoadedEventEnd());
465 return result;
466}
467
468EncodedJSValue jsPerformanceTimingDomContentLoadedEventEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
469{
470 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomContentLoadedEventEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domContentLoadedEventEnd");
471}
472
473static inline JSValue jsPerformanceTimingDomCompleteGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
474{
475 UNUSED_PARAM(throwScope);
476 UNUSED_PARAM(state);
477 auto& impl = thisObject.wrapped();
478 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.domComplete());
479 return result;
480}
481
482EncodedJSValue jsPerformanceTimingDomComplete(ExecState* state, EncodedJSValue thisValue, PropertyName)
483{
484 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingDomCompleteGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domComplete");
485}
486
487static inline JSValue jsPerformanceTimingLoadEventStartGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
488{
489 UNUSED_PARAM(throwScope);
490 UNUSED_PARAM(state);
491 auto& impl = thisObject.wrapped();
492 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.loadEventStart());
493 return result;
494}
495
496EncodedJSValue jsPerformanceTimingLoadEventStart(ExecState* state, EncodedJSValue thisValue, PropertyName)
497{
498 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingLoadEventStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "loadEventStart");
499}
500
501static inline JSValue jsPerformanceTimingLoadEventEndGetter(ExecState& state, JSPerformanceTiming& thisObject, ThrowScope& throwScope)
502{
503 UNUSED_PARAM(throwScope);
504 UNUSED_PARAM(state);
505 auto& impl = thisObject.wrapped();
506 JSValue result = toJS<IDLUnsignedLongLong>(state, throwScope, impl.loadEventEnd());
507 return result;
508}
509
510EncodedJSValue jsPerformanceTimingLoadEventEnd(ExecState* state, EncodedJSValue thisValue, PropertyName)
511{
512 return IDLAttribute<JSPerformanceTiming>::get<jsPerformanceTimingLoadEventEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "loadEventEnd");
513}
514
515JSC::JSObject* JSPerformanceTiming::serialize(ExecState& state, JSPerformanceTiming& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope)
516{
517 auto& vm = state.vm();
518 auto* result = constructEmptyObject(&state, globalObject.objectPrototype());
519
520 auto navigationStartValue = jsPerformanceTimingNavigationStartGetter(state, thisObject, throwScope);
521 throwScope.assertNoException();
522 result->putDirect(vm, Identifier::fromString(&vm, "navigationStart"), navigationStartValue);
523
524 auto unloadEventStartValue = jsPerformanceTimingUnloadEventStartGetter(state, thisObject, throwScope);
525 throwScope.assertNoException();
526 result->putDirect(vm, Identifier::fromString(&vm, "unloadEventStart"), unloadEventStartValue);
527
528 auto unloadEventEndValue = jsPerformanceTimingUnloadEventEndGetter(state, thisObject, throwScope);
529 throwScope.assertNoException();
530 result->putDirect(vm, Identifier::fromString(&vm, "unloadEventEnd"), unloadEventEndValue);
531
532 auto redirectStartValue = jsPerformanceTimingRedirectStartGetter(state, thisObject, throwScope);
533 throwScope.assertNoException();
534 result->putDirect(vm, Identifier::fromString(&vm, "redirectStart"), redirectStartValue);
535
536 auto redirectEndValue = jsPerformanceTimingRedirectEndGetter(state, thisObject, throwScope);
537 throwScope.assertNoException();
538 result->putDirect(vm, Identifier::fromString(&vm, "redirectEnd"), redirectEndValue);
539
540 auto fetchStartValue = jsPerformanceTimingFetchStartGetter(state, thisObject, throwScope);
541 throwScope.assertNoException();
542 result->putDirect(vm, Identifier::fromString(&vm, "fetchStart"), fetchStartValue);
543
544 auto domainLookupStartValue = jsPerformanceTimingDomainLookupStartGetter(state, thisObject, throwScope);
545 throwScope.assertNoException();
546 result->putDirect(vm, Identifier::fromString(&vm, "domainLookupStart"), domainLookupStartValue);
547
548 auto domainLookupEndValue = jsPerformanceTimingDomainLookupEndGetter(state, thisObject, throwScope);
549 throwScope.assertNoException();
550 result->putDirect(vm, Identifier::fromString(&vm, "domainLookupEnd"), domainLookupEndValue);
551
552 auto connectStartValue = jsPerformanceTimingConnectStartGetter(state, thisObject, throwScope);
553 throwScope.assertNoException();
554 result->putDirect(vm, Identifier::fromString(&vm, "connectStart"), connectStartValue);
555
556 auto connectEndValue = jsPerformanceTimingConnectEndGetter(state, thisObject, throwScope);
557 throwScope.assertNoException();
558 result->putDirect(vm, Identifier::fromString(&vm, "connectEnd"), connectEndValue);
559
560 auto secureConnectionStartValue = jsPerformanceTimingSecureConnectionStartGetter(state, thisObject, throwScope);
561 throwScope.assertNoException();
562 result->putDirect(vm, Identifier::fromString(&vm, "secureConnectionStart"), secureConnectionStartValue);
563
564 auto requestStartValue = jsPerformanceTimingRequestStartGetter(state, thisObject, throwScope);
565 throwScope.assertNoException();
566 result->putDirect(vm, Identifier::fromString(&vm, "requestStart"), requestStartValue);
567
568 auto responseStartValue = jsPerformanceTimingResponseStartGetter(state, thisObject, throwScope);
569 throwScope.assertNoException();
570 result->putDirect(vm, Identifier::fromString(&vm, "responseStart"), responseStartValue);
571
572 auto responseEndValue = jsPerformanceTimingResponseEndGetter(state, thisObject, throwScope);
573 throwScope.assertNoException();
574 result->putDirect(vm, Identifier::fromString(&vm, "responseEnd"), responseEndValue);
575
576 auto domLoadingValue = jsPerformanceTimingDomLoadingGetter(state, thisObject, throwScope);
577 throwScope.assertNoException();
578 result->putDirect(vm, Identifier::fromString(&vm, "domLoading"), domLoadingValue);
579
580 auto domInteractiveValue = jsPerformanceTimingDomInteractiveGetter(state, thisObject, throwScope);
581 throwScope.assertNoException();
582 result->putDirect(vm, Identifier::fromString(&vm, "domInteractive"), domInteractiveValue);
583
584 auto domContentLoadedEventStartValue = jsPerformanceTimingDomContentLoadedEventStartGetter(state, thisObject, throwScope);
585 throwScope.assertNoException();
586 result->putDirect(vm, Identifier::fromString(&vm, "domContentLoadedEventStart"), domContentLoadedEventStartValue);
587
588 auto domContentLoadedEventEndValue = jsPerformanceTimingDomContentLoadedEventEndGetter(state, thisObject, throwScope);
589 throwScope.assertNoException();
590 result->putDirect(vm, Identifier::fromString(&vm, "domContentLoadedEventEnd"), domContentLoadedEventEndValue);
591
592 auto domCompleteValue = jsPerformanceTimingDomCompleteGetter(state, thisObject, throwScope);
593 throwScope.assertNoException();
594 result->putDirect(vm, Identifier::fromString(&vm, "domComplete"), domCompleteValue);
595
596 auto loadEventStartValue = jsPerformanceTimingLoadEventStartGetter(state, thisObject, throwScope);
597 throwScope.assertNoException();
598 result->putDirect(vm, Identifier::fromString(&vm, "loadEventStart"), loadEventStartValue);
599
600 auto loadEventEndValue = jsPerformanceTimingLoadEventEndGetter(state, thisObject, throwScope);
601 throwScope.assertNoException();
602 result->putDirect(vm, Identifier::fromString(&vm, "loadEventEnd"), loadEventEndValue);
603
604 return result;
605}
606
607static inline EncodedJSValue jsPerformanceTimingPrototypeFunctionToJSONBody(ExecState* state, JSPerformanceTiming* thisObject, JSC::ThrowScope& throwScope)
608{
609 return JSValue::encode(JSPerformanceTiming::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope));
610}
611
612EncodedJSValue JSC_HOST_CALL jsPerformanceTimingPrototypeFunctionToJSON(ExecState* state)
613{
614 return IDLOperation<JSPerformanceTiming>::call<jsPerformanceTimingPrototypeFunctionToJSONBody>(*state, "toJSON");
615}
616
617void JSPerformanceTiming::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
618{
619 auto* thisObject = jsCast<JSPerformanceTiming*>(cell);
620 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
621 if (thisObject->scriptExecutionContext())
622 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
623 Base::heapSnapshot(cell, builder);
624}
625
626bool JSPerformanceTimingOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
627{
628 UNUSED_PARAM(handle);
629 UNUSED_PARAM(visitor);
630 UNUSED_PARAM(reason);
631 return false;
632}
633
634void JSPerformanceTimingOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
635{
636 auto* jsPerformanceTiming = static_cast<JSPerformanceTiming*>(handle.slot()->asCell());
637 auto& world = *static_cast<DOMWrapperWorld*>(context);
638 uncacheWrapper(world, &jsPerformanceTiming->wrapped(), jsPerformanceTiming);
639}
640
641JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PerformanceTiming>&& impl)
642{
643 // If you hit this failure the interface definition has the ImplementationLacksVTable
644 // attribute. You should remove that attribute. If the class has subclasses
645 // that may be passed through this toJS() function you should use the SkipVTableValidation
646 // attribute to PerformanceTiming.
647 static_assert(!std::is_polymorphic<PerformanceTiming>::value, "PerformanceTiming is polymorphic but the IDL claims it is not");
648 return createWrapper<PerformanceTiming>(globalObject, WTFMove(impl));
649}
650
651JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PerformanceTiming& impl)
652{
653 return wrap(state, globalObject, impl);
654}
655
656PerformanceTiming* JSPerformanceTiming::toWrapped(JSC::VM& vm, JSC::JSValue value)
657{
658 if (auto* wrapper = jsDynamicCast<JSPerformanceTiming*>(vm, value))
659 return &wrapper->wrapped();
660 return nullptr;
661}
662
663}
664