| /* |
| 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" |
| #include "JSScreen.h" |
| |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include <runtime/FunctionPrototype.h> |
| #include <wtf/GetPtr.h> |
| |
| #if ENABLE(WEB_REPLAY) |
| #include "MemoizedDOMResult.h" |
| #include <replay/InputCursor.h> |
| #include <wtf/NeverDestroyed.h> |
| #endif |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsScreenHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenColorDepth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenPixelDepth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenAvailLeft(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenAvailTop(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenAvailHeight(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenAvailWidth(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| JSC::EncodedJSValue jsScreenConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSScreenConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSScreenPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSScreenPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSScreenPrototype* ptr = new (NotNull, JSC::allocateCell<JSScreenPrototype>(vm.heap)) JSScreenPrototype(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: |
| JSScreenPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructorNotConstructable<JSScreen> JSScreenConstructor; |
| |
| template<> JSValue JSScreenConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| UNUSED_PARAM(vm); |
| return globalObject.functionPrototype(); |
| } |
| |
| template<> void JSScreenConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSScreen::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Screen"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSScreenConstructor::s_info = { "Screen", &Base::s_info, 0, CREATE_METHOD_TABLE(JSScreenConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSScreenPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSScreenConstructor) } }, |
| { "height", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "width", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "colorDepth", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenColorDepth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "pixelDepth", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenPixelDepth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "availLeft", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailLeft), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "availTop", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailTop), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "availHeight", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailHeight), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| { "availWidth", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsScreenAvailWidth), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| }; |
| |
| const ClassInfo JSScreenPrototype::s_info = { "ScreenPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSScreenPrototype) }; |
| |
| void JSScreenPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSScreenPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSScreen::s_info = { "Screen", &Base::s_info, 0, CREATE_METHOD_TABLE(JSScreen) }; |
| |
| JSScreen::JSScreen(Structure* structure, JSDOMGlobalObject& globalObject, Ref<Screen>&& impl) |
| : JSDOMWrapper<Screen>(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSScreen::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSScreenPrototype::create(vm, globalObject, JSScreenPrototype::createStructure(vm, globalObject, globalObject->objectPrototype())); |
| } |
| |
| JSObject* JSScreen::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSScreen>(vm, globalObject); |
| } |
| |
| void JSScreen::destroy(JSC::JSCell* cell) |
| { |
| JSScreen* thisObject = static_cast<JSScreen*>(cell); |
| thisObject->JSScreen::~JSScreen(); |
| } |
| |
| EncodedJSValue jsScreenHeight(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "height"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.height", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().height(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.height()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenWidth(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "width"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.width", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().width(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.width()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenColorDepth(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "colorDepth"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.colorDepth", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().colorDepth(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.colorDepth()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenPixelDepth(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "pixelDepth"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.pixelDepth", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().pixelDepth(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.pixelDepth()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenAvailLeft(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "availLeft"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.availLeft", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| int32_t memoizedResult = castedThis->wrapped().availLeft(); |
| cursor.appendInput<MemoizedDOMResult<int32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| int32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<int32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.availLeft()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenAvailTop(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "availTop"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.availTop", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| int32_t memoizedResult = castedThis->wrapped().availTop(); |
| cursor.appendInput<MemoizedDOMResult<int32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| int32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<int32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.availTop()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenAvailHeight(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "availHeight"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.availHeight", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().availHeight(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.availHeight()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenAvailWidth(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<JSScreen*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "Screen", "availWidth"); |
| } |
| #if ENABLE(WEB_REPLAY) |
| JSGlobalObject* globalObject = state->lexicalGlobalObject(); |
| InputCursor& cursor = globalObject->inputCursor(); |
| static NeverDestroyed<const AtomicString> bindingName("Screen.availWidth", AtomicString::ConstructFromLiteral); |
| if (cursor.isCapturing()) { |
| uint32_t memoizedResult = castedThis->wrapped().availWidth(); |
| cursor.appendInput<MemoizedDOMResult<uint32_t>>(bindingName.get().string(), memoizedResult, 0); |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| |
| if (cursor.isReplaying()) { |
| uint32_t memoizedResult; |
| MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); |
| if (input && input->convertTo<uint32_t>(memoizedResult)) { |
| JSValue result = jsNumber(memoizedResult); |
| return JSValue::encode(result); |
| } |
| } |
| #endif |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsNumber(impl.availWidth()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsScreenConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSScreenPrototype* domObject = jsDynamicCast<JSScreenPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSScreen::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSScreenConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSScreenPrototype* domObject = jsDynamicCast<JSScreenPrototype*>(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 JSScreen::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSScreenConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| bool JSScreenOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) |
| { |
| auto* jsScreen = jsCast<JSScreen*>(handle.slot()->asCell()); |
| Frame* root = WTF::getPtr(jsScreen->wrapped().frame()); |
| if (!root) |
| return false; |
| return visitor.containsOpaqueRoot(root); |
| } |
| |
| void JSScreenOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| { |
| auto* jsScreen = jsCast<JSScreen*>(handle.slot()->asCell()); |
| auto& world = *static_cast<DOMWrapperWorld*>(context); |
| uncacheWrapper(world, &jsScreen->wrapped(), jsScreen); |
| } |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| #if PLATFORM(WIN) |
| #pragma warning(disable: 4483) |
| extern "C" { extern void (*const __identifier("??_7Screen@WebCore@@6B@")[])(); } |
| #else |
| extern "C" { extern void* _ZTVN7WebCore6ScreenE[]; } |
| #endif |
| #endif |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<Screen>&& impl) |
| { |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| #if PLATFORM(WIN) |
| void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7Screen@WebCore@@6B@")); |
| #else |
| void* expectedVTablePointer = &_ZTVN7WebCore6ScreenE[2]; |
| #if COMPILER(CLANG) |
| // If this fails Screen does not have a vtable, so you need to add the |
| // ImplementationLacksVTable attribute to the interface definition |
| static_assert(__is_polymorphic(Screen), "Screen is not polymorphic"); |
| #endif |
| #endif |
| // If you hit this assertion you either have a use after free bug, or |
| // Screen has subclasses. If Screen has subclasses that get passed |
| // to toJS() we currently require Screen you to opt out of binding hardening |
| // by adding the SkipVTableValidation attribute to the interface IDL definition |
| RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| #endif |
| return createWrapper<Screen>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, Screen& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| Screen* JSScreen::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSScreen*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |