| /* |
| 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 "JSPerformance.h" |
| |
| #include "EventNames.h" |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSDOMConvert.h" |
| #include "JSEventListener.h" |
| #include "JSPerformanceEntry.h" |
| #include "JSPerformanceNavigation.h" |
| #include "JSPerformanceTiming.h" |
| #include "PerformanceEntry.h" |
| #include "RuntimeEnabledFeatures.h" |
| #include <runtime/Error.h> |
| #include <runtime/JSArray.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Functions |
| |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntries(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntriesByType(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntriesByName(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionClearResourceTimings(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionSetResourceTimingBufferSize(JSC::ExecState*); |
| JSC::EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionNow(JSC::ExecState*); |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsPerformanceNavigation(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceTiming(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsPerformanceOnresourcetimingbufferfull(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSPerformanceOnresourcetimingbufferfull(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsPerformanceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSPerformanceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSPerformancePrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSPerformancePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSPerformancePrototype* ptr = new (NotNull, JSC::allocateCell<JSPerformancePrototype>(vm.heap)) JSPerformancePrototype(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: |
| JSPerformancePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSPerformance> JSPerformanceConstructor; |
| |
| template<> JSValue JSPerformanceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSEventTarget::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSPerformanceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSPerformance::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Performance"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSPerformanceConstructor::s_info = { "Performance", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformanceConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSPerformancePrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPerformanceConstructor) } }, |
| { "navigation", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceNavigation), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "timing", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTiming), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "onresourcetimingbufferfull", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceOnresourcetimingbufferfull), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPerformanceOnresourcetimingbufferfull) } }, |
| { "getEntries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionGetEntries), (intptr_t) (0) } }, |
| { "getEntriesByType", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionGetEntriesByType), (intptr_t) (1) } }, |
| { "getEntriesByName", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionGetEntriesByName), (intptr_t) (1) } }, |
| { "clearResourceTimings", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionClearResourceTimings), (intptr_t) (0) } }, |
| { "setResourceTimingBufferSize", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionSetResourceTimingBufferSize), (intptr_t) (1) } }, |
| { "now", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsPerformancePrototypeFunctionNow), (intptr_t) (0) } }, |
| }; |
| |
| const ClassInfo JSPerformancePrototype::s_info = { "PerformancePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformancePrototype) }; |
| |
| void JSPerformancePrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSPerformancePrototypeTableValues, *this); |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getEntries"), strlen("getEntries")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getEntriesByType"), strlen("getEntriesByType")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("getEntriesByName"), strlen("getEntriesByName")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("clearResourceTimings"), strlen("clearResourceTimings")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("setResourceTimingBufferSize"), strlen("setResourceTimingBufferSize")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| if (!RuntimeEnabledFeatures::sharedFeatures().resourceTimingEnabled()) { |
| Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("onresourcetimingbufferfull"), strlen("onresourcetimingbufferfull")); |
| VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); |
| JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); |
| } |
| } |
| |
| const ClassInfo JSPerformance::s_info = { "Performance", &Base::s_info, 0, CREATE_METHOD_TABLE(JSPerformance) }; |
| |
| JSPerformance::JSPerformance(Structure* structure, JSDOMGlobalObject& globalObject, Ref<Performance>&& impl) |
| : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSPerformance::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSPerformancePrototype::create(vm, globalObject, JSPerformancePrototype::createStructure(vm, globalObject, JSEventTarget::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSPerformance::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSPerformance>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsPerformanceNavigation(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<JSPerformance*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Performance", "navigation"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.navigation()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceTiming(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<JSPerformance*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Performance", "timing"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = toJS(state, castedThis->globalObject(), impl.timing()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsPerformanceOnresourcetimingbufferfull(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<JSPerformance*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Performance", "onresourcetimingbufferfull"); |
| } |
| UNUSED_PARAM(state); |
| return JSValue::encode(eventHandlerAttribute(castedThis->wrapped(), eventNames().resourcetimingbufferfullEvent)); |
| } |
| |
| |
| EncodedJSValue jsPerformanceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSPerformancePrototype* domObject = jsDynamicCast<JSPerformancePrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSPerformance::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSPerformanceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSPerformancePrototype* domObject = jsDynamicCast<JSPerformancePrototype*>(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); |
| } |
| |
| bool setJSPerformanceOnresourcetimingbufferfull(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSPerformance* castedThis = jsDynamicCast<JSPerformance*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "Performance", "onresourcetimingbufferfull"); |
| } |
| setEventHandlerAttribute(*state, *castedThis, castedThis->wrapped(), eventNames().resourcetimingbufferfullEvent, value); |
| return true; |
| } |
| |
| |
| JSValue JSPerformance::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSPerformanceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntries(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "getEntries"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsArray(state, castedThis->globalObject(), impl.getEntries()); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntriesByType(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "getEntriesByType"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| if (UNLIKELY(state->argumentCount() < 1)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| auto entryType = state->uncheckedArgument(0).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| JSValue result = jsArray(state, castedThis->globalObject(), impl.getEntriesByType(WTFMove(entryType))); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionGetEntriesByName(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "getEntriesByName"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| if (UNLIKELY(state->argumentCount() < 1)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| auto name = state->uncheckedArgument(0).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| auto entryType = state->argument(1).isUndefined() ? String() : state->uncheckedArgument(1).toWTFString(state); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| JSValue result = jsArray(state, castedThis->globalObject(), impl.getEntriesByName(WTFMove(name), WTFMove(entryType))); |
| return JSValue::encode(result); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionClearResourceTimings(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "clearResourceTimings"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| impl.clearResourceTimings(); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionSetResourceTimingBufferSize(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "setResourceTimingBufferSize"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| if (UNLIKELY(state->argumentCount() < 1)) |
| return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| auto maxSize = convert<uint32_t>(*state, state->uncheckedArgument(0), NormalConversion); |
| RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| impl.setResourceTimingBufferSize(WTFMove(maxSize)); |
| return JSValue::encode(jsUndefined()); |
| } |
| |
| EncodedJSValue JSC_HOST_CALL jsPerformancePrototypeFunctionNow(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue thisValue = state->thisValue(); |
| auto castedThis = jsDynamicCast<JSPerformance*>(thisValue); |
| if (UNLIKELY(!castedThis)) |
| return throwThisTypeError(*state, throwScope, "Performance", "now"); |
| ASSERT_GC_OBJECT_INHERITS(castedThis, JSPerformance::info()); |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.now()); |
| return JSValue::encode(result); |
| } |
| |
| void JSPerformance::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSPerformance*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| Base::visitChildren(thisObject, visitor); |
| thisObject->wrapped().visitJSEventListeners(visitor); |
| } |
| |
| bool JSPerformanceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| auto* jsPerformance = jsCast<JSPerformance*>(handle.slot()->asCell()); |
| if (jsPerformance->wrapped().isFiringEventListeners()) |
| return true; |
| Frame* root = WTF::getPtr(jsPerformance->wrapped().frame()); |
| if (!root) |
| return false; |
| return visitor.containsOpaqueRoot(root); |
| } |
| |
| void JSPerformanceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsPerformance = jsCast<JSPerformance*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsPerformance->wrapped(), jsPerformance); |
| } |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| #if PLATFORM(WIN) |
| #pragma warning(disable: 4483) |
| extern "C" { extern void (*const __identifier("??_7Performance@WebCore@@6B@")[])(); } |
| #else |
| extern "C" { extern void* _ZTVN7WebCore11PerformanceE[]; } |
| #endif |
| #endif |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<Performance>&& impl) |
| { |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| #if PLATFORM(WIN) |
| void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7Performance@WebCore@@6B@")); |
| #else |
| void* expectedVTablePointer = &_ZTVN7WebCore11PerformanceE[2]; |
| #if COMPILER(CLANG) |
| // If this fails Performance does not have a vtable, so you need to add the |
| // ImplementationLacksVTable attribute to the interface definition |
| static_assert(__is_polymorphic(Performance), "Performance is not polymorphic"); |
| #endif |
| #endif |
| // If you hit this assertion you either have a use after free bug, or |
| // Performance has subclasses. If Performance has subclasses that get passed |
| // to toJS() we currently require Performance you to opt out of binding hardening |
| // by adding the SkipVTableValidation attribute to the interface IDL definition |
| RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| #endif |
| return createWrapper<Performance>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Performance& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| Performance* JSPerformance::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSPerformance*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |
| |
| #endif // ENABLE(WEB_TIMING) |