| 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 "JSPerformanceResourceTiming.h" |
| 23 | |
| 24 | #include "JSDOMAttribute.h" |
| 25 | #include "JSDOMBinding.h" |
| 26 | #include "JSDOMConstructorNotConstructable.h" |
| 27 | #include "JSDOMConvertInterface.h" |
| 28 | #include "JSDOMConvertNumbers.h" |
| 29 | #include "JSDOMConvertSequences.h" |
| 30 | #include "JSDOMConvertStrings.h" |
| 31 | #include "JSDOMExceptionHandling.h" |
| 32 | #include "JSDOMGlobalObject.h" |
| 33 | #include "JSDOMOperation.h" |
| 34 | #include "JSDOMWrapperCache.h" |
| 35 | #include "JSPerformanceServerTiming.h" |
| 36 | #include "RuntimeEnabledFeatures.h" |
| 37 | #include "ScriptExecutionContext.h" |
| 38 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 39 | #include <JavaScriptCore/JSArray.h> |
| 40 | #include <JavaScriptCore/JSCInlines.h> |
| 41 | #include <JavaScriptCore/ObjectConstructor.h> |
| 42 | #include <wtf/GetPtr.h> |
| 43 | #include <wtf/PointerPreparations.h> |
| 44 | #include <wtf/URL.h> |
| 45 | |
| 46 | |
| 47 | namespace WebCore { |
| 48 | using namespace JSC; |
| 49 | |
| 50 | // Functions |
| 51 | |
| 52 | JSC::EncodedJSValue JSC_HOST_CALL jsPerformanceResourceTimingPrototypeFunctionToJSON(JSC::ExecState*); |
| 53 | |
| 54 | // Attributes |
| 55 | |
| 56 | JSC::EncodedJSValue jsPerformanceResourceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 57 | bool setJSPerformanceResourceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 58 | JSC::EncodedJSValue jsPerformanceResourceTimingInitiatorType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 59 | JSC::EncodedJSValue jsPerformanceResourceTimingNextHopProtocol(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 60 | JSC::EncodedJSValue jsPerformanceResourceTimingWorkerStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 61 | JSC::EncodedJSValue jsPerformanceResourceTimingRedirectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 62 | JSC::EncodedJSValue jsPerformanceResourceTimingRedirectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 63 | JSC::EncodedJSValue jsPerformanceResourceTimingFetchStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 64 | JSC::EncodedJSValue jsPerformanceResourceTimingDomainLookupStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 65 | JSC::EncodedJSValue jsPerformanceResourceTimingDomainLookupEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | JSC::EncodedJSValue jsPerformanceResourceTimingConnectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 67 | JSC::EncodedJSValue jsPerformanceResourceTimingConnectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 68 | JSC::EncodedJSValue jsPerformanceResourceTimingSecureConnectionStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 69 | JSC::EncodedJSValue jsPerformanceResourceTimingRequestStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 70 | JSC::EncodedJSValue jsPerformanceResourceTimingResponseStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 71 | JSC::EncodedJSValue jsPerformanceResourceTimingResponseEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 72 | JSC::EncodedJSValue jsPerformanceResourceTimingServerTiming(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 73 | |
| 74 | class JSPerformanceResourceTimingPrototype : public JSC::JSNonFinalObject { |
| 75 | public: |
| 76 | using Base = JSC::JSNonFinalObject; |
| 77 | static JSPerformanceResourceTimingPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 78 | { |
| 79 | JSPerformanceResourceTimingPrototype* ptr = new (NotNull, JSC::allocateCell<JSPerformanceResourceTimingPrototype>(vm.heap)) JSPerformanceResourceTimingPrototype(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 | |
| 90 | private: |
| 91 | JSPerformanceResourceTimingPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 92 | : JSC::JSNonFinalObject(vm, structure) |
| 93 | { |
| 94 | } |
| 95 | |
| 96 | void finishCreation(JSC::VM&); |
| 97 | }; |
| 98 | |
| 99 | using JSPerformanceResourceTimingConstructor = JSDOMConstructorNotConstructable<JSPerformanceResourceTiming>; |
| 100 | |
| 101 | template<> JSValue JSPerformanceResourceTimingConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 102 | { |
| 103 | return JSPerformanceEntry::getConstructor(vm, &globalObject); |
| 104 | } |
| 105 | |
| 106 | template<> void JSPerformanceResourceTimingConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 107 | { |
| 108 | putDirect(vm, vm.propertyNames->prototype, JSPerformanceResourceTiming::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 109 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PerformanceResourceTiming"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 110 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 111 | } |
| 112 | |
| 113 | template<> const ClassInfo JSPerformanceResourceTimingConstructor::s_info = { "PerformanceResourceTiming" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceResourceTimingConstructor) }; |
| 114 | |
| 115 | /* Hash table for prototype */ |
| 116 | |
| 117 | static const HashTableValue JSPerformanceResourceTimingPrototypeTableValues[] = |
| 118 | { |
| 119 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPerformanceResourceTimingConstructor) } }, |
| 120 | { "initiatorType" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingInitiatorType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 121 | { "nextHopProtocol" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingNextHopProtocol), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 122 | { "workerStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingWorkerStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 123 | { "redirectStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 124 | { "redirectEnd" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 125 | { "fetchStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingFetchStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 126 | { "domainLookupStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 127 | { "domainLookupEnd" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 128 | { "connectStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 129 | { "connectEnd" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 130 | { "secureConnectionStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingSecureConnectionStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 131 | { "requestStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRequestStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 132 | { "responseStart" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 133 | { "responseEnd" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 134 | { "serverTiming" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingServerTiming), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 135 | { "toJSON" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPerformanceResourceTimingPrototypeFunctionToJSON), (intptr_t) (0) } }, |
| 136 | }; |
| 137 | |
| 138 | const ClassInfo JSPerformanceResourceTimingPrototype::s_info = { "PerformanceResourceTimingPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceResourceTimingPrototype) }; |
| 139 | |
| 140 | void JSPerformanceResourceTimingPrototype::finishCreation(VM& vm) |
| 141 | { |
| 142 | Base::finishCreation(vm); |
| 143 | reifyStaticProperties(vm, JSPerformanceResourceTiming::info(), JSPerformanceResourceTimingPrototypeTableValues, *this); |
| 144 | bool hasDisabledRuntimeProperties = false; |
| 145 | if (!RuntimeEnabledFeatures::sharedFeatures().serverTimingEnabled()) { |
| 146 | hasDisabledRuntimeProperties = true; |
| 147 | auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("serverTiming" ), strlen("serverTiming" )); |
| 148 | VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| 149 | JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| 150 | } |
| 151 | if (hasDisabledRuntimeProperties && structure()->isDictionary()) |
| 152 | flattenDictionaryObject(vm); |
| 153 | } |
| 154 | |
| 155 | const ClassInfo JSPerformanceResourceTiming::s_info = { "PerformanceResourceTiming" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPerformanceResourceTiming) }; |
| 156 | |
| 157 | JSPerformanceResourceTiming::JSPerformanceResourceTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PerformanceResourceTiming>&& impl) |
| 158 | : JSPerformanceEntry(structure, globalObject, WTFMove(impl)) |
| 159 | { |
| 160 | } |
| 161 | |
| 162 | void JSPerformanceResourceTiming::finishCreation(VM& vm) |
| 163 | { |
| 164 | Base::finishCreation(vm); |
| 165 | ASSERT(inherits(vm, info())); |
| 166 | |
| 167 | } |
| 168 | |
| 169 | JSObject* JSPerformanceResourceTiming::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 170 | { |
| 171 | return JSPerformanceResourceTimingPrototype::create(vm, &globalObject, JSPerformanceResourceTimingPrototype::createStructure(vm, &globalObject, JSPerformanceEntry::prototype(vm, globalObject))); |
| 172 | } |
| 173 | |
| 174 | JSObject* JSPerformanceResourceTiming::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 175 | { |
| 176 | return getDOMPrototype<JSPerformanceResourceTiming>(vm, globalObject); |
| 177 | } |
| 178 | |
| 179 | JSValue JSPerformanceResourceTiming::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 180 | { |
| 181 | return getDOMConstructor<JSPerformanceResourceTimingConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 182 | } |
| 183 | |
| 184 | template<> inline JSPerformanceResourceTiming* IDLAttribute<JSPerformanceResourceTiming>::cast(ExecState& state, EncodedJSValue thisValue) |
| 185 | { |
| 186 | return jsDynamicCast<JSPerformanceResourceTiming*>(state.vm(), JSValue::decode(thisValue)); |
| 187 | } |
| 188 | |
| 189 | template<> inline JSPerformanceResourceTiming* IDLOperation<JSPerformanceResourceTiming>::cast(ExecState& state) |
| 190 | { |
| 191 | return jsDynamicCast<JSPerformanceResourceTiming*>(state.vm(), state.thisValue()); |
| 192 | } |
| 193 | |
| 194 | EncodedJSValue jsPerformanceResourceTimingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 195 | { |
| 196 | VM& vm = state->vm(); |
| 197 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 198 | auto* prototype = jsDynamicCast<JSPerformanceResourceTimingPrototype*>(vm, JSValue::decode(thisValue)); |
| 199 | if (UNLIKELY(!prototype)) |
| 200 | return throwVMTypeError(state, throwScope); |
| 201 | return JSValue::encode(JSPerformanceResourceTiming::getConstructor(state->vm(), prototype->globalObject())); |
| 202 | } |
| 203 | |
| 204 | bool setJSPerformanceResourceTimingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 205 | { |
| 206 | VM& vm = state->vm(); |
| 207 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 208 | auto* prototype = jsDynamicCast<JSPerformanceResourceTimingPrototype*>(vm, JSValue::decode(thisValue)); |
| 209 | if (UNLIKELY(!prototype)) { |
| 210 | throwVMTypeError(state, throwScope); |
| 211 | return false; |
| 212 | } |
| 213 | // Shadowing a built-in constructor |
| 214 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 215 | } |
| 216 | |
| 217 | static inline JSValue jsPerformanceResourceTimingInitiatorTypeGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 218 | { |
| 219 | UNUSED_PARAM(throwScope); |
| 220 | UNUSED_PARAM(state); |
| 221 | auto& impl = thisObject.wrapped(); |
| 222 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.initiatorType()); |
| 223 | return result; |
| 224 | } |
| 225 | |
| 226 | EncodedJSValue jsPerformanceResourceTimingInitiatorType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 227 | { |
| 228 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingInitiatorTypeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "initiatorType" ); |
| 229 | } |
| 230 | |
| 231 | static inline JSValue jsPerformanceResourceTimingNextHopProtocolGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 232 | { |
| 233 | UNUSED_PARAM(throwScope); |
| 234 | UNUSED_PARAM(state); |
| 235 | auto& impl = thisObject.wrapped(); |
| 236 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.nextHopProtocol()); |
| 237 | return result; |
| 238 | } |
| 239 | |
| 240 | EncodedJSValue jsPerformanceResourceTimingNextHopProtocol(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 241 | { |
| 242 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingNextHopProtocolGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "nextHopProtocol" ); |
| 243 | } |
| 244 | |
| 245 | static inline JSValue jsPerformanceResourceTimingWorkerStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 246 | { |
| 247 | UNUSED_PARAM(throwScope); |
| 248 | UNUSED_PARAM(state); |
| 249 | auto& impl = thisObject.wrapped(); |
| 250 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.workerStart()); |
| 251 | return result; |
| 252 | } |
| 253 | |
| 254 | EncodedJSValue jsPerformanceResourceTimingWorkerStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 255 | { |
| 256 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingWorkerStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "workerStart" ); |
| 257 | } |
| 258 | |
| 259 | static inline JSValue jsPerformanceResourceTimingRedirectStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 260 | { |
| 261 | UNUSED_PARAM(throwScope); |
| 262 | UNUSED_PARAM(state); |
| 263 | auto& impl = thisObject.wrapped(); |
| 264 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.redirectStart()); |
| 265 | return result; |
| 266 | } |
| 267 | |
| 268 | EncodedJSValue jsPerformanceResourceTimingRedirectStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 269 | { |
| 270 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingRedirectStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "redirectStart" ); |
| 271 | } |
| 272 | |
| 273 | static inline JSValue jsPerformanceResourceTimingRedirectEndGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 274 | { |
| 275 | UNUSED_PARAM(throwScope); |
| 276 | UNUSED_PARAM(state); |
| 277 | auto& impl = thisObject.wrapped(); |
| 278 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.redirectEnd()); |
| 279 | return result; |
| 280 | } |
| 281 | |
| 282 | EncodedJSValue jsPerformanceResourceTimingRedirectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 283 | { |
| 284 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingRedirectEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "redirectEnd" ); |
| 285 | } |
| 286 | |
| 287 | static inline JSValue jsPerformanceResourceTimingFetchStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 288 | { |
| 289 | UNUSED_PARAM(throwScope); |
| 290 | UNUSED_PARAM(state); |
| 291 | auto& impl = thisObject.wrapped(); |
| 292 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.fetchStart()); |
| 293 | return result; |
| 294 | } |
| 295 | |
| 296 | EncodedJSValue jsPerformanceResourceTimingFetchStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 297 | { |
| 298 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingFetchStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fetchStart" ); |
| 299 | } |
| 300 | |
| 301 | static inline JSValue jsPerformanceResourceTimingDomainLookupStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 302 | { |
| 303 | UNUSED_PARAM(throwScope); |
| 304 | UNUSED_PARAM(state); |
| 305 | auto& impl = thisObject.wrapped(); |
| 306 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.domainLookupStart()); |
| 307 | return result; |
| 308 | } |
| 309 | |
| 310 | EncodedJSValue jsPerformanceResourceTimingDomainLookupStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 311 | { |
| 312 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingDomainLookupStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domainLookupStart" ); |
| 313 | } |
| 314 | |
| 315 | static inline JSValue jsPerformanceResourceTimingDomainLookupEndGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 316 | { |
| 317 | UNUSED_PARAM(throwScope); |
| 318 | UNUSED_PARAM(state); |
| 319 | auto& impl = thisObject.wrapped(); |
| 320 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.domainLookupEnd()); |
| 321 | return result; |
| 322 | } |
| 323 | |
| 324 | EncodedJSValue jsPerformanceResourceTimingDomainLookupEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 325 | { |
| 326 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingDomainLookupEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "domainLookupEnd" ); |
| 327 | } |
| 328 | |
| 329 | static inline JSValue jsPerformanceResourceTimingConnectStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 330 | { |
| 331 | UNUSED_PARAM(throwScope); |
| 332 | UNUSED_PARAM(state); |
| 333 | auto& impl = thisObject.wrapped(); |
| 334 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.connectStart()); |
| 335 | return result; |
| 336 | } |
| 337 | |
| 338 | EncodedJSValue jsPerformanceResourceTimingConnectStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 339 | { |
| 340 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingConnectStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "connectStart" ); |
| 341 | } |
| 342 | |
| 343 | static inline JSValue jsPerformanceResourceTimingConnectEndGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 344 | { |
| 345 | UNUSED_PARAM(throwScope); |
| 346 | UNUSED_PARAM(state); |
| 347 | auto& impl = thisObject.wrapped(); |
| 348 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.connectEnd()); |
| 349 | return result; |
| 350 | } |
| 351 | |
| 352 | EncodedJSValue jsPerformanceResourceTimingConnectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 353 | { |
| 354 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingConnectEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "connectEnd" ); |
| 355 | } |
| 356 | |
| 357 | static inline JSValue jsPerformanceResourceTimingSecureConnectionStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 358 | { |
| 359 | UNUSED_PARAM(throwScope); |
| 360 | UNUSED_PARAM(state); |
| 361 | auto& impl = thisObject.wrapped(); |
| 362 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.secureConnectionStart()); |
| 363 | return result; |
| 364 | } |
| 365 | |
| 366 | EncodedJSValue jsPerformanceResourceTimingSecureConnectionStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 367 | { |
| 368 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingSecureConnectionStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "secureConnectionStart" ); |
| 369 | } |
| 370 | |
| 371 | static inline JSValue jsPerformanceResourceTimingRequestStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 372 | { |
| 373 | UNUSED_PARAM(throwScope); |
| 374 | UNUSED_PARAM(state); |
| 375 | auto& impl = thisObject.wrapped(); |
| 376 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.requestStart()); |
| 377 | return result; |
| 378 | } |
| 379 | |
| 380 | EncodedJSValue jsPerformanceResourceTimingRequestStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 381 | { |
| 382 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingRequestStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "requestStart" ); |
| 383 | } |
| 384 | |
| 385 | static inline JSValue jsPerformanceResourceTimingResponseStartGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 386 | { |
| 387 | UNUSED_PARAM(throwScope); |
| 388 | UNUSED_PARAM(state); |
| 389 | auto& impl = thisObject.wrapped(); |
| 390 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.responseStart()); |
| 391 | return result; |
| 392 | } |
| 393 | |
| 394 | EncodedJSValue jsPerformanceResourceTimingResponseStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 395 | { |
| 396 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingResponseStartGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "responseStart" ); |
| 397 | } |
| 398 | |
| 399 | static inline JSValue jsPerformanceResourceTimingResponseEndGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 400 | { |
| 401 | UNUSED_PARAM(throwScope); |
| 402 | UNUSED_PARAM(state); |
| 403 | auto& impl = thisObject.wrapped(); |
| 404 | JSValue result = toJS<IDLDouble>(state, throwScope, impl.responseEnd()); |
| 405 | return result; |
| 406 | } |
| 407 | |
| 408 | EncodedJSValue jsPerformanceResourceTimingResponseEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 409 | { |
| 410 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingResponseEndGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "responseEnd" ); |
| 411 | } |
| 412 | |
| 413 | static inline JSValue jsPerformanceResourceTimingServerTimingGetter(ExecState& state, JSPerformanceResourceTiming& thisObject, ThrowScope& throwScope) |
| 414 | { |
| 415 | UNUSED_PARAM(throwScope); |
| 416 | UNUSED_PARAM(state); |
| 417 | auto& impl = thisObject.wrapped(); |
| 418 | JSValue result = toJS<IDLFrozenArray<IDLInterface<PerformanceServerTiming>>>(state, *thisObject.globalObject(), throwScope, impl.serverTiming()); |
| 419 | return result; |
| 420 | } |
| 421 | |
| 422 | EncodedJSValue jsPerformanceResourceTimingServerTiming(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 423 | { |
| 424 | return IDLAttribute<JSPerformanceResourceTiming>::get<jsPerformanceResourceTimingServerTimingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "serverTiming" ); |
| 425 | } |
| 426 | |
| 427 | JSC::JSObject* JSPerformanceResourceTiming::serialize(ExecState& state, JSPerformanceResourceTiming& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope) |
| 428 | { |
| 429 | auto& vm = state.vm(); |
| 430 | auto* result = JSPerformanceEntry::serialize(state, thisObject, globalObject, throwScope); |
| 431 | |
| 432 | auto initiatorTypeValue = jsPerformanceResourceTimingInitiatorTypeGetter(state, thisObject, throwScope); |
| 433 | throwScope.assertNoException(); |
| 434 | result->putDirect(vm, Identifier::fromString(&vm, "initiatorType" ), initiatorTypeValue); |
| 435 | |
| 436 | auto nextHopProtocolValue = jsPerformanceResourceTimingNextHopProtocolGetter(state, thisObject, throwScope); |
| 437 | throwScope.assertNoException(); |
| 438 | result->putDirect(vm, Identifier::fromString(&vm, "nextHopProtocol" ), nextHopProtocolValue); |
| 439 | |
| 440 | auto workerStartValue = jsPerformanceResourceTimingWorkerStartGetter(state, thisObject, throwScope); |
| 441 | throwScope.assertNoException(); |
| 442 | result->putDirect(vm, Identifier::fromString(&vm, "workerStart" ), workerStartValue); |
| 443 | |
| 444 | auto redirectStartValue = jsPerformanceResourceTimingRedirectStartGetter(state, thisObject, throwScope); |
| 445 | throwScope.assertNoException(); |
| 446 | result->putDirect(vm, Identifier::fromString(&vm, "redirectStart" ), redirectStartValue); |
| 447 | |
| 448 | auto redirectEndValue = jsPerformanceResourceTimingRedirectEndGetter(state, thisObject, throwScope); |
| 449 | throwScope.assertNoException(); |
| 450 | result->putDirect(vm, Identifier::fromString(&vm, "redirectEnd" ), redirectEndValue); |
| 451 | |
| 452 | auto fetchStartValue = jsPerformanceResourceTimingFetchStartGetter(state, thisObject, throwScope); |
| 453 | throwScope.assertNoException(); |
| 454 | result->putDirect(vm, Identifier::fromString(&vm, "fetchStart" ), fetchStartValue); |
| 455 | |
| 456 | auto domainLookupStartValue = jsPerformanceResourceTimingDomainLookupStartGetter(state, thisObject, throwScope); |
| 457 | throwScope.assertNoException(); |
| 458 | result->putDirect(vm, Identifier::fromString(&vm, "domainLookupStart" ), domainLookupStartValue); |
| 459 | |
| 460 | auto domainLookupEndValue = jsPerformanceResourceTimingDomainLookupEndGetter(state, thisObject, throwScope); |
| 461 | throwScope.assertNoException(); |
| 462 | result->putDirect(vm, Identifier::fromString(&vm, "domainLookupEnd" ), domainLookupEndValue); |
| 463 | |
| 464 | auto connectStartValue = jsPerformanceResourceTimingConnectStartGetter(state, thisObject, throwScope); |
| 465 | throwScope.assertNoException(); |
| 466 | result->putDirect(vm, Identifier::fromString(&vm, "connectStart" ), connectStartValue); |
| 467 | |
| 468 | auto connectEndValue = jsPerformanceResourceTimingConnectEndGetter(state, thisObject, throwScope); |
| 469 | throwScope.assertNoException(); |
| 470 | result->putDirect(vm, Identifier::fromString(&vm, "connectEnd" ), connectEndValue); |
| 471 | |
| 472 | auto secureConnectionStartValue = jsPerformanceResourceTimingSecureConnectionStartGetter(state, thisObject, throwScope); |
| 473 | throwScope.assertNoException(); |
| 474 | result->putDirect(vm, Identifier::fromString(&vm, "secureConnectionStart" ), secureConnectionStartValue); |
| 475 | |
| 476 | auto requestStartValue = jsPerformanceResourceTimingRequestStartGetter(state, thisObject, throwScope); |
| 477 | throwScope.assertNoException(); |
| 478 | result->putDirect(vm, Identifier::fromString(&vm, "requestStart" ), requestStartValue); |
| 479 | |
| 480 | auto responseStartValue = jsPerformanceResourceTimingResponseStartGetter(state, thisObject, throwScope); |
| 481 | throwScope.assertNoException(); |
| 482 | result->putDirect(vm, Identifier::fromString(&vm, "responseStart" ), responseStartValue); |
| 483 | |
| 484 | auto responseEndValue = jsPerformanceResourceTimingResponseEndGetter(state, thisObject, throwScope); |
| 485 | throwScope.assertNoException(); |
| 486 | result->putDirect(vm, Identifier::fromString(&vm, "responseEnd" ), responseEndValue); |
| 487 | |
| 488 | return result; |
| 489 | } |
| 490 | |
| 491 | static inline EncodedJSValue jsPerformanceResourceTimingPrototypeFunctionToJSONBody(ExecState* state, JSPerformanceResourceTiming* thisObject, JSC::ThrowScope& throwScope) |
| 492 | { |
| 493 | return JSValue::encode(JSPerformanceResourceTiming::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope)); |
| 494 | } |
| 495 | |
| 496 | EncodedJSValue JSC_HOST_CALL jsPerformanceResourceTimingPrototypeFunctionToJSON(ExecState* state) |
| 497 | { |
| 498 | return IDLOperation<JSPerformanceResourceTiming>::call<jsPerformanceResourceTimingPrototypeFunctionToJSONBody>(*state, "toJSON" ); |
| 499 | } |
| 500 | |
| 501 | void JSPerformanceResourceTiming::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 502 | { |
| 503 | auto* thisObject = jsCast<JSPerformanceResourceTiming*>(cell); |
| 504 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 505 | if (thisObject->scriptExecutionContext()) |
| 506 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 507 | Base::heapSnapshot(cell, builder); |
| 508 | } |
| 509 | |
| 510 | |
| 511 | } |
| 512 | |