| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| |
| #if ENABLE(WEB_TIMING) |
| |
| #include "JSPerformanceResourceTiming.h" |
| |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "URL.h" |
| #include <runtime/JSString.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsPerformanceResourceTimingInitiatorType(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingRedirectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingRedirectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingFetchStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingDomainLookupStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingDomainLookupEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingConnectStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingConnectEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingSecureConnectionStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingRequestStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingResponseStart(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingResponseEnd(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceResourceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSPerformanceResourceTimingConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSPerformanceResourceTimingPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSPerformanceResourceTimingPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSPerformanceResourceTimingPrototype* ptr = new (NotNull, JSC::allocateCell<JSPerformanceResourceTimingPrototype>(vm.heap)) JSPerformanceResourceTimingPrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| { |
| return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| } |
| |
| private: |
| JSPerformanceResourceTimingPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSPerformanceResourceTiming> JSPerformanceResourceTimingConstructor; |
| |
| template<> JSValue JSPerformanceResourceTimingConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSPerformanceEntry::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSPerformanceResourceTimingConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSPerformanceResourceTiming::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("PerformanceResourceTiming"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSPerformanceResourceTimingConstructor::s_info = { "PerformanceResourceTiming", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformanceResourceTimingConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSPerformanceResourceTimingPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPerformanceResourceTimingConstructor) } }, |
| { "initiatorType", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingInitiatorType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "redirectStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "redirectEnd", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "fetchStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingFetchStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "domainLookupStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "domainLookupEnd", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "connectStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "connectEnd", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "secureConnectionStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingSecureConnectionStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "requestStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRequestStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "responseStart", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "responseEnd", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| }; |
| |
| const ClassInfo JSPerformanceResourceTimingPrototype::s_info = { "PerformanceResourceTimingPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformanceResourceTimingPrototype) }; |
| |
| void JSPerformanceResourceTimingPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSPerformanceResourceTimingPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSPerformanceResourceTiming::s_info = { "PerformanceResourceTiming", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformanceResourceTiming) }; |
| |
| JSPerformanceResourceTiming::JSPerformanceResourceTiming(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PerformanceResourceTiming>&& impl) |
| : JSPerformanceEntry(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSPerformanceResourceTiming::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSPerformanceResourceTimingPrototype::create(vm, globalObject, JSPerformanceResourceTimingPrototype::createStructure(vm, globalObject, JSPerformanceEntry::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSPerformanceResourceTiming::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSPerformanceResourceTiming>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsPerformanceResourceTimingInitiatorType(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "initiatorType"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsStringWithCache(state, impl.initiatorType()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingRedirectStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "redirectStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.redirectStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingRedirectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "redirectEnd"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.redirectEnd()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingFetchStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "fetchStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.fetchStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingDomainLookupStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "domainLookupStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.domainLookupStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingDomainLookupEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "domainLookupEnd"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.domainLookupEnd()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingConnectStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "connectStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.connectStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingConnectEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "connectEnd"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.connectEnd()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingSecureConnectionStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "secureConnectionStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.secureConnectionStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingRequestStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "requestStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.requestStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingResponseStart(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "responseStart"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.responseStart()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingResponseEnd(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "PerformanceResourceTiming", "responseEnd"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.responseEnd()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceResourceTimingConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSPerformanceResourceTimingPrototype* domObject = jsDynamicCast<JSPerformanceResourceTimingPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSPerformanceResourceTiming::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSPerformanceResourceTimingConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSPerformanceResourceTimingPrototype* domObject = jsDynamicCast<JSPerformanceResourceTimingPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) { |
| throwVMTypeError(state, throwScope); |
| return false; |
| } |
| // Shadowing a built-in constructor |
| return domObject->putDirect(state->vm(), state->propertyNames().constructor, value); |
| } |
| |
| JSValue JSPerformanceResourceTiming::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSPerformanceResourceTimingConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| |
| } |
| |
| #endif // ENABLE(WEB_TIMING) |