/* THIS FILE IS AUTOGENERATED FROM Element.webidl BY Codegen.py - DO NOT EDIT */ #include #include "ARIANotifyMixinBinding.h" #include "AnimatableBinding.h" #include "AtomList.h" #include "DOMPointBinding.h" #include "Document.h" #include "ElementBinding.h" #include "EventHandlerBinding.h" #include "GeometryUtilsBinding.h" #include "KeyframeAnimationOptionsBinding.h" #include "MainThreadUtils.h" #include "NodeBinding.h" #include "SanitizerBinding.h" #include "WindowBinding.h" #include "WrapperFactory.h" #include "XrayWrapper.h" #include "js/Array.h" #include "js/CallAndConstruct.h" #include "js/Exception.h" #include "js/ForOfIterator.h" #include "js/MapAndSet.h" #include "js/Object.h" #include "js/PropertyAndElement.h" #include "js/PropertyDescriptor.h" #include "js/experimental/JitInfo.h" #include "jsapi.h" #include "mozilla/Atomics.h" #include "mozilla/BasePrincipal.h" #include "mozilla/FloatingPoint.h" #include "mozilla/OwningNonNull.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/StaticPrefs_dom.h" #include "mozilla/UseCounter.h" #include "mozilla/dom/Animation.h" #include "mozilla/dom/Attr.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/ContentList.h" #include "mozilla/dom/CustomElementRegistry.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/DOMMatrix.h" #include "mozilla/dom/DOMPoint.h" #include "mozilla/dom/DOMQuad.h" #include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DocGroup.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/Flex.h" #include "mozilla/dom/Grid.h" #include "mozilla/dom/HTMLSlotElement.h" #include "mozilla/dom/NodeList.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/Nullable.h" #include "mozilla/dom/PrimitiveConversions.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/SimpleGlobalObject.h" #include "mozilla/dom/StylePropertyMapReadOnly.h" #include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/TrustedHTML.h" #include "mozilla/dom/TrustedScript.h" #include "mozilla/dom/TrustedScriptURL.h" #include "mozilla/dom/UnionTypes.h" #include "mozilla/dom/WebIDLPrefs.h" #include "mozilla/dom/XrayExpandoClass.h" #include "nsContentUtils.h" #include "nsDOMAttributeMap.h" #include "nsDOMTokenList.h" #include "nsIContent.h" #include "nsINode.h" #include "nsIScreen.h" #include "nsJSPrincipals.h" #include "nsTextNode.h" namespace mozilla { namespace dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; namespace binding_detail { constexpr nsLiteralCString EnumStrings::Values[5]; } // namespace binding_detail bool ToJSValue(JSContext* aCx, ScrollLogicalPosition aArgument, JS::MutableHandle aValue) { MOZ_ASSERT(uint32_t(aArgument) < std::size(binding_detail::EnumStrings::Values)); JSString* resultStr = JS_NewStringCopyN(aCx, binding_detail::EnumStrings::Values[uint32_t(aArgument)].BeginReading(), binding_detail::EnumStrings::Values[uint32_t(aArgument)].Length()); if (!resultStr) { return false; } aValue.setString(resultStr); return true; } namespace binding_detail { constexpr nsLiteralCString EnumStrings::Values[2]; } // namespace binding_detail bool ToJSValue(JSContext* aCx, FullscreenKeyboardLock aArgument, JS::MutableHandle aValue) { MOZ_ASSERT(uint32_t(aArgument) < std::size(binding_detail::EnumStrings::Values)); JSString* resultStr = JS_NewStringCopyN(aCx, binding_detail::EnumStrings::Values[uint32_t(aArgument)].BeginReading(), binding_detail::EnumStrings::Values[uint32_t(aArgument)].Length()); if (!resultStr) { return false; } aValue.setString(resultStr); return true; } void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString& aUnion, const char* aName, uint32_t aFlags) { if (aUnion.IsTrustedHTML()) { ImplCycleCollectionTraverse(aCallback, aUnion.GetAsTrustedHTML(), "mTrustedHTML", aFlags); } else if (aUnion.IsTrustedScript()) { ImplCycleCollectionTraverse(aCallback, aUnion.GetAsTrustedScript(), "mTrustedScript", aFlags); } else if (aUnion.IsTrustedScriptURL()) { ImplCycleCollectionTraverse(aCallback, aUnion.GetAsTrustedScriptURL(), "mTrustedScriptURL", aFlags); } } void ImplCycleCollectionUnlink(OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString& aUnion) { aUnion.Uninit(); } CheckVisibilityOptions::CheckVisibilityOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool CheckVisibilityOptions::InitIds(JSContext* cx, CheckVisibilityOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->visibilityProperty_id.init(cx, "visibilityProperty") || !atomsCache->opacityProperty_id.init(cx, "opacityProperty") || !atomsCache->flush_id.init(cx, "flush") || !atomsCache->contentVisibilityAuto_id.init(cx, "contentVisibilityAuto") || !atomsCache->checkVisibilityCSS_id.init(cx, "checkVisibilityCSS") || !atomsCache->checkOpacity_id.init(cx, "checkOpacity")) { return false; } return true; } bool CheckVisibilityOptions::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()); CheckVisibilityOptionsAtoms* 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->checkOpacity_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'checkOpacity' member of CheckVisibilityOptions", &mCheckOpacity)) { return false; } } else { mCheckOpacity = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->checkVisibilityCSS_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'checkVisibilityCSS' member of CheckVisibilityOptions", &mCheckVisibilityCSS)) { return false; } } else { mCheckVisibilityCSS = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->contentVisibilityAuto_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'contentVisibilityAuto' member of CheckVisibilityOptions", &mContentVisibilityAuto)) { return false; } } else { mContentVisibilityAuto = false; } mIsAnyMemberPresent = true; if (!isNull) { if (nsContentUtils::ThreadsafeIsSystemCaller(cx)) { if (!JS_GetPropertyById(cx, *object, atomsCache->flush_id, temp.ptr())) { return false; } } else { temp->setUndefined(); } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'flush' member of CheckVisibilityOptions", &mFlush)) { return false; } } else { mFlush = true; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->opacityProperty_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'opacityProperty' member of CheckVisibilityOptions", &mOpacityProperty)) { return false; } } else { mOpacityProperty = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->visibilityProperty_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'visibilityProperty' member of CheckVisibilityOptions", &mVisibilityProperty)) { return false; } } else { mVisibilityProperty = false; } mIsAnyMemberPresent = true; return true; } bool CheckVisibilityOptions::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 CheckVisibilityOptions::TraceDictionary(JSTracer* trc) { } CheckVisibilityOptions& CheckVisibilityOptions::operator=(const CheckVisibilityOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mCheckOpacity = aOther.mCheckOpacity; mCheckVisibilityCSS = aOther.mCheckVisibilityCSS; mContentVisibilityAuto = aOther.mContentVisibilityAuto; mFlush = aOther.mFlush; mOpacityProperty = aOther.mOpacityProperty; mVisibilityProperty = aOther.mVisibilityProperty; return *this; } FocusOptions::FocusOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool FocusOptions::InitIds(JSContext* cx, FocusOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->preventScroll_id.init(cx, "preventScroll") || !atomsCache->focusVisible_id.init(cx, "focusVisible")) { return false; } return true; } bool FocusOptions::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()); FocusOptionsAtoms* 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->focusVisible_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mFocusVisible.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'focusVisible' member of FocusOptions", &(mFocusVisible.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->preventScroll_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'preventScroll' member of FocusOptions", &mPreventScroll)) { return false; } } else { mPreventScroll = false; } mIsAnyMemberPresent = true; return true; } bool FocusOptions::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 FocusOptions::TraceDictionary(JSTracer* trc) { } FocusOptions& FocusOptions::operator=(const FocusOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mFocusVisible.Reset(); if (aOther.mFocusVisible.WasPassed()) { mFocusVisible.Construct(aOther.mFocusVisible.Value()); } mPreventScroll = aOther.mPreventScroll; return *this; } FullscreenOptions::FullscreenOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool FullscreenOptions::InitIds(JSContext* cx, FullscreenOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->keyboardLock_id.init(cx, "keyboardLock")) { return false; } return true; } bool FullscreenOptions::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()); FullscreenOptionsAtoms* 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 (StaticPrefs::dom_fullscreen_keyboard_lock_enabled()) { if (!JS_GetPropertyById(cx, *object, atomsCache->keyboardLock_id, temp.ptr())) { return false; } } else { temp->setUndefined(); } } if (!isNull && !temp->isUndefined()) { { int index; if (!binding_detail::FindEnumStringIndex(cx, temp.ref(), binding_detail::EnumStrings::Values, "FullscreenKeyboardLock", "'keyboardLock' member of FullscreenOptions", &index)) { return false; } MOZ_ASSERT(index >= 0); mKeyboardLock = static_cast(index); } } else { mKeyboardLock = FullscreenKeyboardLock::None; } mIsAnyMemberPresent = true; return true; } bool FullscreenOptions::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 FullscreenOptions::TraceDictionary(JSTracer* trc) { } FullscreenOptions& FullscreenOptions::operator=(const FullscreenOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mKeyboardLock = aOther.mKeyboardLock; return *this; } GetHTMLOptions::GetHTMLOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool GetHTMLOptions::InitIds(JSContext* cx, GetHTMLOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->shadowRoots_id.init(cx, "shadowRoots") || !atomsCache->serializableShadowRoots_id.init(cx, "serializableShadowRoots")) { return false; } return true; } bool GetHTMLOptions::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()); GetHTMLOptionsAtoms* 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->serializableShadowRoots_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'serializableShadowRoots' member of GetHTMLOptions", &mSerializableShadowRoots)) { return false; } } else { mSerializableShadowRoots = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->shadowRoots_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (temp.ref().isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(temp.ref(), JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("'shadowRoots' member of GetHTMLOptions", "sequence"); return false; } Sequence> &arr = mShadowRoots; if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of 'shadowRoots' member of GetHTMLOptions", "ShadowRoot"); return false; } } } else { cx.ThrowErrorMessage("Element of 'shadowRoots' member of GetHTMLOptions"); return false; } } } else { cx.ThrowErrorMessage("'shadowRoots' member of GetHTMLOptions", "sequence"); return false; } } else { /* mShadowRoots array is already empty; nothing to do */ } mIsAnyMemberPresent = true; return true; } bool GetHTMLOptions::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 GetHTMLOptions::TraceDictionary(JSTracer* trc) { } GetHTMLOptions& GetHTMLOptions::operator=(const GetHTMLOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mSerializableShadowRoots = aOther.mSerializableShadowRoots; mShadowRoots = aOther.mShadowRoots; return *this; } PointerLockOptions::PointerLockOptions() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool PointerLockOptions::InitIds(JSContext* cx, PointerLockOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->unadjustedMovement_id.init(cx, "unadjustedMovement")) { return false; } return true; } bool PointerLockOptions::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()); PointerLockOptionsAtoms* 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->unadjustedMovement_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'unadjustedMovement' member of PointerLockOptions", &mUnadjustedMovement)) { return false; } } else { mUnadjustedMovement = false; } mIsAnyMemberPresent = true; return true; } bool PointerLockOptions::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 PointerLockOptions::TraceDictionary(JSTracer* trc) { } PointerLockOptions& PointerLockOptions::operator=(const PointerLockOptions& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mUnadjustedMovement = aOther.mUnadjustedMovement; return *this; } ScrollIntoViewOptions::ScrollIntoViewOptions() : ScrollOptions(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool ScrollIntoViewOptions::InitIds(JSContext* cx, ScrollIntoViewOptionsAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->inline_id.init(cx, "inline") || !atomsCache->block_id.init(cx, "block")) { return false; } return true; } bool ScrollIntoViewOptions::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()); ScrollIntoViewOptionsAtoms* atomsCache = nullptr; if (cx) { atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } } // Per spec, we init the parent's members first if (!ScrollOptions::Init(cx, val)) { return false; } 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->block_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { { int index; if (!binding_detail::FindEnumStringIndex(cx, temp.ref(), binding_detail::EnumStrings::Values, "ScrollLogicalPosition", "'block' member of ScrollIntoViewOptions", &index)) { return false; } MOZ_ASSERT(index >= 0); mBlock = static_cast(index); } } else { mBlock = ScrollLogicalPosition::Auto; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->inline_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { { int index; if (!binding_detail::FindEnumStringIndex(cx, temp.ref(), binding_detail::EnumStrings::Values, "ScrollLogicalPosition", "'inline' member of ScrollIntoViewOptions", &index)) { return false; } MOZ_ASSERT(index >= 0); mInline = static_cast(index); } } else { mInline = ScrollLogicalPosition::Auto; } mIsAnyMemberPresent = true; return true; } bool ScrollIntoViewOptions::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 ScrollIntoViewOptions::TraceDictionary(JSTracer* trc) { ScrollOptions::TraceDictionary(trc); } ScrollIntoViewOptions& ScrollIntoViewOptions::operator=(const ScrollIntoViewOptions& aOther) { ScrollOptions::operator=(aOther); mBlock = aOther.mBlock; mInline = aOther.mInline; return *this; } ShadowRootInit::ShadowRootInit() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool ShadowRootInit::InitIds(JSContext* cx, ShadowRootInitAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->slotAssignment_id.init(cx, "slotAssignment") || !atomsCache->serializable_id.init(cx, "serializable") || !atomsCache->referenceTarget_id.init(cx, "referenceTarget") || !atomsCache->mode_id.init(cx, "mode") || !atomsCache->delegatesFocus_id.init(cx, "delegatesFocus") || !atomsCache->customElementRegistry_id.init(cx, "customElementRegistry") || !atomsCache->clonable_id.init(cx, "clonable")) { return false; } return true; } bool ShadowRootInit::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()); ShadowRootInitAtoms* 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->clonable_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'clonable' member of ShadowRootInit", &mClonable)) { return false; } } else { mClonable = false; } mIsAnyMemberPresent = true; if (!isNull) { if (StaticPrefs::dom_scoped_custom_element_registries_enabled()) { if (!JS_GetPropertyById(cx, *object, atomsCache->customElementRegistry_id, temp.ptr())) { return false; } } else { temp->setUndefined(); } } if (!isNull && !temp->isUndefined()) { mCustomElementRegistry.Construct(); 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(), (mCustomElementRegistry.Value()), cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("'customElementRegistry' member of ShadowRootInit", "CustomElementRegistry"); return false; } } } else if (temp.ref().isNullOrUndefined()) { (mCustomElementRegistry.Value()) = nullptr; } else { cx.ThrowErrorMessage("'customElementRegistry' member of ShadowRootInit"); return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->delegatesFocus_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'delegatesFocus' member of ShadowRootInit", &mDelegatesFocus)) { return false; } } else { mDelegatesFocus = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->mode_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { { int index; if (!binding_detail::FindEnumStringIndex(cx, temp.ref(), binding_detail::EnumStrings::Values, "ShadowRootMode", "'mode' member of ShadowRootInit", &index)) { return false; } MOZ_ASSERT(index >= 0); mMode = static_cast(index); } mIsAnyMemberPresent = true; } else if (cx) { // Don't error out if we have no cx. In that // situation the caller is default-constructing us and we'll // just assume they know what they're doing. return cx.ThrowErrorMessage("'mode' member of ShadowRootInit"); } if (!isNull) { if (StaticPrefs::dom_shadowdom_referenceTarget_enabled()) { if (!JS_GetPropertyById(cx, *object, atomsCache->referenceTarget_id, temp.ptr())) { return false; } } else { temp->setUndefined(); } } if (!isNull && !temp->isUndefined()) { mReferenceTarget.Construct(); if (!ConvertJSValueToString(cx, temp.ref(), eNull, eNull, (mReferenceTarget.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->serializable_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'serializable' member of ShadowRootInit", &mSerializable)) { return false; } } else { mSerializable = false; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->slotAssignment_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { { int index; if (!binding_detail::FindEnumStringIndex(cx, temp.ref(), binding_detail::EnumStrings::Values, "SlotAssignmentMode", "'slotAssignment' member of ShadowRootInit", &index)) { return false; } MOZ_ASSERT(index >= 0); mSlotAssignment = static_cast(index); } } else { mSlotAssignment = SlotAssignmentMode::Named; } mIsAnyMemberPresent = true; return true; } bool ShadowRootInit::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 ShadowRootInit::TraceDictionary(JSTracer* trc) { } ShadowRootInit& ShadowRootInit::operator=(const ShadowRootInit& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mClonable = aOther.mClonable; mCustomElementRegistry.Reset(); if (aOther.mCustomElementRegistry.WasPassed()) { mCustomElementRegistry.Construct(aOther.mCustomElementRegistry.Value()); } mDelegatesFocus = aOther.mDelegatesFocus; mMode = aOther.mMode; mReferenceTarget.Reset(); if (aOther.mReferenceTarget.WasPassed()) { mReferenceTarget.Construct(aOther.mReferenceTarget.Value()); } mSerializable = aOther.mSerializable; mSlotAssignment = aOther.mSlotAssignment; return *this; } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedHTML(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot NonNull& memberSlot = RawSetAsTrustedHTML(); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedHTML(); tryNext = true; return true; } } } return true; } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedHTML(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedHTML(cx, value, tryNext, passedToJSImpl); } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScript(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot NonNull& memberSlot = RawSetAsTrustedScript(); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedScript(); tryNext = true; return true; } } } return true; } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScript(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedScript(cx, value, tryNext, passedToJSImpl); } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScriptURL(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot NonNull& memberSlot = RawSetAsTrustedScriptURL(); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedScriptURL(); tryNext = true; return true; } } } return true; } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScriptURL(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedScriptURL(cx, value, tryNext, passedToJSImpl); } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::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 TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (value.isObject()) { done = (failed = !TrySetToTrustedHTML(cx, value, tryNext, passedToJSImpl)) || !tryNext || (failed = !TrySetToTrustedScript(cx, value, tryNext, passedToJSImpl)) || !tryNext || (failed = !TrySetToTrustedScriptURL(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, "TrustedHTML, TrustedScript, TrustedScriptURL"); return false; } return true; } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } bool TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::ToJSVal(JSContext* cx, JS::Handle scopeObj, JS::MutableHandle rval) const { switch (mType) { case eUninitialized: { return false; } case eTrustedHTML: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedHTML.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eTrustedScript: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedScript.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eTrustedScriptURL: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedScriptURL.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eString: { if (!xpc::NonVoidStringToJsval(cx, mValue.mString.Value(), rval)) { return false; } return true; } default: { return false; } } } OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString(OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString&& aOther) : mType(eUninitialized) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eTrustedHTML: { mType = eTrustedHTML; mValue.mTrustedHTML.SetValue(std::move(aOther.mValue.mTrustedHTML.Value())); break; } case eTrustedScript: { mType = eTrustedScript; mValue.mTrustedScript.SetValue(std::move(aOther.mValue.mTrustedScript.Value())); break; } case eTrustedScriptURL: { mType = eTrustedScriptURL; mValue.mTrustedScriptURL.SetValue(std::move(aOther.mValue.mTrustedScriptURL.Value())); break; } case eString: { mType = eString; mValue.mString.SetValue(std::move(aOther.mValue.mString.Value())); break; } } } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedHTML(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot OwningNonNull& memberSlot = RawSetAsTrustedHTML(); 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(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedHTML(); tryNext = true; return true; } } } return true; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedHTML(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedHTML(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::RawSetAsTrustedHTML() { if (mType == eTrustedHTML) { return mValue.mTrustedHTML.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eTrustedHTML; return mValue.mTrustedHTML.SetValue(); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::SetAsTrustedHTML() { if (mType == eTrustedHTML) { return mValue.mTrustedHTML.Value(); } Uninit(); mType = eTrustedHTML; return mValue.mTrustedHTML.SetValue(); } void OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::DestroyTrustedHTML() { MOZ_RELEASE_ASSERT(IsTrustedHTML(), "Wrong type!"); mValue.mTrustedHTML.Destroy(); mType = eUninitialized; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScript(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot OwningNonNull& memberSlot = RawSetAsTrustedScript(); 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(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedScript(); tryNext = true; return true; } } } return true; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScript(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedScript(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::RawSetAsTrustedScript() { if (mType == eTrustedScript) { return mValue.mTrustedScript.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eTrustedScript; return mValue.mTrustedScript.SetValue(); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::SetAsTrustedScript() { if (mType == eTrustedScript) { return mValue.mTrustedScript.Value(); } Uninit(); mType = eTrustedScript; return mValue.mTrustedScript.SetValue(); } void OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::DestroyTrustedScript() { MOZ_RELEASE_ASSERT(IsTrustedScript(), "Wrong type!"); mValue.mTrustedScript.Destroy(); mType = eUninitialized; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScriptURL(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot OwningNonNull& memberSlot = RawSetAsTrustedScriptURL(); 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(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyTrustedScriptURL(); tryNext = true; return true; } } } return true; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::TrySetToTrustedScriptURL(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToTrustedScriptURL(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::RawSetAsTrustedScriptURL() { if (mType == eTrustedScriptURL) { return mValue.mTrustedScriptURL.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eTrustedScriptURL; return mValue.mTrustedScriptURL.SetValue(); } [[nodiscard]] OwningNonNull& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::SetAsTrustedScriptURL() { if (mType == eTrustedScriptURL) { return mValue.mTrustedScriptURL.Value(); } Uninit(); mType = eTrustedScriptURL; return mValue.mTrustedScriptURL.SetValue(); } void OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::DestroyTrustedScriptURL() { MOZ_RELEASE_ASSERT(IsTrustedScriptURL(), "Wrong type!"); mValue.mTrustedScriptURL.Destroy(); mType = eUninitialized; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::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& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::RawSetAsString() { if (mType == eString) { return mValue.mString.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eString; return mValue.mString.SetValue(); } [[nodiscard]] nsString& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::SetAsString() { if (mType == eString) { return mValue.mString.Value(); } Uninit(); mType = eString; return mValue.mString.SetValue(); } void OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::DestroyString() { MOZ_RELEASE_ASSERT(IsString(), "Wrong type!"); mValue.mString.Destroy(); mType = eUninitialized; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (value.isObject()) { done = (failed = !TrySetToTrustedHTML(cx, value, tryNext, passedToJSImpl)) || !tryNext || (failed = !TrySetToTrustedScript(cx, value, tryNext, passedToJSImpl)) || !tryNext || (failed = !TrySetToTrustedScriptURL(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, "TrustedHTML, TrustedScript, TrustedScriptURL"); return false; } return true; } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } void OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::Uninit() { switch (mType) { case eUninitialized: { break; } case eTrustedHTML: { DestroyTrustedHTML(); break; } case eTrustedScript: { DestroyTrustedScript(); break; } case eTrustedScriptURL: { DestroyTrustedScriptURL(); break; } case eString: { DestroyString(); break; } } } bool OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::ToJSVal(JSContext* cx, JS::Handle scopeObj, JS::MutableHandle rval) const { switch (mType) { case eUninitialized: { return false; } case eTrustedHTML: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedHTML.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eTrustedScript: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedScript.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eTrustedScriptURL: { if (!WrapNewBindingNonWrapperCachedObject(cx, scopeObj, mValue.mTrustedScriptURL.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } case eString: { if (!xpc::NonVoidStringToJsval(cx, mValue.mString.Value(), rval)) { return false; } return true; } default: { return false; } } } OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::operator=(OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString&& aOther) { this->~OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString(); new (this) OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString (std::move(aOther)); return *this; } OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString& OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString::operator=(const OwningTrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString& aOther) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eTrustedHTML: { SetAsTrustedHTML() = aOther.GetAsTrustedHTML(); break; } case eTrustedScript: { SetAsTrustedScript() = aOther.GetAsTrustedScript(); break; } case eTrustedScriptURL: { SetAsTrustedScriptURL() = aOther.GetAsTrustedScriptURL(); break; } case eString: { SetAsString() = aOther.GetAsString(); break; } } return *this; } bool BooleanOrScrollIntoViewOptions::TrySetToBoolean(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot bool& memberSlot = RawSetAsBoolean(); if (!ValueToPrimitive(cx, value, "Boolean branch of (boolean or ScrollIntoViewOptions)", &memberSlot)) { return false; } } return true; } bool BooleanOrScrollIntoViewOptions::TrySetToScrollIntoViewOptions(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot binding_detail::FastScrollIntoViewOptions& memberSlot = RawSetAsScrollIntoViewOptions(); if (!IsConvertibleToDictionary(value)) { DestroyScrollIntoViewOptions(); tryNext = true; return true; } if (!memberSlot.Init(cx, value, "ScrollIntoViewOptions branch of (boolean or ScrollIntoViewOptions)", passedToJSImpl)) { return false; } } return true; } bool BooleanOrScrollIntoViewOptions::TrySetToScrollIntoViewOptions(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToScrollIntoViewOptions(cx, value, tryNext, passedToJSImpl); } bool BooleanOrScrollIntoViewOptions::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 = !TrySetToScrollIntoViewOptions(cx, value, tryNext, passedToJSImpl)) || !tryNext; } if (!done) { do { done = (failed = !TrySetToBoolean(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "ScrollIntoViewOptions"); return false; } return true; } bool BooleanOrScrollIntoViewOptions::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } OwningBooleanOrScrollIntoViewOptions::OwningBooleanOrScrollIntoViewOptions(OwningBooleanOrScrollIntoViewOptions&& aOther) : mType(eUninitialized) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eBoolean: { mType = eBoolean; mValue.mBoolean.SetValue(std::move(aOther.mValue.mBoolean.Value())); break; } case eScrollIntoViewOptions: { mType = eScrollIntoViewOptions; mValue.mScrollIntoViewOptions.SetValue(std::move(aOther.mValue.mScrollIntoViewOptions.Value())); break; } } } bool OwningBooleanOrScrollIntoViewOptions::TrySetToBoolean(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot bool& memberSlot = RawSetAsBoolean(); if (!ValueToPrimitive(cx, value, "Boolean branch of (boolean or ScrollIntoViewOptions)", &memberSlot)) { return false; } } return true; } [[nodiscard]] bool& OwningBooleanOrScrollIntoViewOptions::RawSetAsBoolean() { if (mType == eBoolean) { return mValue.mBoolean.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eBoolean; return mValue.mBoolean.SetValue(); } [[nodiscard]] bool& OwningBooleanOrScrollIntoViewOptions::SetAsBoolean() { if (mType == eBoolean) { return mValue.mBoolean.Value(); } Uninit(); mType = eBoolean; return mValue.mBoolean.SetValue(); } void OwningBooleanOrScrollIntoViewOptions::DestroyBoolean() { MOZ_RELEASE_ASSERT(IsBoolean(), "Wrong type!"); mValue.mBoolean.Destroy(); mType = eUninitialized; } bool OwningBooleanOrScrollIntoViewOptions::TrySetToScrollIntoViewOptions(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot ScrollIntoViewOptions& memberSlot = RawSetAsScrollIntoViewOptions(); if (!IsConvertibleToDictionary(value)) { DestroyScrollIntoViewOptions(); tryNext = true; return true; } if (!memberSlot.Init(cx, value, "ScrollIntoViewOptions branch of (boolean or ScrollIntoViewOptions)", passedToJSImpl)) { return false; } } return true; } bool OwningBooleanOrScrollIntoViewOptions::TrySetToScrollIntoViewOptions(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToScrollIntoViewOptions(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] ScrollIntoViewOptions& OwningBooleanOrScrollIntoViewOptions::RawSetAsScrollIntoViewOptions() { if (mType == eScrollIntoViewOptions) { return mValue.mScrollIntoViewOptions.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eScrollIntoViewOptions; return mValue.mScrollIntoViewOptions.SetValue(); } [[nodiscard]] ScrollIntoViewOptions& OwningBooleanOrScrollIntoViewOptions::SetAsScrollIntoViewOptions() { if (mType == eScrollIntoViewOptions) { return mValue.mScrollIntoViewOptions.Value(); } Uninit(); mType = eScrollIntoViewOptions; return mValue.mScrollIntoViewOptions.SetValue(); } void OwningBooleanOrScrollIntoViewOptions::DestroyScrollIntoViewOptions() { MOZ_RELEASE_ASSERT(IsScrollIntoViewOptions(), "Wrong type!"); mValue.mScrollIntoViewOptions.Destroy(); mType = eUninitialized; } bool OwningBooleanOrScrollIntoViewOptions::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 = !TrySetToScrollIntoViewOptions(cx, value, tryNext, passedToJSImpl)) || !tryNext; } if (!done) { do { done = (failed = !TrySetToBoolean(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "ScrollIntoViewOptions"); return false; } return true; } bool OwningBooleanOrScrollIntoViewOptions::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } void OwningBooleanOrScrollIntoViewOptions::Uninit() { switch (mType) { case eUninitialized: { break; } case eBoolean: { DestroyBoolean(); break; } case eScrollIntoViewOptions: { DestroyScrollIntoViewOptions(); break; } } } OwningBooleanOrScrollIntoViewOptions& OwningBooleanOrScrollIntoViewOptions::operator=(OwningBooleanOrScrollIntoViewOptions&& aOther) { this->~OwningBooleanOrScrollIntoViewOptions(); new (this) OwningBooleanOrScrollIntoViewOptions (std::move(aOther)); return *this; } OwningBooleanOrScrollIntoViewOptions& OwningBooleanOrScrollIntoViewOptions::operator=(const OwningBooleanOrScrollIntoViewOptions& aOther) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eBoolean: { SetAsBoolean() = aOther.GetAsBoolean(); break; } case eScrollIntoViewOptions: { SetAsScrollIntoViewOptions() = aOther.GetAsScrollIntoViewOptions(); break; } } return *this; } namespace Element_Binding { static_assert(IsRefcounted::value == IsRefcounted::value, "Can't inherit from an interface with a different ownership model."); MOZ_CAN_RUN_SCRIPT static bool get_namespaceURI(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "namespaceURI", 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_vGetNamespaceURI(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetNamespaceURI(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo namespaceURI_getterinfo = { { get_namespaceURI }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_prefix(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "prefix", 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_vGetPrefix(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetPrefix(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo prefix_getterinfo = { { get_prefix }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_localName(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "localName", 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_vGetLocalName(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetLocalName(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo localName_getterinfo = { { get_localName }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_tagName(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "tagName", 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_vGetTagName(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetTagName(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo tagName_getterinfo = { { get_tagName }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_id(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "id", 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_vGetId(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetId(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_id(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "id", 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; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetId(NonNullHelper(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetId(NonNullHelper(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo id_getterinfo = { { get_id }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 id_setterinfo = { { (JSJitGetterOp)set_id }, { prototypes::id::Element }, { 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_className(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "className", 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_vGetClassName(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetClassName(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_className(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "className", 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; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetClassName(NonNullHelper(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetClassName(NonNullHelper(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo className_getterinfo = { { get_className }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 className_setterinfo = { { (JSJitGetterOp)set_className }, { prototypes::id::Element }, { 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_classList(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "classList", 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)->ClassList())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_classList(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.classList setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "classList", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); JS::Rooted v(cx); if (!JS_GetProperty(cx, obj, "classList", &v)) { return false; } if (!v.isObject()) { return cx.ThrowErrorMessage("Element.classList"); } JS::Rooted targetObj(cx, &v.toObject()); return JS_SetProperty(cx, targetObj, "value", args[0]); } static const JSJitInfo classList_getterinfo = { { get_classList }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 classList_setterinfo = { { (JSJitGetterOp)set_classList }, { prototypes::id::Element }, { 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_part(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "part", 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)->Part())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_part(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.part setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "part", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); JS::Rooted v(cx); if (!JS_GetProperty(cx, obj, "part", &v)) { return false; } if (!v.isObject()) { return cx.ThrowErrorMessage("Element.part"); } JS::Rooted targetObj(cx, &v.toObject()); return JS_SetProperty(cx, targetObj, "value", args[0]); } static const JSJitInfo part_getterinfo = { { get_part }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 part_setterinfo = { { (JSJitGetterOp)set_part }, { prototypes::id::Element }, { 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_attributes(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "attributes", 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)->Attributes())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo attributes_getterinfo = { { get_attributes }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 getAttributeNames(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAttributeNames", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsTArray result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAttributeNames(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAttributeNames(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!xpc::NonVoidStringToJsval(cx, result[sequenceIdx0], &tmp)) { return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getAttributeNames_methodinfo = { { (JSJitGetterOp)getAttributeNames }, { prototypes::id::Element }, { 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 getAttribute(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAttribute", 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, "Element.getAttribute", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAttribute(NonNullHelper(Constify(arg0)), result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAttribute(NonNullHelper(Constify(arg0)), result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo::ArgType getAttribute_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo getAttribute_methodinfo = { { { (JSJitGetterOp)getAttribute }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, getAttribute_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool getAttributeNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAttributeNS", 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, "Element.getAttributeNS", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo::ArgType getAttributeNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo getAttributeNS_methodinfo = { { { (JSJitGetterOp)getAttributeNS }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, getAttributeNS_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool toggleAttribute(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "toggleAttribute", 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, "Element.toggleAttribute", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } Optional arg1; if (args.hasDefined(1)) { arg1.Construct(); if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1.Value())) { return false; } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } bool result(MOZ_KnownLive(self)->ToggleAttribute(NonNullHelper(Constify(arg0)), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv)); if (rv.MaybeSetPendingException(cx, "Element.toggleAttribute")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo toggleAttribute_methodinfo = { { (JSJitGetterOp)toggleAttribute }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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 setAttribute(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setAttribute"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttribute", 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, "Element.setAttribute", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString arg1; if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAttribute(NonNullHelper(Constify(arg0)), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAttribute(NonNullHelper(Constify(arg0)), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.setAttribute")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setAttribute_methodinfo = { { (JSJitGetterOp)setAttribute }, { prototypes::id::Element }, { 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 setAttributeNS(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setAttributeNS"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttributeNS", 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, "Element.setAttributeNS", 3)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } TrustedHTMLOrTrustedScriptOrTrustedScriptURLOrString arg2; if (!arg2.Init(cx, args[2], "Argument 3", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), Constify(arg2), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), Constify(arg2), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.setAttributeNS")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setAttributeNS_methodinfo = { { (JSJitGetterOp)setAttributeNS }, { prototypes::id::Element }, { 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 removeAttribute(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "removeAttribute", 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, "Element.removeAttribute", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vRemoveAttribute(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->RemoveAttribute(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.removeAttribute")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo removeAttribute_methodinfo = { { (JSJitGetterOp)removeAttribute }, { prototypes::id::Element }, { 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 removeAttributeNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "removeAttributeNS", 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, "Element.removeAttributeNS", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vRemoveAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->RemoveAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv); if (rv.MaybeSetPendingException(cx, "Element.removeAttributeNS")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo removeAttributeNS_methodinfo = { { (JSJitGetterOp)removeAttributeNS }, { prototypes::id::Element }, { 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 hasAttribute(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasAttribute", 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, "Element.hasAttribute", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } bool result(MOZ_KnownLive(self)->HasAttribute(NonNullHelper(Constify(arg0)))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType hasAttribute_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo hasAttribute_methodinfo = { { { (JSJitGetterOp)hasAttribute }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, hasAttribute_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool hasAttributeNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasAttributeNS", 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, "Element.hasAttributeNS", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } bool result(MOZ_KnownLive(self)->HasAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType hasAttributeNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo hasAttributeNS_methodinfo = { { { (JSJitGetterOp)hasAttributeNS }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, hasAttributeNS_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool hasAttributes(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasAttributes", 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 result(MOZ_KnownLive(self)->HasAttributes()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType hasAttributes_methodinfo_argTypes[] = { JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo hasAttributes_methodinfo = { { { (JSJitGetterOp)hasAttributes }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, hasAttributes_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool closest(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "closest", 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, "Element.closest", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Closest(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "Element.closest")) [[unlikely]] { return false; } 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::ArgType closest_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo closest_methodinfo = { { { (JSJitGetterOp)closest }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, closest_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool matches(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "matches", 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, "Element.matches", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; bool result(MOZ_KnownLive(self)->Matches(Constify(arg0), rv)); if (rv.MaybeSetPendingException(cx, "Element.matches")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType matches_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo matches_methodinfo = { { { (JSJitGetterOp)matches }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, matches_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool webkitMatchesSelector(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "webkitMatchesSelector", 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, "Element.webkitMatchesSelector", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; bool result(MOZ_KnownLive(self)->Matches(Constify(arg0), rv)); if (rv.MaybeSetPendingException(cx, "Element.webkitMatchesSelector")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType webkitMatchesSelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo webkitMatchesSelector_methodinfo = { { { (JSJitGetterOp)webkitMatchesSelector }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, webkitMatchesSelector_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool getElementsByTagName(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsByTagName", 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, "Element.getElementsByTagName", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetElementsByTagName(NonNullHelper(Constify(arg0))))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo::ArgType getElementsByTagName_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo getElementsByTagName_methodinfo = { { { (JSJitGetterOp)getElementsByTagName }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, getElementsByTagName_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool getElementsByTagNameNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsByTagNameNS", 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, "Element.getElementsByTagNameNS", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetElementsByTagNameNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv))); if (rv.MaybeSetPendingException(cx, "Element.getElementsByTagNameNS")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo::ArgType getElementsByTagNameNS_methodinfo_argTypes[] = { JSJitInfo::ArgType(JSJitInfo::Null | JSJitInfo::String), JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo getElementsByTagNameNS_methodinfo = { { { (JSJitGetterOp)getElementsByTagNameNS }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, getElementsByTagNameNS_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool getElementsByClassName(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsByClassName", 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, "Element.getElementsByClassName", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetElementsByClassName(NonNullHelper(Constify(arg0))))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo::ArgType getElementsByClassName_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo getElementsByClassName_methodinfo = { { { (JSJitGetterOp)getElementsByClassName }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, getElementsByClassName_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool insertAdjacentElement(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.insertAdjacentElement"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "insertAdjacentElement", 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, "Element.insertAdjacentElement", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } NonNull arg1; if (args[1].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[1], arg1, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 2", "Element"); return false; } } } else { cx.ThrowErrorMessage("Argument 2"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->InsertAdjacentElement(NonNullHelper(Constify(arg0)), MOZ_KnownLive(NonNullHelper(arg1)), rv))); if (rv.MaybeSetPendingException(cx, "Element.insertAdjacentElement")) [[unlikely]] { return false; } 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 insertAdjacentElement_methodinfo = { { (JSJitGetterOp)insertAdjacentElement }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 insertAdjacentText(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "insertAdjacentText", 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, "Element.insertAdjacentText", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vInsertAdjacentText(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->InsertAdjacentText(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv); if (rv.MaybeSetPendingException(cx, "Element.insertAdjacentText")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo insertAdjacentText_methodinfo = { { (JSJitGetterOp)insertAdjacentText }, { prototypes::id::Element }, { 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_fontSizeInflation(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "fontSizeInflation", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); float result(MOZ_KnownLive(self)->FontSizeInflation()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo fontSizeInflation_getterinfo = { { get_fontSizeInflation }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_implementedPseudoElement(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "implementedPseudoElement", 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_vGetImplementedPseudoElement(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetImplementedPseudoElement(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo implementedPseudoElement_getterinfo = { { get_implementedPseudoElement }, { prototypes::id::Element }, { 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 mozMatchesSelector(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "mozMatchesSelector", 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, "Element.mozMatchesSelector", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; bool result(MOZ_KnownLive(self)->Matches(Constify(arg0), rv)); if (rv.MaybeSetPendingException(cx, "Element.mozMatchesSelector")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo::ArgType mozMatchesSelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo mozMatchesSelector_methodinfo = { { { (JSJitGetterOp)mozMatchesSelector }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, mozMatchesSelector_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool setPointerCapture(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setPointerCapture", 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, "Element.setPointerCapture", 1)) { return false; } int32_t arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetPointerCapture(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetPointerCapture(arg0, rv); if (rv.MaybeSetPendingException(cx, "Element.setPointerCapture")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_setPointerCapture); args.rval().setUndefined(); return true; } static const JSJitInfo setPointerCapture_methodinfo = { { (JSJitGetterOp)setPointerCapture }, { prototypes::id::Element }, { 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 releasePointerCapture(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "releasePointerCapture", 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, "Element.releasePointerCapture", 1)) { return false; } int32_t arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vReleasePointerCapture(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ReleasePointerCapture(arg0, rv); if (rv.MaybeSetPendingException(cx, "Element.releasePointerCapture")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_releasePointerCapture); args.rval().setUndefined(); return true; } static const JSJitInfo releasePointerCapture_methodinfo = { { (JSJitGetterOp)releasePointerCapture }, { prototypes::id::Element }, { 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 hasPointerCapture(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasPointerCapture", 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, "Element.hasPointerCapture", 1)) { return false; } int32_t arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } bool result(MOZ_KnownLive(self)->HasPointerCapture(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo hasPointerCapture_methodinfo = { { (JSJitGetterOp)hasPointerCapture }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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 setCapture(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setCapture", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DeprecationWarning(cx, obj, DeprecatedOperations::eElementSetCapture); 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_vSetCapture(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetCapture(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setCapture_methodinfo = { { (JSJitGetterOp)setCapture }, { prototypes::id::Element }, { 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 releaseCapture(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "releaseCapture", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DeprecationWarning(cx, obj, DeprecatedOperations::eElementReleaseCapture); // NOTE: This assert does NOT call the function. static_assert(std::is_void_vReleaseCapture())>, "Should be returning void here"); MOZ_KnownLive(self)->ReleaseCapture(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo releaseCapture_methodinfo = { { (JSJitGetterOp)releaseCapture }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* 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 setCaptureAlways(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setCaptureAlways", 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_vSetCaptureAlways(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetCaptureAlways(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setCaptureAlways_methodinfo = { { (JSJitGetterOp)setCaptureAlways }, { prototypes::id::Element }, { 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 getAttributeNode(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAttributeNode", 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, "Element.getAttributeNode", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetAttributeNode(NonNullHelper(Constify(arg0))))); 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 getAttributeNode_methodinfo = { { (JSJitGetterOp)getAttributeNode }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 setAttributeNode(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setAttributeNode"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttributeNode", 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, "Element.setAttributeNode", 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", "Attr"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SetAttributeNode(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(subjectPrincipal), rv))); if (rv.MaybeSetPendingException(cx, "Element.setAttributeNode")) [[unlikely]] { return false; } 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 setAttributeNode_methodinfo = { { (JSJitGetterOp)setAttributeNode }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 removeAttributeNode(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.removeAttributeNode"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "removeAttributeNode", 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, "Element.removeAttributeNode", 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", "Attr"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RemoveAttributeNode(MOZ_KnownLive(NonNullHelper(arg0)), rv))); if (rv.MaybeSetPendingException(cx, "Element.removeAttributeNode")) [[unlikely]] { return false; } 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 removeAttributeNode_methodinfo = { { (JSJitGetterOp)removeAttributeNode }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 getAttributeNodeNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAttributeNodeNS", 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, "Element.getAttributeNodeNS", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetAttributeNodeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1))))); 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 getAttributeNodeNS_methodinfo = { { (JSJitGetterOp)getAttributeNodeNS }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 setAttributeNodeNS(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setAttributeNodeNS"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttributeNodeNS", 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, "Element.setAttributeNodeNS", 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", "Attr"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SetAttributeNodeNS(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(subjectPrincipal), rv))); if (rv.MaybeSetPendingException(cx, "Element.setAttributeNodeNS")) [[unlikely]] { return false; } 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 setAttributeNodeNS_methodinfo = { { (JSJitGetterOp)setAttributeNodeNS }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 getTransformToAncestor(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.getTransformToAncestor"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getTransformToAncestor", 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, "Element.getTransformToAncestor", 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; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetTransformToAncestor(MOZ_KnownLive(NonNullHelper(arg0))))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getTransformToAncestor_methodinfo = { { (JSJitGetterOp)getTransformToAncestor }, { prototypes::id::Element }, { 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 getTransformToParent(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getTransformToParent", 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)->GetTransformToParent())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getTransformToParent_methodinfo = { { (JSJitGetterOp)getTransformToParent }, { prototypes::id::Element }, { 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 getTransformToViewport(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getTransformToViewport", 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)->GetTransformToViewport())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getTransformToViewport_methodinfo = { { (JSJitGetterOp)getTransformToViewport }, { prototypes::id::Element }, { 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 getClientRects(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getClientRects", 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)->GetClientRects())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getClientRects_methodinfo = { { (JSJitGetterOp)getClientRects }, { prototypes::id::Element }, { 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 getBoundingClientRect(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getBoundingClientRect", 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)->GetBoundingClientRect())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getBoundingClientRect_methodinfo = { { (JSJitGetterOp)getBoundingClientRect }, { prototypes::id::Element }, { 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 checkVisibility(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.checkVisibility"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "checkVisibility", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastCheckVisibilityOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } bool result(MOZ_KnownLive(self)->CheckVisibility(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo checkVisibility_methodinfo = { { (JSJitGetterOp)checkVisibility }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* 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 scrollIntoView(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.scrollIntoView"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollIntoView", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); BooleanOrScrollIntoViewOptions arg0; if (!(args.hasDefined(0))) { if (!arg0.RawSetAsScrollIntoViewOptions().Init(cx, JS::NullHandleValue, "Member of (boolean or ScrollIntoViewOptions)")) { return false; } } else { if (!arg0.Init(cx, args[0], "Argument 1", false)) { return false; } } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollIntoView(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollIntoView(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo scrollIntoView_methodinfo = { { (JSJitGetterOp)scrollIntoView }, { prototypes::id::Element }, { 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_scrollTop(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollTop", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollTop()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_scrollTop(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollTop", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetScrollTop(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetScrollTop(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo scrollTop_getterinfo = { { get_scrollTop }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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 const JSJitInfo scrollTop_setterinfo = { { (JSJitGetterOp)set_scrollTop }, { prototypes::id::Element }, { 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_scrollLeft(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollLeft", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollLeft()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_scrollLeft(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollLeft", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetScrollLeft(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetScrollLeft(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo scrollLeft_getterinfo = { { get_scrollLeft }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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 const JSJitInfo scrollLeft_setterinfo = { { (JSJitGetterOp)set_scrollLeft }, { prototypes::id::Element }, { 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_scrollWidth(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollWidth", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ScrollWidth()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo scrollWidth_getterinfo = { { get_scrollWidth }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_scrollHeight(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollHeight", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ScrollHeight()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo scrollHeight_getterinfo = { { get_scrollHeight }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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 scroll(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.scroll"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scroll", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); unsigned argcount = std::min(args.length(), 2u); switch (argcount) { case 0: { [[fallthrough]]; } case 1: { binding_detail::FastScrollToOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollTo(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollTo(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } case 2: { double arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } double arg1; if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollTo(arg0, arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollTo(arg0, arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } default: { // Using nsPrintfCString here would require including that // header. Let's not worry about it. nsAutoCString argCountStr; argCountStr.AppendPrintf("%u", args.length()); return cx.ThrowErrorMessage(argCountStr.get()); } } MOZ_CRASH("We have an always-returning default case"); return false; } static const JSJitInfo scroll_methodinfo = { { (JSJitGetterOp)scroll }, { prototypes::id::Element }, { 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 scrollTo(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.scrollTo"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollTo", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); unsigned argcount = std::min(args.length(), 2u); switch (argcount) { case 0: { [[fallthrough]]; } case 1: { binding_detail::FastScrollToOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollTo(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollTo(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } case 2: { double arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } double arg1; if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollTo(arg0, arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollTo(arg0, arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } default: { // Using nsPrintfCString here would require including that // header. Let's not worry about it. nsAutoCString argCountStr; argCountStr.AppendPrintf("%u", args.length()); return cx.ThrowErrorMessage(argCountStr.get()); } } MOZ_CRASH("We have an always-returning default case"); return false; } static const JSJitInfo scrollTo_methodinfo = { { (JSJitGetterOp)scrollTo }, { prototypes::id::Element }, { 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 scrollBy(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.scrollBy"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollBy", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); unsigned argcount = std::min(args.length(), 2u); switch (argcount) { case 0: { [[fallthrough]]; } case 1: { binding_detail::FastScrollToOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollBy(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollBy(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } case 2: { double arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } double arg1; if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vScrollBy(arg0, arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->ScrollBy(arg0, arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; break; } default: { // Using nsPrintfCString here would require including that // header. Let's not worry about it. nsAutoCString argCountStr; argCountStr.AppendPrintf("%u", args.length()); return cx.ThrowErrorMessage(argCountStr.get()); } } MOZ_CRASH("We have an always-returning default case"); return false; } static const JSJitInfo scrollBy_methodinfo = { { (JSJitGetterOp)scrollBy }, { prototypes::id::Element }, { 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 mozScrollSnap(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "mozScrollSnap", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // NOTE: This assert does NOT call the function. static_assert(std::is_void_vMozScrollSnap())>, "Should be returning void here"); MOZ_KnownLive(self)->MozScrollSnap(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo mozScrollSnap_methodinfo = { { (JSJitGetterOp)mozScrollSnap }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* 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_clientTop(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientTop", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ClientTop()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo clientTop_getterinfo = { { get_clientTop }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_clientLeft(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientLeft", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ClientLeft()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo clientLeft_getterinfo = { { get_clientLeft }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_clientWidth(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientWidth", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ClientWidth()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo clientWidth_getterinfo = { { get_clientWidth }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_clientHeight(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientHeight", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ClientHeight()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo clientHeight_getterinfo = { { get_clientHeight }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_screenX(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "screenX", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ScreenX()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo screenX_getterinfo = { { get_screenX }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_screenY(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "screenY", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); int32_t result(MOZ_KnownLive(self)->ScreenY()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo screenY_getterinfo = { { get_screenY }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_INT32, /* 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_screen(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "screen", 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)->GetScreen())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!result) { args.rval().setNull(); return true; } if (!WrapObject(cx, result, &NS_GET_IID(nsIScreen), args.rval())) { return false; } return true; } static const JSJitInfo screen_getterinfo = { { get_screen }, { prototypes::id::Element }, { 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_scrollTopMin(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollTopMin", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollTopMin()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo scrollTopMin_getterinfo = { { get_scrollTopMin }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_scrollTopMax(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollTopMax", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollTopMax()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo scrollTopMax_getterinfo = { { get_scrollTopMax }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_scrollLeftMin(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollLeftMin", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollLeftMin()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo scrollLeftMin_getterinfo = { { get_scrollLeftMin }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_scrollLeftMax(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "scrollLeftMax", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ScrollLeftMax()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo scrollLeftMax_getterinfo = { { get_scrollLeftMax }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_currentCSSZoom(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "currentCSSZoom", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->CurrentCSSZoom()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo currentCSSZoom_getterinfo = { { get_currentCSSZoom }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_innerHTML(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "innerHTML", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; OwningTrustedHTMLOrNullIsEmptyString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetInnerHTML(result, OOMReporter::From(rv)))>, "Should be returning void here"); MOZ_KnownLive(self)->GetInnerHTML(result, OOMReporter::From(rv)); if (rv.MaybeSetPendingException(cx, "Element.innerHTML getter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!result.ToJSVal(cx, obj, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_innerHTML(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.innerHTML setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "innerHTML", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); TrustedHTMLOrNullIsEmptyString arg0; if (!arg0.Init(cx, args[0], "Value being assigned", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetInnerHTML(Constify(arg0), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetInnerHTML(Constify(arg0), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.innerHTML setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo innerHTML_getterinfo = { { get_innerHTML }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 innerHTML_setterinfo = { { (JSJitGetterOp)set_innerHTML }, { prototypes::id::Element }, { 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_outerHTML(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "outerHTML", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); OwningTrustedHTMLOrNullIsEmptyString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetOuterHTML(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetOuterHTML(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!result.ToJSVal(cx, obj, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_outerHTML(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.outerHTML setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "outerHTML", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); TrustedHTMLOrNullIsEmptyString arg0; if (!arg0.Init(cx, args[0], "Value being assigned", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetOuterHTML(Constify(arg0), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetOuterHTML(Constify(arg0), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.outerHTML setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo outerHTML_getterinfo = { { get_outerHTML }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 outerHTML_setterinfo = { { (JSJitGetterOp)set_outerHTML }, { prototypes::id::Element }, { 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 insertAdjacentHTML(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.insertAdjacentHTML"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "insertAdjacentHTML", 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, "Element.insertAdjacentHTML", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } TrustedHTMLOrString arg1; if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vInsertAdjacentHTML(NonNullHelper(Constify(arg0)), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->InsertAdjacentHTML(NonNullHelper(Constify(arg0)), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.insertAdjacentHTML")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo insertAdjacentHTML_methodinfo = { { (JSJitGetterOp)insertAdjacentHTML }, { prototypes::id::Element }, { 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 attachShadow(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.attachShadow"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "attachShadow", 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, "Element.attachShadow", 1)) { return false; } binding_detail::FastShadowRootInit arg0; if (!arg0.Init(cx, args[0], "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->AttachShadow(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "Element.attachShadow")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_attachShadow); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo attachShadow_methodinfo = { { (JSJitGetterOp)attachShadow }, { prototypes::id::Element }, { 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 get_shadowRoot(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "shadowRoot", 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)->GetShadowRootForBindings())); 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 shadowRoot_getterinfo = { { get_shadowRoot }, { prototypes::id::Element }, { 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_openOrClosedShadowRoot(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "openOrClosedShadowRoot", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); NonNull subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); subjectPrincipal = principal; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetOpenOrClosedShadowRoot(MOZ_KnownLive(NonNullHelper(subjectPrincipal))))); 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 openOrClosedShadowRoot_getterinfo = { { get_openOrClosedShadowRoot }, { prototypes::id::Element }, { 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_assignedSlot(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "assignedSlot", 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)->GetAssignedSlotByMode())); 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 assignedSlot_getterinfo = { { get_assignedSlot }, { prototypes::id::Element }, { 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_openOrClosedAssignedSlot(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "openOrClosedAssignedSlot", 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)->GetAssignedSlot())); 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 openOrClosedAssignedSlot_getterinfo = { { get_openOrClosedAssignedSlot }, { prototypes::id::Element }, { 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_slot(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "slot", 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_vGetSlot(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetSlot(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_slot(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "slot", 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; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetSlot(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetSlot(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.slot setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo slot_getterinfo = { { get_slot }, { prototypes::id::Element }, { 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 slot_setterinfo = { { (JSJitGetterOp)set_slot }, { prototypes::id::Element }, { 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_customElementRegistry(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "customElementRegistry", 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)->GetCustomElementRegistry())); 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 customElementRegistry_getterinfo = { { get_customElementRegistry }, { prototypes::id::Element }, { 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 requestFullscreen(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.requestFullscreen"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "requestFullscreen", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastFullscreenOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RequestFullscreen(Constify(arg0), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.requestFullscreen")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_requestFullscreen); static_assert(!std::is_pointer_v, "NewObject implies that we need to keep the object alive with a strong reference."); if (!ToJSValue(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool requestFullscreen_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = requestFullscreen(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo requestFullscreen_methodinfo = { { (JSJitGetterOp)requestFullscreen_promiseWrapper }, { prototypes::id::Element }, { 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 mozRequestFullScreen(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.mozRequestFullScreen"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "mozRequestFullScreen", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); DeprecationWarning(cx, obj, DeprecatedOperations::eMozRequestFullScreenDeprecatedPrefix); binding_detail::FastFullscreenOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RequestFullscreen(Constify(arg0), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.mozRequestFullScreen")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); static_assert(!std::is_pointer_v, "NewObject implies that we need to keep the object alive with a strong reference."); if (!ToJSValue(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool mozRequestFullScreen_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = mozRequestFullScreen(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo mozRequestFullScreen_methodinfo = { { (JSJitGetterOp)mozRequestFullScreen_promiseWrapper }, { prototypes::id::Element }, { 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 get_onfullscreenchange(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "onfullscreenchange", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); RefPtr result(MOZ_KnownLive(self)->GetOnfullscreenchange()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (result) { args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result)); if (!MaybeWrapObjectOrNullValue(cx, args.rval())) { return false; } return true; } else { args.rval().setNull(); return true; } } MOZ_CAN_RUN_SCRIPT static bool set_onfullscreenchange(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "onfullscreenchange", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); RootedCallback> arg0(cx); if (args[0].isObject()) { { // scope for tempRoot and tempGlobalRoot if needed arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx)); } } else { arg0 = nullptr; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetOnfullscreenchange(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetOnfullscreenchange(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo onfullscreenchange_getterinfo = { { get_onfullscreenchange }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo onfullscreenchange_setterinfo = { { (JSJitGetterOp)set_onfullscreenchange }, { prototypes::id::Element }, { 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_onfullscreenerror(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "onfullscreenerror", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); RefPtr result(MOZ_KnownLive(self)->GetOnfullscreenerror()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (result) { args.rval().setObjectOrNull(GetCallbackFromCallbackObject(cx, result)); if (!MaybeWrapObjectOrNullValue(cx, args.rval())) { return false; } return true; } else { args.rval().setNull(); return true; } } MOZ_CAN_RUN_SCRIPT static bool set_onfullscreenerror(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "onfullscreenerror", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); RootedCallback> arg0(cx); if (args[0].isObject()) { { // scope for tempRoot and tempGlobalRoot if needed arg0 = new binding_detail::FastEventHandlerNonNull(&args[0].toObject(), JS::CurrentGlobalOrNull(cx)); } } else { arg0 = nullptr; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetOnfullscreenerror(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetOnfullscreenerror(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo onfullscreenerror_getterinfo = { { get_onfullscreenerror }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo onfullscreenerror_setterinfo = { { (JSJitGetterOp)set_onfullscreenerror }, { prototypes::id::Element }, { 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 requestPointerLock(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.requestPointerLock"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "requestPointerLock", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastPointerLockOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RequestPointerLock(Constify(arg0), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.requestPointerLock")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_requestPointerLock); static_assert(!std::is_pointer_v, "NewObject implies that we need to keep the object alive with a strong reference."); if (!ToJSValue(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool requestPointerLock_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = requestPointerLock(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo requestPointerLock_methodinfo = { { (JSJitGetterOp)requestPointerLock_promiseWrapper }, { prototypes::id::Element }, { 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 getAsFlexContainer(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAsFlexContainer", 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)->GetAsFlexContainer())); 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 getAsFlexContainer_methodinfo = { { (JSJitGetterOp)getAsFlexContainer }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 getGridFragments(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getGridFragments", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsTArray> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetGridFragments(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetGridFragments(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getGridFragments_methodinfo = { { (JSJitGetterOp)getGridFragments }, { prototypes::id::Element }, { 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 hasGridFragments(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasGridFragments", 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 result(MOZ_KnownLive(self)->HasGridFragments()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo hasGridFragments_methodinfo = { { (JSJitGetterOp)hasGridFragments }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 getElementsWithGrid(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsWithGrid", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); nsTArray> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetElementsWithGrid(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetElementsWithGrid(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getElementsWithGrid_methodinfo = { { (JSJitGetterOp)getElementsWithGrid }, { prototypes::id::Element }, { 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 setAttributeDevtools(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttributeDevtools", 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, "Element.setAttributeDevtools", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAttributeDevtools(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAttributeDevtools(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), rv); if (rv.MaybeSetPendingException(cx, "Element.setAttributeDevtools")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setAttributeDevtools_methodinfo = { { (JSJitGetterOp)setAttributeDevtools }, { prototypes::id::Element }, { 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 setAttributeDevtoolsNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setAttributeDevtoolsNS", 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, "Element.setAttributeDevtoolsNS", 3)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } nsAutoString arg2; if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAttributeDevtoolsNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), NonNullHelper(Constify(arg2)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAttributeDevtoolsNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), NonNullHelper(Constify(arg2)), rv); if (rv.MaybeSetPendingException(cx, "Element.setAttributeDevtoolsNS")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setAttributeDevtoolsNS_methodinfo = { { (JSJitGetterOp)setAttributeDevtoolsNS }, { prototypes::id::Element }, { 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_hasVisibleScrollbars(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "hasVisibleScrollbars", 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)->HasVisibleScrollbars()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo hasVisibleScrollbars_getterinfo = { { get_hasVisibleScrollbars }, { prototypes::id::Element }, { 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_clientHeightDouble(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientHeightDouble", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ClientHeightDouble()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo clientHeightDouble_getterinfo = { { get_clientHeightDouble }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_clientWidthDouble(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "clientWidthDouble", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->ClientWidthDouble()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo clientWidthDouble_getterinfo = { { get_clientWidthDouble }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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_firstLineBoxBSize(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "firstLineBoxBSize", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double result(MOZ_KnownLive(self)->FirstLineBoxBSize()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo firstLineBoxBSize_getterinfo = { { get_firstLineBoxBSize }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* 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 setHTML(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setHTML"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setHTML", 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, "Element.setHTML", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } binding_detail::FastSetHTMLOptions arg1; if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetHTML(NonNullHelper(Constify(arg0)), Constify(arg1), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetHTML(NonNullHelper(Constify(arg0)), Constify(arg1), rv); if (rv.MaybeSetPendingException(cx, "Element.setHTML")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_setHTML); args.rval().setUndefined(); return true; } static const JSJitInfo setHTML_methodinfo = { { (JSJitGetterOp)setHTML }, { prototypes::id::Element }, { 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 setHTMLUnsafe(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.setHTMLUnsafe"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "setHTMLUnsafe", 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, "Element.setHTMLUnsafe", 1)) { return false; } TrustedHTMLOrString arg0; if (!arg0.Init(cx, args[0], "Argument 1", false)) { return false; } binding_detail::FastSetHTMLUnsafeOptions arg1; if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2", false)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; nsIPrincipal* subjectPrincipal; { JS::Realm* realm = js::GetContextRealm(cx); MOZ_ASSERT(realm); JSPrincipals* principals = JS::GetRealmPrincipals(realm); nsIPrincipal* principal = nsJSPrincipals::get(principals); if (principal->IsSystemPrincipal()) { principal = nullptr; } subjectPrincipal = principal; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetHTMLUnsafe(Constify(arg0), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetHTMLUnsafe(Constify(arg0), Constify(arg1), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "Element.setHTMLUnsafe")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); SetUseCounter(obj, eUseCounter_Element_setHTMLUnsafe); args.rval().setUndefined(); return true; } static const JSJitInfo setHTMLUnsafe_methodinfo = { { (JSJitGetterOp)setHTMLUnsafe }, { prototypes::id::Element }, { 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 getHTML(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.getHTML"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getHTML", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastGetHTMLOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } DOMString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetHTML(Constify(arg0), result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetHTML(Constify(arg0), result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo getHTML_methodinfo = { { (JSJitGetterOp)getHTML }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, 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 computedStyleMap(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "computedStyleMap", 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)->ComputedStyleMap())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo computedStyleMap_methodinfo = { { (JSJitGetterOp)computedStyleMap }, { prototypes::id::Element }, { 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 get_ariaActiveDescendantElement(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaActiveDescendantElement", 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)->GetAriaActiveDescendantElement())); 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; } MOZ_CAN_RUN_SCRIPT static bool set_ariaActiveDescendantElement(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaActiveDescendantElement setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaActiveDescendantElement", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); mozilla::dom::Element* 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("Value being assigned", "Element"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Value being assigned"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaActiveDescendantElement(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaActiveDescendantElement(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaActiveDescendantElement_getterinfo = { { get_ariaActiveDescendantElement }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaActiveDescendantElement_setterinfo = { { (JSJitGetterOp)set_ariaActiveDescendantElement }, { prototypes::id::Element }, { 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_role(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "role", 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_vGetRole(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetRole(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_role(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "role", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetRole(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetRole(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.role setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo role_getterinfo = { { get_role }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo role_setterinfo = { { (JSJitGetterOp)set_role }, { prototypes::id::Element }, { 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_ariaAtomic(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaAtomic", 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_vGetAriaAtomic(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaAtomic(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaAtomic(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaAtomic", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaAtomic(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaAtomic(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaAtomic setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaAtomic_getterinfo = { { get_ariaAtomic }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaAtomic_setterinfo = { { (JSJitGetterOp)set_ariaAtomic }, { prototypes::id::Element }, { 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_ariaAutoComplete(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaAutoComplete", 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_vGetAriaAutoComplete(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaAutoComplete(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaAutoComplete(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaAutoComplete", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaAutoComplete(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaAutoComplete(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaAutoComplete setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaAutoComplete_getterinfo = { { get_ariaAutoComplete }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaAutoComplete_setterinfo = { { (JSJitGetterOp)set_ariaAutoComplete }, { prototypes::id::Element }, { 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_ariaBrailleLabel(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBrailleLabel", 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_vGetAriaBrailleLabel(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaBrailleLabel(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaBrailleLabel(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBrailleLabel", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaBrailleLabel(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaBrailleLabel(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaBrailleLabel setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaBrailleLabel_getterinfo = { { get_ariaBrailleLabel }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaBrailleLabel_setterinfo = { { (JSJitGetterOp)set_ariaBrailleLabel }, { prototypes::id::Element }, { 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_ariaBrailleRoleDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBrailleRoleDescription", 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_vGetAriaBrailleRoleDescription(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaBrailleRoleDescription(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaBrailleRoleDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBrailleRoleDescription", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaBrailleRoleDescription(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaBrailleRoleDescription(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaBrailleRoleDescription setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaBrailleRoleDescription_getterinfo = { { get_ariaBrailleRoleDescription }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaBrailleRoleDescription_setterinfo = { { (JSJitGetterOp)set_ariaBrailleRoleDescription }, { prototypes::id::Element }, { 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_ariaBusy(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBusy", 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_vGetAriaBusy(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaBusy(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaBusy(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaBusy", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaBusy(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaBusy(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaBusy setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaBusy_getterinfo = { { get_ariaBusy }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaBusy_setterinfo = { { (JSJitGetterOp)set_ariaBusy }, { prototypes::id::Element }, { 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_ariaChecked(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaChecked", 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_vGetAriaChecked(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaChecked(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaChecked(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaChecked", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaChecked(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaChecked(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaChecked setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaChecked_getterinfo = { { get_ariaChecked }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaChecked_setterinfo = { { (JSJitGetterOp)set_ariaChecked }, { prototypes::id::Element }, { 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_ariaColCount(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColCount", 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_vGetAriaColCount(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaColCount(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaColCount(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColCount", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaColCount(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaColCount(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaColCount setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaColCount_getterinfo = { { get_ariaColCount }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaColCount_setterinfo = { { (JSJitGetterOp)set_ariaColCount }, { prototypes::id::Element }, { 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_ariaColIndex(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColIndex", 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_vGetAriaColIndex(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaColIndex(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaColIndex(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColIndex", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaColIndex(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaColIndex(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaColIndex setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaColIndex_getterinfo = { { get_ariaColIndex }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaColIndex_setterinfo = { { (JSJitGetterOp)set_ariaColIndex }, { prototypes::id::Element }, { 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_ariaColIndexText(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColIndexText", 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_vGetAriaColIndexText(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaColIndexText(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaColIndexText(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColIndexText", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaColIndexText(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaColIndexText(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaColIndexText setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaColIndexText_getterinfo = { { get_ariaColIndexText }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaColIndexText_setterinfo = { { (JSJitGetterOp)set_ariaColIndexText }, { prototypes::id::Element }, { 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_ariaColSpan(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColSpan", 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_vGetAriaColSpan(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaColSpan(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaColSpan(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaColSpan", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaColSpan(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaColSpan(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaColSpan setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaColSpan_getterinfo = { { get_ariaColSpan }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaColSpan_setterinfo = { { (JSJitGetterOp)set_ariaColSpan }, { prototypes::id::Element }, { 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_ariaControlsElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaControlsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[0]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaControlsElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaControlsElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaControlsElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[0] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaControlsElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaControlsElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaControlsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaControlsElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaControlsElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaControlsElements_getterinfo = { { get_ariaControlsElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaControlsElements_setterinfo = { { (JSJitGetterOp)set_ariaControlsElements }, { prototypes::id::Element }, { 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_ariaCurrent(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaCurrent", 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_vGetAriaCurrent(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaCurrent(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaCurrent(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaCurrent", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaCurrent(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaCurrent(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaCurrent setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaCurrent_getterinfo = { { get_ariaCurrent }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaCurrent_setterinfo = { { (JSJitGetterOp)set_ariaCurrent }, { prototypes::id::Element }, { 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_ariaDescribedByElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDescribedByElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[1]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaDescribedByElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaDescribedByElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaDescribedByElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[1] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaDescribedByElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaDescribedByElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDescribedByElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaDescribedByElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaDescribedByElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaDescribedByElements_getterinfo = { { get_ariaDescribedByElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaDescribedByElements_setterinfo = { { (JSJitGetterOp)set_ariaDescribedByElements }, { prototypes::id::Element }, { 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_ariaDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDescription", 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_vGetAriaDescription(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaDescription(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDescription", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaDescription(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaDescription(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaDescription setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaDescription_getterinfo = { { get_ariaDescription }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaDescription_setterinfo = { { (JSJitGetterOp)set_ariaDescription }, { prototypes::id::Element }, { 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_ariaDetailsElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDetailsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[2]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaDetailsElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaDetailsElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaDetailsElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[2] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaDetailsElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaDetailsElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDetailsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaDetailsElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaDetailsElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaDetailsElements_getterinfo = { { get_ariaDetailsElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaDetailsElements_setterinfo = { { (JSJitGetterOp)set_ariaDetailsElements }, { prototypes::id::Element }, { 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_ariaDisabled(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDisabled", 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_vGetAriaDisabled(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaDisabled(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaDisabled(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaDisabled", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaDisabled(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaDisabled(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaDisabled setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaDisabled_getterinfo = { { get_ariaDisabled }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaDisabled_setterinfo = { { (JSJitGetterOp)set_ariaDisabled }, { prototypes::id::Element }, { 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_ariaErrorMessageElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaErrorMessageElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[3]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaErrorMessageElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaErrorMessageElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaErrorMessageElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[3] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaErrorMessageElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaErrorMessageElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaErrorMessageElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaErrorMessageElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaErrorMessageElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaErrorMessageElements_getterinfo = { { get_ariaErrorMessageElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaErrorMessageElements_setterinfo = { { (JSJitGetterOp)set_ariaErrorMessageElements }, { prototypes::id::Element }, { 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_ariaExpanded(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaExpanded", 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_vGetAriaExpanded(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaExpanded(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaExpanded(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaExpanded", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaExpanded(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaExpanded(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaExpanded setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaExpanded_getterinfo = { { get_ariaExpanded }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaExpanded_setterinfo = { { (JSJitGetterOp)set_ariaExpanded }, { prototypes::id::Element }, { 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_ariaFlowToElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaFlowToElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[4]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaFlowToElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaFlowToElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaFlowToElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[4] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaFlowToElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaFlowToElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaFlowToElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaFlowToElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaFlowToElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaFlowToElements_getterinfo = { { get_ariaFlowToElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaFlowToElements_setterinfo = { { (JSJitGetterOp)set_ariaFlowToElements }, { prototypes::id::Element }, { 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_ariaHasPopup(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaHasPopup", 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_vGetAriaHasPopup(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaHasPopup(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaHasPopup(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaHasPopup", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaHasPopup(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaHasPopup(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaHasPopup setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaHasPopup_getterinfo = { { get_ariaHasPopup }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaHasPopup_setterinfo = { { (JSJitGetterOp)set_ariaHasPopup }, { prototypes::id::Element }, { 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_ariaHidden(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaHidden", 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_vGetAriaHidden(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaHidden(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaHidden(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaHidden", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaHidden(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaHidden(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaHidden setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaHidden_getterinfo = { { get_ariaHidden }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaHidden_setterinfo = { { (JSJitGetterOp)set_ariaHidden }, { prototypes::id::Element }, { 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_ariaInvalid(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaInvalid", 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_vGetAriaInvalid(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaInvalid(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaInvalid(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaInvalid", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaInvalid(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaInvalid(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaInvalid setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaInvalid_getterinfo = { { get_ariaInvalid }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaInvalid_setterinfo = { { (JSJitGetterOp)set_ariaInvalid }, { prototypes::id::Element }, { 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_ariaKeyShortcuts(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaKeyShortcuts", 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_vGetAriaKeyShortcuts(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaKeyShortcuts(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaKeyShortcuts(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaKeyShortcuts", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaKeyShortcuts(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaKeyShortcuts(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaKeyShortcuts setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaKeyShortcuts_getterinfo = { { get_ariaKeyShortcuts }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaKeyShortcuts_setterinfo = { { (JSJitGetterOp)set_ariaKeyShortcuts }, { prototypes::id::Element }, { 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_ariaLabel(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLabel", 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_vGetAriaLabel(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaLabel(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaLabel(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLabel", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaLabel(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaLabel(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaLabel setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaLabel_getterinfo = { { get_ariaLabel }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaLabel_setterinfo = { { (JSJitGetterOp)set_ariaLabel }, { prototypes::id::Element }, { 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_ariaLabelledByElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLabelledByElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[5]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaLabelledByElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaLabelledByElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaLabelledByElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[5] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaLabelledByElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaLabelledByElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLabelledByElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaLabelledByElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaLabelledByElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaLabelledByElements_getterinfo = { { get_ariaLabelledByElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaLabelledByElements_setterinfo = { { (JSJitGetterOp)set_ariaLabelledByElements }, { prototypes::id::Element }, { 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_ariaLevel(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLevel", 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_vGetAriaLevel(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaLevel(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaLevel(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLevel", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaLevel(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaLevel(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaLevel setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaLevel_getterinfo = { { get_ariaLevel }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaLevel_setterinfo = { { (JSJitGetterOp)set_ariaLevel }, { prototypes::id::Element }, { 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_ariaLive(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLive", 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_vGetAriaLive(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaLive(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaLive(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaLive", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaLive(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaLive(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaLive setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaLive_getterinfo = { { get_ariaLive }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaLive_setterinfo = { { (JSJitGetterOp)set_ariaLive }, { prototypes::id::Element }, { 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_ariaModal(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaModal", 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_vGetAriaModal(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaModal(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaModal(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaModal", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaModal(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaModal(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaModal setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaModal_getterinfo = { { get_ariaModal }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaModal_setterinfo = { { (JSJitGetterOp)set_ariaModal }, { prototypes::id::Element }, { 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_ariaMultiLine(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaMultiLine", 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_vGetAriaMultiLine(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaMultiLine(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaMultiLine(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaMultiLine", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaMultiLine(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaMultiLine(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaMultiLine setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaMultiLine_getterinfo = { { get_ariaMultiLine }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaMultiLine_setterinfo = { { (JSJitGetterOp)set_ariaMultiLine }, { prototypes::id::Element }, { 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_ariaMultiSelectable(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaMultiSelectable", 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_vGetAriaMultiSelectable(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaMultiSelectable(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaMultiSelectable(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaMultiSelectable", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaMultiSelectable(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaMultiSelectable(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaMultiSelectable setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaMultiSelectable_getterinfo = { { get_ariaMultiSelectable }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaMultiSelectable_setterinfo = { { (JSJitGetterOp)set_ariaMultiSelectable }, { prototypes::id::Element }, { 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_ariaOrientation(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaOrientation", 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_vGetAriaOrientation(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaOrientation(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaOrientation(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaOrientation", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaOrientation(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaOrientation(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaOrientation setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaOrientation_getterinfo = { { get_ariaOrientation }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaOrientation_setterinfo = { { (JSJitGetterOp)set_ariaOrientation }, { prototypes::id::Element }, { 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_ariaOwnsElements(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaOwnsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); // Have to either root across the getter call or reget after. bool isXray; JS::Rooted slotStorage(cx, GetCachedSlotStorageObject(cx, obj, &isXray)); if (!slotStorage) { return false; } auto& array = ReflectedHTMLAttributeSlots::GetOrCreate(slotStorage, isXray); JS::Rooted cachedVal(cx, array[6]); bool hasCachedValue = !cachedVal.isUndefined(); bool useCachedValue = false; Nullable>> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAriaOwnsElements(hasCachedValue ? &useCachedValue : nullptr, result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaOwnsElements(hasCachedValue ? &useCachedValue : nullptr, result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); MOZ_ASSERT_IF(useCachedValue, hasCachedValue); if (hasCachedValue && useCachedValue) { args.rval().set(cachedVal); // The cached value is in the compartment of slotStorage, // so wrap into the caller compartment as needed. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } ClearCachedAriaOwnsElementsValue(self); { JS::Rooted conversionScope(cx, isXray ? JS::CurrentGlobalOrNull(cx) : slotStorage); JSAutoRealm ar(cx, conversionScope); do { // block we break out of when done wrapping if (result.IsNull()) { args.rval().setNull(); break; } uint32_t length = result.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result.Value()[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); break; } while (false); if (args.rval().isObject()) { JS::Rooted rvalObj(cx, &args.rval().toObject()); if (!JS_FreezeObject(cx, rvalObj)) { return false; } } } { // And now store things in the realm of our slotStorage. JSAutoRealm ar(cx, slotStorage); // Make a copy so that we don't do unnecessary wrapping on args.rval(). JS::Rooted storedVal(cx, args.rval()); if (!MaybeWrapNonDOMObjectOrNullValue(cx, &storedVal)) { return false; } array[6] = storedVal; if (!isXray) { // In the Xray case we don't need to do this, because getting the // expando object already preserved our wrapper. PreserveWrapper(self); } } // And now make sure args.rval() is in the caller realm. return MaybeWrapNonDOMObjectOrNullValue(cx, args.rval()); } MOZ_CAN_RUN_SCRIPT static bool set_ariaOwnsElements(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "Element.ariaOwnsElements setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaOwnsElements", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Nullable>> arg0; if (args[0].isObject()) { JS::ForOfIterator iter(cx); if (!iter.init(args[0], JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } Sequence> &arr = arg0.SetValue(); if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } OwningNonNull* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } OwningNonNull& slot = *slotPtr; if (temp.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, slot, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Element of value being assigned", "Element"); return false; } } } else { cx.ThrowErrorMessage("Element of value being assigned"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0.SetNull(); } else { cx.ThrowErrorMessage("Value being assigned", "sequence"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaOwnsElements(Constify(arg0)))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaOwnsElements(Constify(arg0)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaOwnsElements_getterinfo = { { get_ariaOwnsElements }, { prototypes::id::Element }, { 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. */ (DOM_INSTANCE_RESERVED_SLOTS + 0) /* Reserved slot index, if we're stored in a slot, else 0. */ }; static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) <= JSJitInfo::maxSlotIndex, "We won't fit"); static_assert((DOM_INSTANCE_RESERVED_SLOTS + 0) < 2, "There is no slot for us"); static const JSJitInfo ariaOwnsElements_setterinfo = { { (JSJitGetterOp)set_ariaOwnsElements }, { prototypes::id::Element }, { 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_ariaPlaceholder(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPlaceholder", 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_vGetAriaPlaceholder(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaPlaceholder(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaPlaceholder(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPlaceholder", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaPlaceholder(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaPlaceholder(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaPlaceholder setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaPlaceholder_getterinfo = { { get_ariaPlaceholder }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaPlaceholder_setterinfo = { { (JSJitGetterOp)set_ariaPlaceholder }, { prototypes::id::Element }, { 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_ariaPosInSet(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPosInSet", 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_vGetAriaPosInSet(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaPosInSet(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaPosInSet(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPosInSet", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaPosInSet(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaPosInSet(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaPosInSet setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaPosInSet_getterinfo = { { get_ariaPosInSet }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaPosInSet_setterinfo = { { (JSJitGetterOp)set_ariaPosInSet }, { prototypes::id::Element }, { 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_ariaPressed(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPressed", 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_vGetAriaPressed(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaPressed(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaPressed(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaPressed", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaPressed(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaPressed(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaPressed setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaPressed_getterinfo = { { get_ariaPressed }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaPressed_setterinfo = { { (JSJitGetterOp)set_ariaPressed }, { prototypes::id::Element }, { 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_ariaReadOnly(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaReadOnly", 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_vGetAriaReadOnly(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaReadOnly(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaReadOnly(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaReadOnly", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaReadOnly(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaReadOnly(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaReadOnly setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaReadOnly_getterinfo = { { get_ariaReadOnly }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaReadOnly_setterinfo = { { (JSJitGetterOp)set_ariaReadOnly }, { prototypes::id::Element }, { 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_ariaRelevant(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRelevant", 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_vGetAriaRelevant(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRelevant(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRelevant(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRelevant", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRelevant(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRelevant(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRelevant setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRelevant_getterinfo = { { get_ariaRelevant }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRelevant_setterinfo = { { (JSJitGetterOp)set_ariaRelevant }, { prototypes::id::Element }, { 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_ariaRequired(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRequired", 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_vGetAriaRequired(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRequired(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRequired(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRequired", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRequired(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRequired(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRequired setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRequired_getterinfo = { { get_ariaRequired }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRequired_setterinfo = { { (JSJitGetterOp)set_ariaRequired }, { prototypes::id::Element }, { 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_ariaRoleDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRoleDescription", 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_vGetAriaRoleDescription(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRoleDescription(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRoleDescription(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRoleDescription", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRoleDescription(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRoleDescription(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRoleDescription setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRoleDescription_getterinfo = { { get_ariaRoleDescription }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRoleDescription_setterinfo = { { (JSJitGetterOp)set_ariaRoleDescription }, { prototypes::id::Element }, { 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_ariaRowCount(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowCount", 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_vGetAriaRowCount(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRowCount(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRowCount(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowCount", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRowCount(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRowCount(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRowCount setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRowCount_getterinfo = { { get_ariaRowCount }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRowCount_setterinfo = { { (JSJitGetterOp)set_ariaRowCount }, { prototypes::id::Element }, { 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_ariaRowIndex(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowIndex", 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_vGetAriaRowIndex(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRowIndex(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRowIndex(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowIndex", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRowIndex(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRowIndex(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRowIndex setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRowIndex_getterinfo = { { get_ariaRowIndex }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRowIndex_setterinfo = { { (JSJitGetterOp)set_ariaRowIndex }, { prototypes::id::Element }, { 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_ariaRowIndexText(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowIndexText", 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_vGetAriaRowIndexText(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRowIndexText(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRowIndexText(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowIndexText", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRowIndexText(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRowIndexText(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRowIndexText setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRowIndexText_getterinfo = { { get_ariaRowIndexText }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRowIndexText_setterinfo = { { (JSJitGetterOp)set_ariaRowIndexText }, { prototypes::id::Element }, { 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_ariaRowSpan(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowSpan", 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_vGetAriaRowSpan(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaRowSpan(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaRowSpan(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaRowSpan", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaRowSpan(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaRowSpan(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaRowSpan setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaRowSpan_getterinfo = { { get_ariaRowSpan }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaRowSpan_setterinfo = { { (JSJitGetterOp)set_ariaRowSpan }, { prototypes::id::Element }, { 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_ariaSelected(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSelected", 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_vGetAriaSelected(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaSelected(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaSelected(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSelected", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaSelected(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaSelected(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaSelected setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaSelected_getterinfo = { { get_ariaSelected }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaSelected_setterinfo = { { (JSJitGetterOp)set_ariaSelected }, { prototypes::id::Element }, { 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_ariaSetSize(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSetSize", 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_vGetAriaSetSize(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaSetSize(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaSetSize(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSetSize", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaSetSize(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaSetSize(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaSetSize setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaSetSize_getterinfo = { { get_ariaSetSize }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaSetSize_setterinfo = { { (JSJitGetterOp)set_ariaSetSize }, { prototypes::id::Element }, { 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_ariaSort(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSort", 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_vGetAriaSort(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaSort(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaSort(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaSort", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaSort(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaSort(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaSort setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaSort_getterinfo = { { get_ariaSort }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaSort_setterinfo = { { (JSJitGetterOp)set_ariaSort }, { prototypes::id::Element }, { 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_ariaValueMax(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueMax", 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_vGetAriaValueMax(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaValueMax(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaValueMax(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueMax", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaValueMax(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaValueMax(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaValueMax setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaValueMax_getterinfo = { { get_ariaValueMax }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaValueMax_setterinfo = { { (JSJitGetterOp)set_ariaValueMax }, { prototypes::id::Element }, { 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_ariaValueMin(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueMin", 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_vGetAriaValueMin(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaValueMin(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaValueMin(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueMin", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaValueMin(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaValueMin(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaValueMin setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaValueMin_getterinfo = { { get_ariaValueMin }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaValueMin_setterinfo = { { (JSJitGetterOp)set_ariaValueMin }, { prototypes::id::Element }, { 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_ariaValueNow(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueNow", 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_vGetAriaValueNow(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaValueNow(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaValueNow(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueNow", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaValueNow(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaValueNow(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaValueNow setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaValueNow_getterinfo = { { get_ariaValueNow }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaValueNow_setterinfo = { { (JSJitGetterOp)set_ariaValueNow }, { prototypes::id::Element }, { 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_ariaValueText(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueText", 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_vGetAriaValueText(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAriaValueText(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_ariaValueText(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaValueText", 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], eNull, eNull, arg0)) { return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetAriaValueText(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAriaValueText(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "Element.ariaValueText setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo ariaValueText_getterinfo = { { get_ariaValueText }, { prototypes::id::Element }, { 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. */ }; static const JSJitInfo ariaValueText_setterinfo = { { (JSJitGetterOp)set_ariaValueText }, { prototypes::id::Element }, { 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 ariaNotify(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.ariaNotify"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "ariaNotify", 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, "Element.ariaNotify", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } binding_detail::FastAriaNotificationOptions arg1; if (!arg1.Init(cx, (args.hasDefined(1)) ? args[1] : JS::NullHandleValue, "Argument 2", false)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vAriaNotify(NonNullHelper(Constify(arg0)), Constify(arg1)))>, "Should be returning void here"); MOZ_KnownLive(self)->AriaNotify(NonNullHelper(Constify(arg0)), Constify(arg1)); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo ariaNotify_methodinfo = { { (JSJitGetterOp)ariaNotify }, { prototypes::id::Element }, { 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 animate(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.animate"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "animate", 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, "Element.animate", 1)) { return false; } JS::Rooted arg0(cx); if (args[0].isObject()) { arg0 = &args[0].toObject(); } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Argument 1"); return false; } UnrestrictedDoubleOrKeyframeAnimationOptions arg1; if (!(args.hasDefined(1))) { if (!arg1.RawSetAsKeyframeAnimationOptions().Init(cx, JS::NullHandleValue, "Member of (unrestricted double or KeyframeAnimationOptions)")) { return false; } } else { if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Animate(cx, arg0, Constify(arg1), rv))); if (rv.MaybeSetPendingException(cx, "Element.animate")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo animate_methodinfo = { { (JSJitGetterOp)animate }, { prototypes::id::Element }, { 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 getAnimations(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.getAnimations"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getAnimations", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastGetAnimationsOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; nsTArray> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetAnimations(Constify(arg0), result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->GetAnimations(Constify(arg0), result, rv); if (rv.MaybeSetPendingException(cx, "Element.getAnimations")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getAnimations_methodinfo = { { (JSJitGetterOp)getAnimations }, { prototypes::id::Element }, { 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 before(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.before"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "before", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vBefore(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->Before(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.before")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo before_methodinfo = { { (JSJitGetterOp)before }, { prototypes::id::Element }, { 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 after(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.after"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "after", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vAfter(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->After(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.after")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo after_methodinfo = { { (JSJitGetterOp)after }, { prototypes::id::Element }, { 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 replaceWith(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.replaceWith"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "replaceWith", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vReplaceWith(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ReplaceWith(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.replaceWith")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo replaceWith_methodinfo = { { (JSJitGetterOp)replaceWith }, { prototypes::id::Element }, { 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 remove(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "remove", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vRemove())>, "Should be returning void here"); MOZ_KnownLive(self)->Remove(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo remove_methodinfo = { { (JSJitGetterOp)remove }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNDEFINED, /* 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 getBoxQuads(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.getBoxQuads"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getBoxQuads", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastBoxQuadOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; nsTArray> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetBoxQuads(Constify(arg0), result, nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->GetBoxQuads(Constify(arg0), result, nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv); if (rv.MaybeSetPendingException(cx, "Element.getBoxQuads")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getBoxQuads_methodinfo = { { (JSJitGetterOp)getBoxQuads }, { prototypes::id::Element }, { 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 getBoxQuadsFromWindowOrigin(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.getBoxQuadsFromWindowOrigin"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getBoxQuadsFromWindowOrigin", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastBoxQuadOptions arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; nsTArray> result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vGetBoxQuadsFromWindowOrigin(Constify(arg0), result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->GetBoxQuadsFromWindowOrigin(Constify(arg0), result, rv); if (rv.MaybeSetPendingException(cx, "Element.getBoxQuadsFromWindowOrigin")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); uint32_t length = result.Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { if (!GetOrCreateDOMReflector(cx, result[sequenceIdx0], &tmp)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } args.rval().setObject(*returnArray); return true; } static const JSJitInfo getBoxQuadsFromWindowOrigin_methodinfo = { { (JSJitGetterOp)getBoxQuadsFromWindowOrigin }, { prototypes::id::Element }, { 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 convertQuadFromNode(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.convertQuadFromNode"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "convertQuadFromNode", 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, "Element.convertQuadFromNode", 2)) { 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", "DOMQuad"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } TextOrElementOrDocument arg1; if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } binding_detail::FastConvertCoordinateOptions arg2; if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue, "Argument 3", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->ConvertQuadFromNode(MOZ_KnownLive(NonNullHelper(arg0)), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.convertQuadFromNode")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo convertQuadFromNode_methodinfo = { { (JSJitGetterOp)convertQuadFromNode }, { prototypes::id::Element }, { 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 convertRectFromNode(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.convertRectFromNode"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "convertRectFromNode", 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, "Element.convertRectFromNode", 2)) { 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; } TextOrElementOrDocument arg1; if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } binding_detail::FastConvertCoordinateOptions arg2; if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue, "Argument 3", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->ConvertRectFromNode(MOZ_KnownLive(NonNullHelper(arg0)), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.convertRectFromNode")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo convertRectFromNode_methodinfo = { { (JSJitGetterOp)convertRectFromNode }, { prototypes::id::Element }, { 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 convertPointFromNode(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.convertPointFromNode"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "convertPointFromNode", 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, "Element.convertPointFromNode", 2)) { return false; } binding_detail::FastDOMPointInit arg0; if (!arg0.Init(cx, args[0], "Argument 1", false)) { return false; } TextOrElementOrDocument arg1; if (!arg1.Init(cx, args[1], "Argument 2", false)) { return false; } binding_detail::FastConvertCoordinateOptions arg2; if (!arg2.Init(cx, (args.hasDefined(2)) ? args[2] : JS::NullHandleValue, "Argument 3", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->ConvertPointFromNode(Constify(arg0), Constify(arg1), Constify(arg2), nsContentUtils::IsSystemCaller(cx) ? CallerType::System : CallerType::NonSystem, rv))); if (rv.MaybeSetPendingException(cx, "Element.convertPointFromNode")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo convertPointFromNode_methodinfo = { { (JSJitGetterOp)convertPointFromNode }, { prototypes::id::Element }, { 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 get_previousElementSibling(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "previousElementSibling", 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)->GetPreviousElementSibling())); 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 previousElementSibling_getterinfo = { { get_previousElementSibling }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_nextElementSibling(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "nextElementSibling", 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)->GetNextElementSibling())); 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 nextElementSibling_getterinfo = { { get_nextElementSibling }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_children(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "children", 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)->Children())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo children_getterinfo = { { get_children }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasNone, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_OBJECT, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_firstElementChild(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "firstElementChild", 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)->GetFirstElementChild())); 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 firstElementChild_getterinfo = { { get_firstElementChild }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_lastElementChild(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "lastElementChild", 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)->GetLastElementChild())); 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 lastElementChild_getterinfo = { { get_lastElementChild }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_UNKNOWN, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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_childElementCount(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "childElementCount", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); uint32_t result(MOZ_KnownLive(self)->ChildElementCount()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setNumber(result); return true; } static const JSJitInfo childElementCount_getterinfo = { { get_childElementCount }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasDOMSets, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_DOUBLE, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ true, /* isMovable. Not relevant for setters. */ true, /* 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 getElementsByAttribute(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsByAttribute", 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, "Element.getElementsByAttribute", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eEmpty, eStringify, arg1)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetElementsByAttribute(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1))))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getElementsByAttribute_methodinfo = { { (JSJitGetterOp)getElementsByAttribute }, { prototypes::id::Element }, { 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 getElementsByAttributeNS(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "getElementsByAttributeNS", 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, "Element.getElementsByAttributeNS", 3)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eNull, eNull, arg0)) { return false; } nsAutoString arg1; if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } nsAutoString arg2; if (!ConvertJSValueToString(cx, args[2], eEmpty, eStringify, arg2)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->GetElementsByAttributeNS(NonNullHelper(Constify(arg0)), NonNullHelper(Constify(arg1)), NonNullHelper(Constify(arg2)), rv))); if (rv.MaybeSetPendingException(cx, "Element.getElementsByAttributeNS")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo getElementsByAttributeNS_methodinfo = { { (JSJitGetterOp)getElementsByAttributeNS }, { prototypes::id::Element }, { 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 prepend(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.prepend"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "prepend", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vPrepend(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->Prepend(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.prepend")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo prepend_methodinfo = { { (JSJitGetterOp)prepend }, { prototypes::id::Element }, { 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 append(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.append"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "append", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vAppend(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->Append(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.append")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo append_methodinfo = { { (JSJitGetterOp)append }, { prototypes::id::Element }, { 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 replaceChildren(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.replaceChildren"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "replaceChildren", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); AutoSequence arg0; if (args.length() > 0) { if (!arg0.SetCapacity(args.length() - 0, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } for (uint32_t variadicArg = 0; variadicArg < args.length(); ++variadicArg) { // OK to do infallible append here, since we ensured capacity already. OwningNodeOrString& slot = *arg0.AppendElement(); if (!slot.Init(cx, args[variadicArg], "Argument 1", false)) { return false; } } } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vReplaceChildren(Constify(arg0), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ReplaceChildren(Constify(arg0), rv); if (rv.MaybeSetPendingException(cx, "Element.replaceChildren")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo replaceChildren_methodinfo = { { (JSJitGetterOp)replaceChildren }, { prototypes::id::Element }, { 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 moveBefore(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "Element.moveBefore"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "moveBefore", 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, "Element.moveBefore", 2)) { 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", "Node"); return false; } } } else { cx.ThrowErrorMessage("Argument 1"); return false; } nsINode* arg1; if (args[1].isObject()) { { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(args[1], arg1, cx); if (NS_FAILED(rv)) { cx.ThrowErrorMessage("Argument 2", "Node"); return false; } } } else if (args[1].isNullOrUndefined()) { arg1 = nullptr; } else { cx.ThrowErrorMessage("Argument 2"); return false; } Maybe ceReaction; DocGroup* docGroup = self->GetDocGroup(); if (docGroup) { ceReaction.emplace(docGroup->CustomElementReactionsStack(), cx); } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vMoveBefore(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(Constify(arg1)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->MoveBefore(MOZ_KnownLive(NonNullHelper(arg0)), MOZ_KnownLive(Constify(arg1)), rv); if (rv.MaybeSetPendingException(cx, "Element.moveBefore")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo moveBefore_methodinfo = { { (JSJitGetterOp)moveBefore }, { prototypes::id::Element }, { 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 querySelector(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "querySelector", 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, "Element.querySelector", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->QuerySelector(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "Element.querySelector")) [[unlikely]] { return false; } 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::ArgType querySelector_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo querySelector_methodinfo = { { { (JSJitGetterOp)querySelector }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, querySelector_methodinfo_argTypes }; MOZ_CAN_RUN_SCRIPT static bool querySelectorAll(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "Element", "querySelectorAll", 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, "Element.querySelectorAll", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->QuerySelectorAll(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "Element.querySelectorAll")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo::ArgType querySelectorAll_methodinfo_argTypes[] = { JSJitInfo::String, JSJitInfo::ArgTypeListEnd }; static const JSTypedMethodJitInfo querySelectorAll_methodinfo = { { { (JSJitGetterOp)querySelectorAll }, { prototypes::id::Element }, { PrototypeTraits::Depth }, JSJitInfo::Method, JSJitInfo::AliasDOMSets, /* 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. */ true, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }, querySelectorAll_methodinfo_argTypes }; static void _finalize(JS::GCContext* gcx, JSObject* obj) { mozilla::dom::Element* 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("getAttributeNames", (GenericMethod), reinterpret_cast(&getAttributeNames_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getAttribute", (GenericMethod), reinterpret_cast(&getAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getAttributeNS", (GenericMethod), reinterpret_cast(&getAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("toggleAttribute", (GenericMethod), reinterpret_cast(&toggleAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttribute", (GenericMethod), reinterpret_cast(&setAttribute_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttributeNS", (GenericMethod), reinterpret_cast(&setAttributeNS_methodinfo), 3, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("removeAttribute", (GenericMethod), reinterpret_cast(&removeAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("removeAttributeNS", (GenericMethod), reinterpret_cast(&removeAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasAttribute", (GenericMethod), reinterpret_cast(&hasAttribute_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasAttributeNS", (GenericMethod), reinterpret_cast(&hasAttributeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasAttributes", (GenericMethod), reinterpret_cast(&hasAttributes_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("closest", (GenericMethod), reinterpret_cast(&closest_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("matches", (GenericMethod), reinterpret_cast(&matches_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("webkitMatchesSelector", (GenericMethod), reinterpret_cast(&webkitMatchesSelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getElementsByTagName", (GenericMethod), reinterpret_cast(&getElementsByTagName_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getElementsByTagNameNS", (GenericMethod), reinterpret_cast(&getElementsByTagNameNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getElementsByClassName", (GenericMethod), reinterpret_cast(&getElementsByClassName_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("insertAdjacentElement", (GenericMethod), reinterpret_cast(&insertAdjacentElement_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("insertAdjacentText", (GenericMethod), reinterpret_cast(&insertAdjacentText_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("mozMatchesSelector", (GenericMethod), reinterpret_cast(&mozMatchesSelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setPointerCapture", (GenericMethod), reinterpret_cast(&setPointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("releasePointerCapture", (GenericMethod), reinterpret_cast(&releasePointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasPointerCapture", (GenericMethod), reinterpret_cast(&hasPointerCapture_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setCapture", (GenericMethod), reinterpret_cast(&setCapture_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("releaseCapture", (GenericMethod), reinterpret_cast(&releaseCapture_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getAttributeNode", (GenericMethod), reinterpret_cast(&getAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttributeNode", (GenericMethod), reinterpret_cast(&setAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("removeAttributeNode", (GenericMethod), reinterpret_cast(&removeAttributeNode_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getAttributeNodeNS", (GenericMethod), reinterpret_cast(&getAttributeNodeNS_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttributeNodeNS", (GenericMethod), reinterpret_cast(&setAttributeNodeNS_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getTransformToAncestor", (GenericMethod), reinterpret_cast(&getTransformToAncestor_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getTransformToParent", (GenericMethod), reinterpret_cast(&getTransformToParent_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getTransformToViewport", (GenericMethod), reinterpret_cast(&getTransformToViewport_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getClientRects", (GenericMethod), reinterpret_cast(&getClientRects_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getBoundingClientRect", (GenericMethod), reinterpret_cast(&getBoundingClientRect_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("checkVisibility", (GenericMethod), reinterpret_cast(&checkVisibility_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scrollIntoView", (GenericMethod), reinterpret_cast(&scrollIntoView_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scroll", (GenericMethod), reinterpret_cast(&scroll_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scrollTo", (GenericMethod), reinterpret_cast(&scrollTo_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scrollBy", (GenericMethod), reinterpret_cast(&scrollBy_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("insertAdjacentHTML", (GenericMethod), reinterpret_cast(&insertAdjacentHTML_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("attachShadow", (GenericMethod), reinterpret_cast(&attachShadow_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("requestFullscreen", (GenericMethod), reinterpret_cast(&requestFullscreen_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("mozRequestFullScreen", (GenericMethod), reinterpret_cast(&mozRequestFullScreen_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("requestPointerLock", (GenericMethod), reinterpret_cast(&requestPointerLock_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setHTML", (GenericMethod), reinterpret_cast(&setHTML_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setHTMLUnsafe", (GenericMethod), reinterpret_cast(&setHTMLUnsafe_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getHTML", (GenericMethod), reinterpret_cast(&getHTML_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("computedStyleMap", (GenericMethod), reinterpret_cast(&computedStyleMap_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("ariaNotify", (GenericMethod), reinterpret_cast(&ariaNotify_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("animate", (GenericMethod), reinterpret_cast(&animate_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getAnimations", (GenericMethod), reinterpret_cast(&getAnimations_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("before", (GenericMethod), reinterpret_cast(&before_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("after", (GenericMethod), reinterpret_cast(&after_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("replaceWith", (GenericMethod), reinterpret_cast(&replaceWith_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("remove", (GenericMethod), reinterpret_cast(&remove_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getBoxQuads", (GenericMethod), reinterpret_cast(&getBoxQuads_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("convertQuadFromNode", (GenericMethod), reinterpret_cast(&convertQuadFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("convertRectFromNode", (GenericMethod), reinterpret_cast(&convertRectFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("convertPointFromNode", (GenericMethod), reinterpret_cast(&convertPointFromNode_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("prepend", (GenericMethod), reinterpret_cast(&prepend_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("append", (GenericMethod), reinterpret_cast(&append_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("replaceChildren", (GenericMethod), reinterpret_cast(&replaceChildren_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("moveBefore", (GenericMethod), reinterpret_cast(&moveBefore_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("querySelector", (GenericMethod), reinterpret_cast(&querySelector_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("querySelectorAll", (GenericMethod), reinterpret_cast(&querySelectorAll_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sMethods_disablers24 = { WebIDLPrefIndex::dom_mouse_capture_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers33 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &nsContentUtils::IsCallerChromeOrElementTransformGettersEnabled }; static const PrefableDisablers sMethods_disablers49 = { WebIDLPrefIndex::dom_pointer_lock_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers51 = { WebIDLPrefIndex::dom_security_sanitizer_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers56 = { WebIDLPrefIndex::layout_css_typed_om_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers58 = { WebIDLPrefIndex::accessibility_ariaNotify_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers67 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &nsINode::HasBoxQuadsSupport }; static const PrefableDisablers sMethods_disablers69 = { WebIDLPrefIndex::layout_css_convertFromNode_enabled, 0, false, OriginTrial(0), nullptr }; static const Prefable sMethods[] = { { nullptr, &sMethods_specs[0] }, { &sMethods_disablers24, &sMethods_specs[24] }, { nullptr, &sMethods_specs[27] }, { &sMethods_disablers33, &sMethods_specs[33] }, { nullptr, &sMethods_specs[37] }, { &sMethods_disablers49, &sMethods_specs[49] }, { &sMethods_disablers51, &sMethods_specs[51] }, { nullptr, &sMethods_specs[53] }, { &sMethods_disablers56, &sMethods_specs[56] }, { &sMethods_disablers58, &sMethods_specs[58] }, { nullptr, &sMethods_specs[60] }, { &sMethods_disablers67, &sMethods_specs[67] }, { &sMethods_disablers69, &sMethods_specs[69] }, { nullptr, &sMethods_specs[73] }, { nullptr, nullptr } }; static_assert(14 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(23 <= 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 JSFunctionSpec sChromeMethods_specs[] = { JS_FNSPEC("setCaptureAlways", (GenericMethod), reinterpret_cast(&setCaptureAlways_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("mozScrollSnap", (GenericMethod), reinterpret_cast(&mozScrollSnap_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getAsFlexContainer", (GenericMethod), reinterpret_cast(&getAsFlexContainer_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getGridFragments", (GenericMethod), reinterpret_cast(&getGridFragments_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasGridFragments", (GenericMethod), reinterpret_cast(&hasGridFragments_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getElementsWithGrid", (GenericMethod), reinterpret_cast(&getElementsWithGrid_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttributeDevtools", (GenericMethod), reinterpret_cast(&setAttributeDevtools_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAttributeDevtoolsNS", (GenericMethod), reinterpret_cast(&setAttributeDevtoolsNS_methodinfo), 3, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getBoxQuadsFromWindowOrigin", (GenericMethod), reinterpret_cast(&getBoxQuadsFromWindowOrigin_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("getElementsByAttribute", (GenericMethod), reinterpret_cast(&getElementsByAttribute_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("getElementsByAttributeNS", (GenericMethod), reinterpret_cast(&getElementsByAttributeNS_methodinfo), 3, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sChromeMethods_disablers9 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &nsINode::HasBoxQuadsSupport }; static const Prefable sChromeMethods[] = { { nullptr, &sChromeMethods_specs[0] }, { &sChromeMethods_disablers9, &sChromeMethods_specs[9] }, { nullptr, &sChromeMethods_specs[11] }, { nullptr, nullptr } }; static_assert(3 <= 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)"); MOZ_GLOBINIT static const JSPropertySpec sAttributes_specs[] = { JSPropertySpec::nativeAccessors("namespaceURI", JSPROP_ENUMERATE, GenericGetter, &namespaceURI_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("prefix", JSPROP_ENUMERATE, GenericGetter, &prefix_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("localName", JSPROP_ENUMERATE, GenericGetter, &localName_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("tagName", JSPROP_ENUMERATE, GenericGetter, &tagName_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("id", JSPROP_ENUMERATE, GenericGetter, &id_getterinfo, GenericSetter, &id_setterinfo), JSPropertySpec::nativeAccessors("className", JSPROP_ENUMERATE, GenericGetter, &className_getterinfo, GenericSetter, &className_setterinfo), JSPropertySpec::nativeAccessors("classList", JSPROP_ENUMERATE, GenericGetter, &classList_getterinfo, GenericSetter, &classList_setterinfo), JSPropertySpec::nativeAccessors("part", JSPROP_ENUMERATE, GenericGetter, &part_getterinfo, GenericSetter, &part_setterinfo), JSPropertySpec::nativeAccessors("attributes", JSPROP_ENUMERATE, GenericGetter, &attributes_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollTop", JSPROP_ENUMERATE, GenericGetter, &scrollTop_getterinfo, GenericSetter, &scrollTop_setterinfo), JSPropertySpec::nativeAccessors("scrollLeft", JSPROP_ENUMERATE, GenericGetter, &scrollLeft_getterinfo, GenericSetter, &scrollLeft_setterinfo), JSPropertySpec::nativeAccessors("scrollWidth", JSPROP_ENUMERATE, GenericGetter, &scrollWidth_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollHeight", JSPROP_ENUMERATE, GenericGetter, &scrollHeight_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientTop", JSPROP_ENUMERATE, GenericGetter, &clientTop_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientLeft", JSPROP_ENUMERATE, GenericGetter, &clientLeft_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientWidth", JSPROP_ENUMERATE, GenericGetter, &clientWidth_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientHeight", JSPROP_ENUMERATE, GenericGetter, &clientHeight_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollTopMax", JSPROP_ENUMERATE, GenericGetter, &scrollTopMax_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollLeftMax", JSPROP_ENUMERATE, GenericGetter, &scrollLeftMax_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("currentCSSZoom", JSPROP_ENUMERATE, GenericGetter, ¤tCSSZoom_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("innerHTML", JSPROP_ENUMERATE, GenericGetter, &innerHTML_getterinfo, GenericSetter, &innerHTML_setterinfo), JSPropertySpec::nativeAccessors("outerHTML", JSPROP_ENUMERATE, GenericGetter, &outerHTML_getterinfo, GenericSetter, &outerHTML_setterinfo), JSPropertySpec::nativeAccessors("shadowRoot", JSPROP_ENUMERATE, GenericGetter, &shadowRoot_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("openOrClosedShadowRoot", JSPROP_ENUMERATE, GenericGetter, &openOrClosedShadowRoot_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("assignedSlot", JSPROP_ENUMERATE, GenericGetter, &assignedSlot_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("slot", JSPROP_ENUMERATE, GenericGetter, &slot_getterinfo, GenericSetter, &slot_setterinfo), JS_PS_END, JSPropertySpec::nativeAccessors("customElementRegistry", JSPROP_ENUMERATE, GenericGetter, &customElementRegistry_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("onfullscreenchange", JSPROP_ENUMERATE, GenericGetter, &onfullscreenchange_getterinfo, GenericSetter, &onfullscreenchange_setterinfo), JSPropertySpec::nativeAccessors("onfullscreenerror", JSPROP_ENUMERATE, GenericGetter, &onfullscreenerror_getterinfo, GenericSetter, &onfullscreenerror_setterinfo), JSPropertySpec::nativeAccessors("ariaActiveDescendantElement", JSPROP_ENUMERATE, GenericGetter, &ariaActiveDescendantElement_getterinfo, GenericSetter, &ariaActiveDescendantElement_setterinfo), JSPropertySpec::nativeAccessors("role", JSPROP_ENUMERATE, GenericGetter, &role_getterinfo, GenericSetter, &role_setterinfo), JSPropertySpec::nativeAccessors("ariaAtomic", JSPROP_ENUMERATE, GenericGetter, &ariaAtomic_getterinfo, GenericSetter, &ariaAtomic_setterinfo), JSPropertySpec::nativeAccessors("ariaAutoComplete", JSPROP_ENUMERATE, GenericGetter, &ariaAutoComplete_getterinfo, GenericSetter, &ariaAutoComplete_setterinfo), JSPropertySpec::nativeAccessors("ariaBrailleLabel", JSPROP_ENUMERATE, GenericGetter, &ariaBrailleLabel_getterinfo, GenericSetter, &ariaBrailleLabel_setterinfo), JSPropertySpec::nativeAccessors("ariaBrailleRoleDescription", JSPROP_ENUMERATE, GenericGetter, &ariaBrailleRoleDescription_getterinfo, GenericSetter, &ariaBrailleRoleDescription_setterinfo), JSPropertySpec::nativeAccessors("ariaBusy", JSPROP_ENUMERATE, GenericGetter, &ariaBusy_getterinfo, GenericSetter, &ariaBusy_setterinfo), JSPropertySpec::nativeAccessors("ariaChecked", JSPROP_ENUMERATE, GenericGetter, &ariaChecked_getterinfo, GenericSetter, &ariaChecked_setterinfo), JSPropertySpec::nativeAccessors("ariaColCount", JSPROP_ENUMERATE, GenericGetter, &ariaColCount_getterinfo, GenericSetter, &ariaColCount_setterinfo), JSPropertySpec::nativeAccessors("ariaColIndex", JSPROP_ENUMERATE, GenericGetter, &ariaColIndex_getterinfo, GenericSetter, &ariaColIndex_setterinfo), JSPropertySpec::nativeAccessors("ariaColIndexText", JSPROP_ENUMERATE, GenericGetter, &ariaColIndexText_getterinfo, GenericSetter, &ariaColIndexText_setterinfo), JSPropertySpec::nativeAccessors("ariaColSpan", JSPROP_ENUMERATE, GenericGetter, &ariaColSpan_getterinfo, GenericSetter, &ariaColSpan_setterinfo), JSPropertySpec::nativeAccessors("ariaControlsElements", JSPROP_ENUMERATE, GenericGetter, &ariaControlsElements_getterinfo, GenericSetter, &ariaControlsElements_setterinfo), JSPropertySpec::nativeAccessors("ariaCurrent", JSPROP_ENUMERATE, GenericGetter, &ariaCurrent_getterinfo, GenericSetter, &ariaCurrent_setterinfo), JSPropertySpec::nativeAccessors("ariaDescribedByElements", JSPROP_ENUMERATE, GenericGetter, &ariaDescribedByElements_getterinfo, GenericSetter, &ariaDescribedByElements_setterinfo), JSPropertySpec::nativeAccessors("ariaDescription", JSPROP_ENUMERATE, GenericGetter, &ariaDescription_getterinfo, GenericSetter, &ariaDescription_setterinfo), JSPropertySpec::nativeAccessors("ariaDetailsElements", JSPROP_ENUMERATE, GenericGetter, &ariaDetailsElements_getterinfo, GenericSetter, &ariaDetailsElements_setterinfo), JSPropertySpec::nativeAccessors("ariaDisabled", JSPROP_ENUMERATE, GenericGetter, &ariaDisabled_getterinfo, GenericSetter, &ariaDisabled_setterinfo), JSPropertySpec::nativeAccessors("ariaErrorMessageElements", JSPROP_ENUMERATE, GenericGetter, &ariaErrorMessageElements_getterinfo, GenericSetter, &ariaErrorMessageElements_setterinfo), JSPropertySpec::nativeAccessors("ariaExpanded", JSPROP_ENUMERATE, GenericGetter, &ariaExpanded_getterinfo, GenericSetter, &ariaExpanded_setterinfo), JSPropertySpec::nativeAccessors("ariaFlowToElements", JSPROP_ENUMERATE, GenericGetter, &ariaFlowToElements_getterinfo, GenericSetter, &ariaFlowToElements_setterinfo), JSPropertySpec::nativeAccessors("ariaHasPopup", JSPROP_ENUMERATE, GenericGetter, &ariaHasPopup_getterinfo, GenericSetter, &ariaHasPopup_setterinfo), JSPropertySpec::nativeAccessors("ariaHidden", JSPROP_ENUMERATE, GenericGetter, &ariaHidden_getterinfo, GenericSetter, &ariaHidden_setterinfo), JSPropertySpec::nativeAccessors("ariaInvalid", JSPROP_ENUMERATE, GenericGetter, &ariaInvalid_getterinfo, GenericSetter, &ariaInvalid_setterinfo), JSPropertySpec::nativeAccessors("ariaKeyShortcuts", JSPROP_ENUMERATE, GenericGetter, &ariaKeyShortcuts_getterinfo, GenericSetter, &ariaKeyShortcuts_setterinfo), JSPropertySpec::nativeAccessors("ariaLabel", JSPROP_ENUMERATE, GenericGetter, &ariaLabel_getterinfo, GenericSetter, &ariaLabel_setterinfo), JSPropertySpec::nativeAccessors("ariaLabelledByElements", JSPROP_ENUMERATE, GenericGetter, &ariaLabelledByElements_getterinfo, GenericSetter, &ariaLabelledByElements_setterinfo), JSPropertySpec::nativeAccessors("ariaLevel", JSPROP_ENUMERATE, GenericGetter, &ariaLevel_getterinfo, GenericSetter, &ariaLevel_setterinfo), JSPropertySpec::nativeAccessors("ariaLive", JSPROP_ENUMERATE, GenericGetter, &ariaLive_getterinfo, GenericSetter, &ariaLive_setterinfo), JSPropertySpec::nativeAccessors("ariaModal", JSPROP_ENUMERATE, GenericGetter, &ariaModal_getterinfo, GenericSetter, &ariaModal_setterinfo), JSPropertySpec::nativeAccessors("ariaMultiLine", JSPROP_ENUMERATE, GenericGetter, &ariaMultiLine_getterinfo, GenericSetter, &ariaMultiLine_setterinfo), JSPropertySpec::nativeAccessors("ariaMultiSelectable", JSPROP_ENUMERATE, GenericGetter, &ariaMultiSelectable_getterinfo, GenericSetter, &ariaMultiSelectable_setterinfo), JSPropertySpec::nativeAccessors("ariaOrientation", JSPROP_ENUMERATE, GenericGetter, &ariaOrientation_getterinfo, GenericSetter, &ariaOrientation_setterinfo), JSPropertySpec::nativeAccessors("ariaOwnsElements", JSPROP_ENUMERATE, GenericGetter, &ariaOwnsElements_getterinfo, GenericSetter, &ariaOwnsElements_setterinfo), JSPropertySpec::nativeAccessors("ariaPlaceholder", JSPROP_ENUMERATE, GenericGetter, &ariaPlaceholder_getterinfo, GenericSetter, &ariaPlaceholder_setterinfo), JSPropertySpec::nativeAccessors("ariaPosInSet", JSPROP_ENUMERATE, GenericGetter, &ariaPosInSet_getterinfo, GenericSetter, &ariaPosInSet_setterinfo), JSPropertySpec::nativeAccessors("ariaPressed", JSPROP_ENUMERATE, GenericGetter, &ariaPressed_getterinfo, GenericSetter, &ariaPressed_setterinfo), JSPropertySpec::nativeAccessors("ariaReadOnly", JSPROP_ENUMERATE, GenericGetter, &ariaReadOnly_getterinfo, GenericSetter, &ariaReadOnly_setterinfo), JSPropertySpec::nativeAccessors("ariaRelevant", JSPROP_ENUMERATE, GenericGetter, &ariaRelevant_getterinfo, GenericSetter, &ariaRelevant_setterinfo), JSPropertySpec::nativeAccessors("ariaRequired", JSPROP_ENUMERATE, GenericGetter, &ariaRequired_getterinfo, GenericSetter, &ariaRequired_setterinfo), JSPropertySpec::nativeAccessors("ariaRoleDescription", JSPROP_ENUMERATE, GenericGetter, &ariaRoleDescription_getterinfo, GenericSetter, &ariaRoleDescription_setterinfo), JSPropertySpec::nativeAccessors("ariaRowCount", JSPROP_ENUMERATE, GenericGetter, &ariaRowCount_getterinfo, GenericSetter, &ariaRowCount_setterinfo), JSPropertySpec::nativeAccessors("ariaRowIndex", JSPROP_ENUMERATE, GenericGetter, &ariaRowIndex_getterinfo, GenericSetter, &ariaRowIndex_setterinfo), JSPropertySpec::nativeAccessors("ariaRowIndexText", JSPROP_ENUMERATE, GenericGetter, &ariaRowIndexText_getterinfo, GenericSetter, &ariaRowIndexText_setterinfo), JSPropertySpec::nativeAccessors("ariaRowSpan", JSPROP_ENUMERATE, GenericGetter, &ariaRowSpan_getterinfo, GenericSetter, &ariaRowSpan_setterinfo), JSPropertySpec::nativeAccessors("ariaSelected", JSPROP_ENUMERATE, GenericGetter, &ariaSelected_getterinfo, GenericSetter, &ariaSelected_setterinfo), JSPropertySpec::nativeAccessors("ariaSetSize", JSPROP_ENUMERATE, GenericGetter, &ariaSetSize_getterinfo, GenericSetter, &ariaSetSize_setterinfo), JSPropertySpec::nativeAccessors("ariaSort", JSPROP_ENUMERATE, GenericGetter, &ariaSort_getterinfo, GenericSetter, &ariaSort_setterinfo), JSPropertySpec::nativeAccessors("ariaValueMax", JSPROP_ENUMERATE, GenericGetter, &ariaValueMax_getterinfo, GenericSetter, &ariaValueMax_setterinfo), JSPropertySpec::nativeAccessors("ariaValueMin", JSPROP_ENUMERATE, GenericGetter, &ariaValueMin_getterinfo, GenericSetter, &ariaValueMin_setterinfo), JSPropertySpec::nativeAccessors("ariaValueNow", JSPROP_ENUMERATE, GenericGetter, &ariaValueNow_getterinfo, GenericSetter, &ariaValueNow_setterinfo), JSPropertySpec::nativeAccessors("ariaValueText", JSPROP_ENUMERATE, GenericGetter, &ariaValueText_getterinfo, GenericSetter, &ariaValueText_setterinfo), JSPropertySpec::nativeAccessors("previousElementSibling", JSPROP_ENUMERATE, GenericGetter, &previousElementSibling_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("nextElementSibling", JSPROP_ENUMERATE, GenericGetter, &nextElementSibling_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("children", JSPROP_ENUMERATE, GenericGetter, &children_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("firstElementChild", JSPROP_ENUMERATE, GenericGetter, &firstElementChild_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("lastElementChild", JSPROP_ENUMERATE, GenericGetter, &lastElementChild_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("childElementCount", JSPROP_ENUMERATE, GenericGetter, &childElementCount_getterinfo, nullptr, nullptr), JS_PS_END }; static const PrefableDisablers sAttributes_disablers20 = { WebIDLPrefIndex::layout_css_zoom_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sAttributes_disablers26 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &Document::IsCallerChromeOrAddon }; static const PrefableDisablers sAttributes_disablers31 = { WebIDLPrefIndex::dom_scoped_custom_element_registries_enabled, 0, false, OriginTrial(0), nullptr }; static const Prefable sAttributes[] = { { nullptr, &sAttributes_specs[0] }, { &sAttributes_disablers20, &sAttributes_specs[20] }, { nullptr, &sAttributes_specs[22] }, { &sAttributes_disablers26, &sAttributes_specs[26] }, { nullptr, &sAttributes_specs[28] }, { &sAttributes_disablers31, &sAttributes_specs[31] }, { nullptr, &sAttributes_specs[33] }, { nullptr, nullptr } }; static_assert(7 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(60 <= 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 sChromeAttributes_specs[] = { JSPropertySpec::nativeAccessors("fontSizeInflation", JSPROP_ENUMERATE, GenericGetter, &fontSizeInflation_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("implementedPseudoElement", JSPROP_ENUMERATE, GenericGetter, &implementedPseudoElement_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("screenX", JSPROP_ENUMERATE, GenericGetter, &screenX_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("screenY", JSPROP_ENUMERATE, GenericGetter, &screenY_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("screen", JSPROP_ENUMERATE, GenericGetter, &screen_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollTopMin", JSPROP_ENUMERATE, GenericGetter, &scrollTopMin_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("scrollLeftMin", JSPROP_ENUMERATE, GenericGetter, &scrollLeftMin_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("openOrClosedAssignedSlot", JSPROP_ENUMERATE, GenericGetter, &openOrClosedAssignedSlot_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("hasVisibleScrollbars", JSPROP_ENUMERATE, GenericGetter, &hasVisibleScrollbars_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientHeightDouble", JSPROP_ENUMERATE, GenericGetter, &clientHeightDouble_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("clientWidthDouble", JSPROP_ENUMERATE, GenericGetter, &clientWidthDouble_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("firstLineBoxBSize", JSPROP_ENUMERATE, GenericGetter, &firstLineBoxBSize_getterinfo, nullptr, nullptr), JS_PS_END }; static const Prefable sChromeAttributes[] = { { nullptr, &sChromeAttributes_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(12 <= 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[153]; static PropertyInfo sNativeProperties_propertyInfos[153]; static const NativePropertiesN<2> sNativeProperties = { false, 0, false, 0, true, 0 /* sMethods */, true, 1 /* sAttributes */, false, 0, false, 0, false, 0, -1, 153, sNativeProperties_sortedPropertyIndices, { { sMethods, &sNativeProperties_propertyInfos[0] }, { sAttributes, &sNativeProperties_propertyInfos[66] } } }; static_assert(153 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)), "We have a property info count that is oversized"); static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[23]; static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[23]; static const NativePropertiesN<2> sChromeOnlyNativeProperties = { false, 0, false, 0, true, 0 /* sChromeMethods */, true, 1 /* sChromeAttributes */, false, 0, false, 0, false, 0, -1, 23, sChromeOnlyNativeProperties_sortedPropertyIndices, { { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[11] } } }; static_assert(23 < 1ull << (CHAR_BIT * sizeof(sChromeOnlyNativeProperties.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(), sChromeOnlyNativeProperties.Upcast(), &sNativePropertiesInited }, prototypes::id::Element, constructors::id::Element, &sXrayExpandoObjectClass }; static const DOMInterfaceInfo sInterfaceObjectInfo = { { ThrowingConstructor, &sNativePropertyHooks }, Node_Binding::GetConstructorObjectHandle, PrototypeTraits::Depth, prototypes::id::Element, true, 0, "Element", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "ElementPrototype", 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::Element, PrototypeTraits::Depth, &sNativePropertyHooks, Node_Binding::GetProtoObject }; 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 = { { "Element", 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::_ID_Count, prototypes::id::_ID_Count, 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::Element* 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 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 ClearCachedAriaControlsElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 0); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 0); } void ClearCachedAriaDescribedByElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 1); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 1); } void ClearCachedAriaDetailsElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 2); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 2); } void ClearCachedAriaErrorMessageElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 3); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 3); } void ClearCachedAriaFlowToElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 4); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 4); } void ClearCachedAriaLabelledByElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 5); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 5); } void ClearCachedAriaOwnsElementsValue(mozilla::dom::Element* aObject) { JSObject* obj; obj = aObject->GetWrapper(); if (!obj) { return; } ReflectedHTMLAttributeSlots::Clear(obj, 6); ReflectedHTMLAttributeSlots::ClearInXrays(RootingCx(), obj, 6); } static const char* const unscopableNames[] = { "slot", "before", "after", "replaceWith", "remove", "prepend", "append", "replaceChildren", nullptr }; void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::Element); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::Element); JS::Handle parentProto(Node_Binding::GetProtoObjectHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(Node_Binding::GetConstructorObjectHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast(), "Element", aDefineOnGlobal != DefineInterfaceProperty::No, unscopableNames, false, nullptr); } 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::Element, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } JSObject* GetProtoObject(JSContext* aCx) { return GetProtoObjectHandle(aCx); } JS::Handle GetConstructorObjectHandle(JSContext* aCx) { /* Get the interface object for this class. This will create the object as needed. */ return GetPerInterfaceObjectHandle(aCx, constructors::id::Element, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace Element_Binding } // namespace dom } // namespace mozilla