/* THIS FILE IS AUTOGENERATED FROM XULPopupElement.webidl BY Codegen.py - DO NOT EDIT */ #include #include "AtomList.h" #include "ElementBinding.h" #include "MainThreadUtils.h" #include "WrapperFactory.h" #include "XULElementBinding.h" #include "XULPopupElementBinding.h" #include "XrayWrapper.h" #include "js/CallAndConstruct.h" #include "js/Exception.h" #include "js/MapAndSet.h" #include "js/Object.h" #include "js/PropertyAndElement.h" #include "js/PropertyDescriptor.h" #include "js/experimental/JitInfo.h" #include "mozilla/Atomics.h" #include "mozilla/OwningNonNull.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/DOMRect.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/Nullable.h" #include "mozilla/dom/PrimitiveConversions.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/SimpleGlobalObject.h" #include "mozilla/dom/XULPopupElement.h" #include "mozilla/dom/XrayExpandoClass.h" #include "nsContentUtils.h" #include "nsIContent.h" namespace mozilla::dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningStringOrOpenPopupOptions& aUnion, const char* aName, uint32_t aFlags) { if (aUnion.IsOpenPopupOptions()) { ImplCycleCollectionTraverse(aCallback, aUnion.GetAsOpenPopupOptions(), "mOpenPopupOptions", aFlags); } } void ImplCycleCollectionUnlink(OwningStringOrOpenPopupOptions& aUnion) { aUnion.Uninit(); } ActivateMenuItemOptions::ActivateMenuItemOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool ActivateMenuItemOptions::InitIds(JSContext* cx, ActivateMenuItemOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->shiftKey_id.init(cx, "shiftKey") || !atomsCache->metaKey_id.init(cx, "metaKey") || !atomsCache->ctrlKey_id.init(cx, "ctrlKey") || !atomsCache->button_id.init(cx, "button") || !atomsCache->altKey_id.init(cx, "altKey")) { return false; } return true; } bool ActivateMenuItemOptions::Init(BindingCallContext& cx, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // Passing a null JSContext is OK only if we're initing from null, // Since in that case we will not have to do any property gets // Also evaluate isNullOrUndefined in order to avoid false-positive // checkers by static analysis tools MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); ActivateMenuItemOptionsAtoms* atomsCache = nullptr; if (cx) { atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } } if (!IsConvertibleToDictionary(val)) { return cx.ThrowErrorMessage(sourceDescription, "dictionary"); } bool isNull = val.isNullOrUndefined(); // We only need these if !isNull, in which case we have |cx|. Maybe > object; Maybe > temp; if (!isNull) { MOZ_ASSERT(cx); object.emplace(cx, &val.toObject()); temp.emplace(cx); } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->altKey_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'altKey' member of ActivateMenuItemOptions", &mAltKey)) { return false; } } else { mAltKey = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->button_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'button' member of ActivateMenuItemOptions", &mButton)) { return false; } } else { mButton = 0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->ctrlKey_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'ctrlKey' member of ActivateMenuItemOptions", &mCtrlKey)) { return false; } } else { mCtrlKey = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->metaKey_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'metaKey' member of ActivateMenuItemOptions", &mMetaKey)) { return false; } } else { mMetaKey = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->shiftKey_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'shiftKey' member of ActivateMenuItemOptions", &mShiftKey)) { return false; } } else { mShiftKey = false; } mIsAnyMemberPresent = true; return true; } bool ActivateMenuItemOptions::Init(JSContext* cx_, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // We don't want to use sourceDescription for our context here; // that's not really what it's formatted for. BindingCallContext cx(cx_, nullptr); return Init(cx, val, sourceDescription, passedToJSImpl); } void ActivateMenuItemOptions::TraceDictionary(JSTracer* trc) { } ActivateMenuItemOptions& ActivateMenuItemOptions::operator=(const ActivateMenuItemOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mAltKey = aOther.mAltKey; mButton = aOther.mButton; mCtrlKey = aOther.mCtrlKey; mMetaKey = aOther.mMetaKey; mShiftKey = aOther.mShiftKey; return *this; } OpenPopupOptions::OpenPopupOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool OpenPopupOptions::InitIds(JSContext* cx, OpenPopupOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->y_id.init(cx, "y") || !atomsCache->x_id.init(cx, "x") || !atomsCache->triggerEvent_id.init(cx, "triggerEvent") || !atomsCache->position_id.init(cx, "position") || !atomsCache->isContextMenu_id.init(cx, "isContextMenu") || !atomsCache->attributesOverride_id.init(cx, "attributesOverride")) { return false; } return true; } bool OpenPopupOptions::Init(BindingCallContext& cx, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // Passing a null JSContext is OK only if we're initing from null, // Since in that case we will not have to do any property gets // Also evaluate isNullOrUndefined in order to avoid false-positive // checkers by static analysis tools MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); OpenPopupOptionsAtoms* atomsCache = nullptr; if (cx) { atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } } if (!IsConvertibleToDictionary(val)) { return cx.ThrowErrorMessage(sourceDescription, "dictionary"); } bool isNull = val.isNullOrUndefined(); // We only need these if !isNull, in which case we have |cx|. Maybe > object; Maybe > temp; if (!isNull) { MOZ_ASSERT(cx); object.emplace(cx, &val.toObject()); temp.emplace(cx); } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->attributesOverride_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'attributesOverride' member of OpenPopupOptions", &mAttributesOverride)) { return false; } } else { mAttributesOverride = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->isContextMenu_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'isContextMenu' member of OpenPopupOptions", &mIsContextMenu)) { return false; } } else { mIsContextMenu = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->position_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ConvertJSValueToString(cx, temp.ref(), eStringify, eStringify, mPosition)) { return false; } } else { mPosition.AssignLiteral(u""); } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->triggerEvent_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (temp.ref().isObject()) { static_assert(IsRefcounted::value, "We can only store refcounted classes."); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(temp.ptr(), mTriggerEvent, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("'triggerEvent' member of OpenPopupOptions", "Event"); return false; } } } else if (temp.ref().isNullOrUndefined()) { mTriggerEvent = nullptr; } else { cx.ThrowErrorMessage("'triggerEvent' member of OpenPopupOptions"); return false; } } else { mTriggerEvent = nullptr; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->x_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'x' member of OpenPopupOptions", &mX)) { return false; } } else { mX = 0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->y_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'y' member of OpenPopupOptions", &mY)) { return false; } } else { mY = 0; } mIsAnyMemberPresent = true; return true; } bool OpenPopupOptions::Init(JSContext* cx_, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // We don't want to use sourceDescription for our context here; // that's not really what it's formatted for. BindingCallContext cx(cx_, nullptr); return Init(cx, val, sourceDescription, passedToJSImpl); } void OpenPopupOptions::TraceDictionary(JSTracer* trc) { } OpenPopupOptions& OpenPopupOptions::operator=(const OpenPopupOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mAttributesOverride = aOther.mAttributesOverride; mIsContextMenu = aOther.mIsContextMenu; mPosition = aOther.mPosition; mTriggerEvent = aOther.mTriggerEvent; mX = aOther.mX; mY = aOther.mY; return *this; } bool StringOrOpenPopupOptions::TrySetToString(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot nsAutoString& memberSlot = RawSetAsString(); if (!ConvertJSValueToString(cx, value, eStringify, eStringify, memberSlot)) { return false; } } return true; } bool StringOrOpenPopupOptions::TrySetToOpenPopupOptions(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot binding_detail::FastOpenPopupOptions& memberSlot = RawSetAsOpenPopupOptions(); if (!IsConvertibleToDictionary(value)) { DestroyOpenPopupOptions(); tryNext = true; return true; } if (!memberSlot.Init(cx, value, "OpenPopupOptions branch of (DOMString or OpenPopupOptions)", passedToJSImpl)) { return false; } } return true; } bool StringOrOpenPopupOptions::TrySetToOpenPopupOptions(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToOpenPopupOptions(cx, value, tryNext, passedToJSImpl); } bool StringOrOpenPopupOptions::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (!done) { done = (failed = !TrySetToOpenPopupOptions(cx, value, tryNext, passedToJSImpl)) || !tryNext; } if (!done) { do { done = (failed = !TrySetToString(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "OpenPopupOptions"); return false; } return true; } bool StringOrOpenPopupOptions::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } OwningStringOrOpenPopupOptions::OwningStringOrOpenPopupOptions(OwningStringOrOpenPopupOptions&& aOther) : mType(eUninitialized) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eString: { mType = eString; mValue.mString.SetValue(std::move(aOther.mValue.mString.Value())); break; } case eOpenPopupOptions: { mType = eOpenPopupOptions; mValue.mOpenPopupOptions.SetValue(std::move(aOther.mValue.mOpenPopupOptions.Value())); break; } } } bool OwningStringOrOpenPopupOptions::TrySetToString(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot nsString& memberSlot = RawSetAsString(); if (!ConvertJSValueToString(cx, value, eStringify, eStringify, memberSlot)) { return false; } } return true; } [[nodiscard]] nsString& OwningStringOrOpenPopupOptions::RawSetAsString() { if (mType == eString) { return mValue.mString.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eString; return mValue.mString.SetValue(); } [[nodiscard]] nsString& OwningStringOrOpenPopupOptions::SetAsString() { if (mType == eString) { return mValue.mString.Value(); } Uninit(); mType = eString; return mValue.mString.SetValue(); } void OwningStringOrOpenPopupOptions::DestroyString() { MOZ_RELEASE_ASSERT(IsString(), "Wrong type!"); mValue.mString.Destroy(); mType = eUninitialized; } bool OwningStringOrOpenPopupOptions::TrySetToOpenPopupOptions(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot OpenPopupOptions& memberSlot = RawSetAsOpenPopupOptions(); if (!IsConvertibleToDictionary(value)) { DestroyOpenPopupOptions(); tryNext = true; return true; } if (!memberSlot.Init(cx, value, "OpenPopupOptions branch of (DOMString or OpenPopupOptions)", passedToJSImpl)) { return false; } } return true; } bool OwningStringOrOpenPopupOptions::TrySetToOpenPopupOptions(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToOpenPopupOptions(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] OpenPopupOptions& OwningStringOrOpenPopupOptions::RawSetAsOpenPopupOptions() { if (mType == eOpenPopupOptions) { return mValue.mOpenPopupOptions.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eOpenPopupOptions; return mValue.mOpenPopupOptions.SetValue(); } [[nodiscard]] OpenPopupOptions& OwningStringOrOpenPopupOptions::SetAsOpenPopupOptions() { if (mType == eOpenPopupOptions) { return mValue.mOpenPopupOptions.Value(); } Uninit(); mType = eOpenPopupOptions; return mValue.mOpenPopupOptions.SetValue(); } void OwningStringOrOpenPopupOptions::DestroyOpenPopupOptions() { MOZ_RELEASE_ASSERT(IsOpenPopupOptions(), "Wrong type!"); mValue.mOpenPopupOptions.Destroy(); mType = eUninitialized; } bool OwningStringOrOpenPopupOptions::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (!done) { done = (failed = !TrySetToOpenPopupOptions(cx, value, tryNext, passedToJSImpl)) || !tryNext; } if (!done) { do { done = (failed = !TrySetToString(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "OpenPopupOptions"); return false; } return true; } bool OwningStringOrOpenPopupOptions::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } void OwningStringOrOpenPopupOptions::Uninit() { switch (mType) { case eUninitialized: { break; } case eString: { DestroyString(); break; } case eOpenPopupOptions: { DestroyOpenPopupOptions(); break; } } } OwningStringOrOpenPopupOptions& OwningStringOrOpenPopupOptions::operator=(OwningStringOrOpenPopupOptions&& aOther) { this->~OwningStringOrOpenPopupOptions(); new (this) OwningStringOrOpenPopupOptions (std::move(aOther)); return *this; } OwningStringOrOpenPopupOptions& OwningStringOrOpenPopupOptions::operator=(const OwningStringOrOpenPopupOptions& aOther) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eString: { SetAsString() = aOther.GetAsString(); break; } case eOpenPopupOptions: { SetAsOpenPopupOptions() = aOther.GetAsOpenPopupOptions(); break; } } return *this; } namespace XULPopupElement_Binding { static_assert(IsRefcounted::value == IsRefcounted::value, "Can't inherit from an interface with a different ownership model."); MOZ_CAN_RUN_SCRIPT static bool openPopup(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.openPopup"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "openPopup", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); mozilla::dom::Element* arg0; if (args.hasDefined(0)) { if (args[0].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[0], arg0, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 1", "Element"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Argument 1"); return false; } } else { arg0 = nullptr; } StringOrOpenPopupOptions arg1; if (!(args.hasDefined(1))) { if (!arg1.RawSetAsOpenPopupOptions().Init(cx, JS::NullHandleValue, "Member of (DOMString or OpenPopupOptions)")) { return false; } } else { if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } } int32_t arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0; } int32_t arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0; } bool arg4; if (args.hasDefined(4)) { if (!ValueToPrimitive(cx, args[4], "Argument 5", &arg4)) { return false; } } else { arg4 = false; } bool arg5; if (args.hasDefined(5)) { if (!ValueToPrimitive(cx, args[5], "Argument 6", &arg5)) { return false; } } else { arg5 = false; } mozilla::dom::Event* arg6; if (args.hasDefined(6)) { if (args[6].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[6], arg6, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 7", "Event"); return false; } } } else if (args[6].isNullOrUndefined()) { arg6 = nullptr; } else { cx.ThrowErrorMessage("Argument 7"); return false; } } else { arg6 = nullptr; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vOpenPopup(MOZ_KnownLive(Constify(arg0)), Constify(arg1), arg2, arg3, arg4, arg5, MOZ_KnownLive(Constify(arg6))))>, "Should be returning void here"); MOZ_KnownLive(self)->OpenPopup(MOZ_KnownLive(Constify(arg0)), Constify(arg1), arg2, arg3, arg4, arg5, MOZ_KnownLive(Constify(arg6))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo openPopup_methodinfo = { { (JSJitGetterOp)openPopup }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool openPopupAtScreen(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.openPopupAtScreen"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "openPopupAtScreen", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0; } int32_t arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0; } bool arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = false; } mozilla::dom::Event* arg3; if (args.hasDefined(3)) { if (args[3].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[3], arg3, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 4", "Event"); return false; } } } else if (args[3].isNullOrUndefined()) { arg3 = nullptr; } else { cx.ThrowErrorMessage("Argument 4"); return false; } } else { arg3 = nullptr; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vOpenPopupAtScreen(arg0, arg1, arg2, MOZ_KnownLive(Constify(arg3))))>, "Should be returning void here"); MOZ_KnownLive(self)->OpenPopupAtScreen(arg0, arg1, arg2, MOZ_KnownLive(Constify(arg3))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo openPopupAtScreen_methodinfo = { { (JSJitGetterOp)openPopupAtScreen }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool openPopupAtScreenRect(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.openPopupAtScreenRect"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "openPopupAtScreenRect", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsAutoString arg0; if (args.hasDefined(0)) { if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } } else { arg0.AssignLiteral(u""); } int32_t arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0; } int32_t arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0; } int32_t arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0; } int32_t arg4; if (args.hasDefined(4)) { if (!ValueToPrimitive(cx, args[4], "Argument 5", &arg4)) { return false; } } else { arg4 = 0; } bool arg5; if (args.hasDefined(5)) { if (!ValueToPrimitive(cx, args[5], "Argument 6", &arg5)) { return false; } } else { arg5 = false; } bool arg6; if (args.hasDefined(6)) { if (!ValueToPrimitive(cx, args[6], "Argument 7", &arg6)) { return false; } } else { arg6 = false; } mozilla::dom::Event* arg7; if (args.hasDefined(7)) { if (args[7].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[7], arg7, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 8", "Event"); return false; } } } else if (args[7].isNullOrUndefined()) { arg7 = nullptr; } else { cx.ThrowErrorMessage("Argument 8"); return false; } } else { arg7 = nullptr; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vOpenPopupAtScreenRect(NonNullHelper(Constify(arg0)), arg1, arg2, arg3, arg4, arg5, arg6, MOZ_KnownLive(Constify(arg7))))>, "Should be returning void here"); MOZ_KnownLive(self)->OpenPopupAtScreenRect(NonNullHelper(Constify(arg0)), arg1, arg2, arg3, arg4, arg5, arg6, MOZ_KnownLive(Constify(arg7))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo openPopupAtScreenRect_methodinfo = { { (JSJitGetterOp)openPopupAtScreenRect }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool hidePopup(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "hidePopup", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vHidePopup(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->HidePopup(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo hidePopup_methodinfo = { { (JSJitGetterOp)hidePopup }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool activateItem(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.activateItem"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "activateItem", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); if (!args.requireAtLeast(cx, "XULPopupElement.activateItem", 1)) { return false; } NonNull arg0; if (args[0].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[0], arg0, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 1", "Element"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } binding_detail::FastActivateMenuItemOptions arg1; if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2", false)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vActivateItem(MOZ_KnownLive(NonNullHelper(arg0)), Constify(arg1), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ActivateItem(MOZ_KnownLive(NonNullHelper(arg0)), Constify(arg1), rv); if (rv.MaybeSetPendingException(cx, "XULPopupElement.activateItem")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo activateItem_methodinfo = { { (JSJitGetterOp)activateItem }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_label(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "label", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetLabel(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetLabel(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_label(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "label", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetLabel(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetLabel(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "XULPopupElement.label setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo label_getterinfo = { { get_label }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo label_setterinfo = { { (JSJitGetterOp)set_label }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Setter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_position(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "position", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetPosition(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetPosition(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_position(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "position", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetPosition(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetPosition(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "XULPopupElement.position setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo position_getterinfo = { { get_position }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo position_setterinfo = { { (JSJitGetterOp)set_position }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Setter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_state(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "state", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetState(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetState(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo state_getterinfo = { { get_state }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_triggerNode(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "triggerNode", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetTriggerNode())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!result) { args.rval().setNull(); return true; } if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo triggerNode_getterinfo = { { get_triggerNode }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_anchorNode(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "anchorNode", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetAnchorNode())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!result) { args.rval().setNull(); return true; } if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo anchorNode_getterinfo = { { get_anchorNode }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool getOuterScreenRect(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "getOuterScreenRect", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetOuterScreenRect())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getOuterScreenRect_methodinfo = { { (JSJitGetterOp)getOuterScreenRect }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool moveTo(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "moveTo", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); if (!args.requireAtLeast(cx, "XULPopupElement.moveTo", 2)) { return false; } int32_t arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } int32_t arg1; if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vMoveTo(arg0, arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->MoveTo(arg0, arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo moveTo_methodinfo = { { (JSJitGetterOp)moveTo }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool moveToAnchor(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.moveToAnchor"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "moveToAnchor", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); mozilla::dom::Element* arg0; if (args.hasDefined(0)) { if (args[0].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[0], arg0, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 1", "Element"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Argument 1"); return false; } } else { arg0 = nullptr; } nsAutoString arg1; if (args.hasDefined(1)) { if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } } else { arg1.AssignLiteral(u""); } int32_t arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0; } int32_t arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0; } bool arg4; if (args.hasDefined(4)) { if (!ValueToPrimitive(cx, args[4], "Argument 5", &arg4)) { return false; } } else { arg4 = false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vMoveToAnchor(MOZ_KnownLive(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, arg3, arg4))>, "Should be returning void here"); MOZ_KnownLive(self)->MoveToAnchor(MOZ_KnownLive(Constify(arg0)), NonNullHelper(Constify(arg1)), arg2, arg3, arg4); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo moveToAnchor_methodinfo = { { (JSJitGetterOp)moveToAnchor }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool sizeTo(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "sizeTo", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); if (!args.requireAtLeast(cx, "XULPopupElement.sizeTo", 2)) { return false; } int32_t arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } int32_t arg1; if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSizeTo(arg0, arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->SizeTo(arg0, arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo sizeTo_methodinfo = { { (JSJitGetterOp)sizeTo }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool setConstraintRect(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "XULPopupElement.setConstraintRect"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "setConstraintRect", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); if (!args.requireAtLeast(cx, "XULPopupElement.setConstraintRect", 1)) { return false; } NonNull arg0; if (args[0].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[0], arg0, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 1", "DOMRectReadOnly"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetConstraintRect(MOZ_KnownLive(NonNullHelper(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetConstraintRect(MOZ_KnownLive(NonNullHelper(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setConstraintRect_methodinfo = { { (JSJitGetterOp)setConstraintRect }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_isWaylandDragSource(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "isWaylandDragSource", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool result(MOZ_KnownLive(self)->IsWaylandDragSource()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isWaylandDragSource_getterinfo = { { get_isWaylandDragSource }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_isWaylandPopup(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "isWaylandPopup", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool result(MOZ_KnownLive(self)->IsWaylandPopup()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isWaylandPopup_getterinfo = { { get_isWaylandPopup }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_isNativeMenu(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "isNativeMenu", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool result(MOZ_KnownLive(self)->IsNativeMenu()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isNativeMenu_getterinfo = { { get_isNativeMenu }, { prototypes::id::XULPopupElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static void _finalize(JS::GCContext* gcx, JSObject* obj) { mozilla::dom::XULPopupElement* self = UnwrapPossiblyNotInitializedDOMObject(obj); if (self) { JS::SetNativeObjectReservedSlot(obj, DOM_OBJECT_SLOT, JS::UndefinedValue()); Element_Binding::ReflectedHTMLAttributeSlots::Finalize(obj); ClearWrapper(self, self, obj); if (size_t mallocBytes = BindingJSObjectMallocBytes(self)) { JS::RemoveAssociatedMemory(obj, mallocBytes, JS::MemoryUse::DOMBinding); } AddForDeferredFinalization(self); } } MOZ_GLOBINIT static const JSFunctionSpec sMethods_specs[] = { JS_FNSPEC("openPopup", (GenericMethod), reinterpret_cast(&openPopup_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("openPopupAtScreen", (GenericMethod), reinterpret_cast(&openPopupAtScreen_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("openPopupAtScreenRect", (GenericMethod), reinterpret_cast(&openPopupAtScreenRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hidePopup", (GenericMethod), reinterpret_cast(&hidePopup_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("activateItem", (GenericMethod), reinterpret_cast(&activateItem_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getOuterScreenRect", (GenericMethod), reinterpret_cast(&getOuterScreenRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("moveTo", (GenericMethod), reinterpret_cast(&moveTo_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("moveToAnchor", (GenericMethod), reinterpret_cast(&moveToAnchor_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("sizeTo", (GenericMethod), reinterpret_cast(&sizeTo_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setConstraintRect", (GenericMethod), reinterpret_cast(&setConstraintRect_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const Prefable sMethods[] = { { nullptr, &sMethods_specs[0] }, { nullptr, nullptr } }; static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); MOZ_GLOBINIT static const JSPropertySpec sAttributes_specs[] = { JSPropertySpec::nativeAccessors("label", JSPROP_ENUMERATE, GenericGetter, &label_getterinfo, GenericSetter, &label_setterinfo), JSPropertySpec::nativeAccessors("position", JSPROP_ENUMERATE, GenericGetter, &position_getterinfo, GenericSetter, &position_setterinfo), JSPropertySpec::nativeAccessors("state", JSPROP_ENUMERATE, GenericGetter, &state_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("triggerNode", JSPROP_ENUMERATE, GenericGetter, &triggerNode_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("anchorNode", JSPROP_ENUMERATE, GenericGetter, &anchorNode_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isWaylandDragSource", JSPROP_ENUMERATE, GenericGetter, &isWaylandDragSource_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isWaylandPopup", JSPROP_ENUMERATE, GenericGetter, &isWaylandPopup_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isNativeMenu", JSPROP_ENUMERATE, GenericGetter, &isNativeMenu_getterinfo, nullptr, nullptr), JS_PS_END }; static const Prefable sAttributes[] = { { nullptr, &sAttributes_specs[0] }, { nullptr, nullptr } }; static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(8 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX, "We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)"); static uint16_t sNativeProperties_sortedPropertyIndices[18]; static PropertyInfo sNativeProperties_propertyInfos[18]; static const NativePropertiesN<2> sNativeProperties = { false, 0, false, 0, true, 0 /* sMethods */, true, 1 /* sAttributes */, false, 0, false, 0, false, 0, -1, 18, sNativeProperties_sortedPropertyIndices, { { sMethods, &sNativeProperties_propertyInfos[0] }, { sAttributes, &sNativeProperties_propertyInfos[10] } } }; static_assert(18 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)), "We have a property info count that is oversized"); // This may allocate too many slots, because we only really need // slots for our non-interface-typed members that we cache. But // allocating slots only for those would make the slot index // computations much more complicated, so let's do this the simple // way for now. DEFINE_XRAY_EXPANDO_CLASS_WITH_OPS(static, sXrayExpandoObjectClass, 1, &Element_Binding::ReflectedHTMLAttributeSlots::sXrayExpandoObjectClassOps); bool sNativePropertiesInited = false; const NativePropertyHooks sNativePropertyHooks = { nullptr, { sNativeProperties.Upcast(), nullptr, &sNativePropertiesInited }, prototypes::id::XULPopupElement, constructors::id::XULPopupElement, &sXrayExpandoObjectClass }; static bool _constructor(JSContext* cx, unsigned argc, JS::Value* vp) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "XULPopupElement", "constructor", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); return HTMLConstructor(cx, argc, vp, constructors::id::XULPopupElement, prototypes::id::XULPopupElement, CreateInterfaceObjects); } static const DOMInterfaceInfo sInterfaceObjectInfo = { { _constructor, &sNativePropertyHooks }, XULElement_Binding::GetConstructorObjectHandle, PrototypeTraits::Depth, prototypes::id::XULPopupElement, true, 0, "XULPopupElement", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "XULPopupElementPrototype", JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(DOM_INTERFACE_PROTO_SLOTS_BASE), JS_NULL_CLASS_OPS, JS_NULL_CLASS_SPEC, JS_NULL_CLASS_EXT, JS_NULL_OBJECT_OPS }, eInterfacePrototype, prototypes::id::XULPopupElement, PrototypeTraits::Depth, &sNativePropertyHooks, XULElement_Binding::GetProtoObject }; bool ConstructorEnabled(JSContext* aCx, JS::Handle aObj) { return nsContentUtils::ThreadsafeIsSystemCaller(aCx); } static JS::Handle GetProtoObjectHandle(JSContext* aCx); static const JSClassOps sClassOps = { nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* enumerate */ nullptr, /* newEnumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */ _finalize, /* finalize */ nullptr, /* call */ nullptr, /* construct */ Element_Binding::ReflectedHTMLAttributeSlots::Trace, /* trace */ }; static const DOMJSClass sClass = { { "XULPopupElement", JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_PRESERVES_WRAPPER, &sClassOps, JS_NULL_CLASS_SPEC, &NativeTypeHelpers::sClassExtension, JS_NULL_OBJECT_OPS }, { prototypes::id::EventTarget, prototypes::id::Node, prototypes::id::Element, prototypes::id::XULElement, prototypes::id::XULPopupElement, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, std::is_base_of_v, &sNativePropertyHooks, GetProtoObjectHandle, GetCCParticipant::Get(), nullptr, NativeTypeHelpers::GetWrapperCache }; static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS, "Must have the right minimal number of reserved slots."); static_assert(2 >= 2, "Must have enough reserved slots."); bool Wrap(JSContext* aCx, mozilla::dom::XULPopupElement* aObject, nsWrapperCache* aCache, JS::Handle aGivenProto, JS::MutableHandle aReflector) { static_assert(!std::is_base_of_v, "Shouldn't have wrappercached things that are not refcounted."); static_assert(std::is_same_v); MOZ_ASSERT(static_cast(aObject) == reinterpret_cast(aObject), "Multiple inheritance for nsXULElement is broken."); MOZ_ASSERT(static_cast(aObject) == reinterpret_cast(aObject), "Multiple inheritance for mozilla::dom::Element is broken."); MOZ_ASSERT(static_cast(aObject) == reinterpret_cast(aObject), "Multiple inheritance for nsINode is broken."); MOZ_ASSERT(static_cast(aObject) == reinterpret_cast(aObject), "Multiple inheritance for mozilla::dom::EventTarget is broken."); MOZ_ASSERT(ToSupportsIsCorrect(aObject)); MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); MOZ_ASSERT(!aCache->GetWrapper(), "You should probably not be using Wrap() directly; use " "GetOrCreateDOMReflector instead"); MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), "nsISupports must be on our primary inheritance chain"); // If the wrapper cache contains a dead reflector then finalize that // now, ensuring that the finalizer for the old reflector always // runs before the new reflector is created and attached. This // avoids the awkward situation where there are multiple reflector // objects that contain pointers to the same native. if (JSObject* oldReflector = aCache->GetWrapperMaybeDead()) { _finalize(nullptr /* unused */, oldReflector); MOZ_ASSERT(!aCache->GetWrapperMaybeDead()); } JS::Rooted global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); if (!global) { return false; } MOZ_ASSERT(JS_IsGlobalObject(global)); JS::AssertObjectIsNotGray(global); // That might have ended up wrapping us already, due to the wonders // of XBL. Check for that, and bail out as needed. aReflector.set(aCache->GetWrapper()); if (aReflector) { #ifdef DEBUG AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); #endif // DEBUG return true; } JSAutoRealm ar(aCx, global); JS::Handle canonicalProto = GetProtoObjectHandle(aCx); if (!canonicalProto) { return false; } JS::Rooted proto(aCx); if (aGivenProto) { proto = aGivenProto; // Unfortunately, while aGivenProto was in the compartment of aCx // coming in, we changed compartments to that of "parent" so may need // to wrap the proto here. if (js::GetContextCompartment(aCx) != JS::GetCompartment(proto)) { if (!JS_WrapObject(aCx, &proto)) { return false; } } } else { proto = canonicalProto; } BindingJSObjectCreator creator(aCx); creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); if (!aReflector) { return false; } aCache->SetWrapper(aReflector); creator.InitializationSucceeded(); MOZ_ASSERT(aCache->GetWrapperPreserveColor() && aCache->GetWrapperPreserveColor() == aReflector); // If proto != canonicalProto, we have to preserve our wrapper; // otherwise we won't be able to properly recreate it later, since // we won't know what proto to use. Note that we don't check // aGivenProto here, since it's entirely possible (and even // somewhat common) to have a non-null aGivenProto which is the // same as canonicalProto. if (proto != canonicalProto) { PreserveWrapper(aObject); } return true; } void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::XULPopupElement); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::XULPopupElement); JS::Handle parentProto(XULElement_Binding::GetProtoObjectHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(XULElement_Binding::GetConstructorObjectHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), nullptr, "XULPopupElement", ShouldExpose(aCx, aGlobal, aDefineOnGlobal), nullptr, false, nullptr); } static JS::Handle GetProtoObjectHandle(JSContext* aCx) { /* Get the interface prototype object for this class. This will create the object as needed. */ return GetPerInterfaceObjectHandle(aCx, prototypes::id::XULPopupElement, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } JS::Handle GetConstructorObjectHandle(JSContext* aCx) { /* Get the interface object for this class. This will create the object as needed. */ return GetPerInterfaceObjectHandle(aCx, constructors::id::XULPopupElement, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace XULPopupElement_Binding } // namespace mozilla::dom