/* THIS FILE IS AUTOGENERATED FROM HTMLMediaElement.webidl BY Codegen.py - DO NOT EDIT */ #include #include "DOMMediaStream.h" #include "ElementBinding.h" #include "EventHandlerBinding.h" #include "HTMLElementBinding.h" #include "HTMLMediaElementBinding.h" #include "MainThreadUtils.h" #include "MediaUtils.h" #include "WrapperFactory.h" #include "XrayWrapper.h" #include "js/CallAndConstruct.h" #include "js/Exception.h" #include "js/MapAndSet.h" #include "js/Object.h" #include "js/PropertyAndElement.h" #include "js/PropertyDescriptor.h" #include "js/experimental/JitInfo.h" #include "mozilla/Atomics.h" #include "mozilla/BasePrincipal.h" #include "mozilla/FloatingPoint.h" #include "mozilla/OwningNonNull.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/dom/AudioTrackList.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/CustomElementRegistry.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/DocGroup.h" #include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/MediaError.h" #include "mozilla/dom/MediaKeys.h" #include "mozilla/dom/MediaSource.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/Nullable.h" #include "mozilla/dom/PrimitiveConversions.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/TextTrack.h" #include "mozilla/dom/TextTrackList.h" #include "mozilla/dom/TimeRanges.h" #include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/VideoTrackList.h" #include "mozilla/dom/WebIDLPrefs.h" #include "mozilla/dom/XrayExpandoClass.h" #include "nsContentUtils.h" #include "nsJSPrincipals.h" namespace mozilla::dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; namespace HTMLMediaElement_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_error(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "error", 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)->GetError())); 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 error_getterinfo = { { get_error }, { prototypes::id::HTMLMediaElement }, { 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_src(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "src", 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_vGetSrc(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetSrc(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_src(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "src", 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; 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_vSetSrc(NonNullHelper(Constify(arg0)), MOZ_KnownLive(subjectPrincipal), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetSrc(NonNullHelper(Constify(arg0)), MOZ_KnownLive(subjectPrincipal), rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.src setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo src_getterinfo = { { get_src }, { prototypes::id::HTMLMediaElement }, { 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 src_setterinfo = { { (JSJitGetterOp)set_src }, { prototypes::id::HTMLMediaElement }, { 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_currentSrc(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "currentSrc", 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_vGetCurrentSrc(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetCurrentSrc(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo currentSrc_getterinfo = { { get_currentSrc }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool get_crossOrigin(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "crossOrigin", 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_vGetCrossOrigin(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetCrossOrigin(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::StringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_crossOrigin(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "crossOrigin", 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_vSetCrossOrigin(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetCrossOrigin(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.crossOrigin setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo crossOrigin_getterinfo = { { get_crossOrigin }, { prototypes::id::HTMLMediaElement }, { 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 crossOrigin_setterinfo = { { (JSJitGetterOp)set_crossOrigin }, { prototypes::id::HTMLMediaElement }, { 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_networkState(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "networkState", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); uint16_t result(MOZ_KnownLive(self)->NetworkState()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo networkState_getterinfo = { { get_networkState }, { prototypes::id::HTMLMediaElement }, { 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_preload(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "preload", 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_vGetPreload(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetPreload(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool set_preload(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "preload", 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_vSetPreload(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetPreload(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.preload setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo preload_getterinfo = { { get_preload }, { prototypes::id::HTMLMediaElement }, { 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 preload_setterinfo = { { (JSJitGetterOp)set_preload }, { prototypes::id::HTMLMediaElement }, { 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_buffered(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "buffered", 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)->Buffered())); 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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo buffered_getterinfo = { { get_buffered }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, 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 load(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "load", 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_vLoad())>, "Should be returning void here"); MOZ_KnownLive(self)->Load(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo load_methodinfo = { { (JSJitGetterOp)load }, { prototypes::id::HTMLMediaElement }, { 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 canPlayType(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "canPlayType", 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, "HTMLMediaElement.canPlayType", 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_vCanPlayType(NonNullHelper(Constify(arg0)), result))>, "Should be returning void here"); MOZ_KnownLive(self)->CanPlayType(NonNullHelper(Constify(arg0)), result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo canPlayType_methodinfo = { { (JSJitGetterOp)canPlayType }, { prototypes::id::HTMLMediaElement }, { 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 get_readyState(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "readyState", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); uint16_t result(MOZ_KnownLive(self)->ReadyState()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setInt32(int32_t(result)); return true; } static const JSJitInfo readyState_getterinfo = { { get_readyState }, { prototypes::id::HTMLMediaElement }, { 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_seeking(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "seeking", 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)->Seeking()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo seeking_getterinfo = { { get_seeking }, { prototypes::id::HTMLMediaElement }, { 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_currentTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "currentTime", 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)->CurrentTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_currentTime(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "HTMLMediaElement.currentTime setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "currentTime", 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; } else if (!std::isfinite(arg0)) { cx.ThrowErrorMessage("Value being assigned"); return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetCurrentTime(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetCurrentTime(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.currentTime setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo currentTime_getterinfo = { { get_currentTime }, { prototypes::id::HTMLMediaElement }, { 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 currentTime_setterinfo = { { (JSJitGetterOp)set_currentTime }, { prototypes::id::HTMLMediaElement }, { 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 fastSeek(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "HTMLMediaElement.fastSeek"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "fastSeek", 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, "HTMLMediaElement.fastSeek", 1)) { return false; } double arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } else if (!std::isfinite(arg0)) { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vFastSeek(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->FastSeek(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.fastSeek")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo fastSeek_methodinfo = { { (JSJitGetterOp)fastSeek }, { prototypes::id::HTMLMediaElement }, { 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_duration(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "duration", 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)->Duration()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo duration_getterinfo = { { get_duration }, { prototypes::id::HTMLMediaElement }, { 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 updateCueDisplay(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "updateCueDisplay", 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_vUpdateCueDisplay())>, "Should be returning void here"); MOZ_KnownLive(self)->UpdateCueDisplay(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo updateCueDisplay_methodinfo = { { (JSJitGetterOp)updateCueDisplay }, { prototypes::id::HTMLMediaElement }, { 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_isEncrypted(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "isEncrypted", 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)->IsEncrypted()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isEncrypted_getterinfo = { { get_isEncrypted }, { prototypes::id::HTMLMediaElement }, { 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_paused(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "paused", 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)->Paused()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo paused_getterinfo = { { get_paused }, { prototypes::id::HTMLMediaElement }, { 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_defaultPlaybackRate(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "defaultPlaybackRate", 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)->DefaultPlaybackRate()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_defaultPlaybackRate(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "HTMLMediaElement.defaultPlaybackRate setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "defaultPlaybackRate", 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; } else if (!std::isfinite(arg0)) { cx.ThrowErrorMessage("Value being assigned"); return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetDefaultPlaybackRate(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetDefaultPlaybackRate(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.defaultPlaybackRate setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo defaultPlaybackRate_getterinfo = { { get_defaultPlaybackRate }, { prototypes::id::HTMLMediaElement }, { 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 defaultPlaybackRate_setterinfo = { { (JSJitGetterOp)set_defaultPlaybackRate }, { prototypes::id::HTMLMediaElement }, { 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_playbackRate(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "playbackRate", 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)->PlaybackRate()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_playbackRate(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "HTMLMediaElement.playbackRate setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "playbackRate", 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; } else if (!std::isfinite(arg0)) { cx.ThrowErrorMessage("Value being assigned"); return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetPlaybackRate(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetPlaybackRate(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.playbackRate setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo playbackRate_getterinfo = { { get_playbackRate }, { prototypes::id::HTMLMediaElement }, { 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 playbackRate_setterinfo = { { (JSJitGetterOp)set_playbackRate }, { prototypes::id::HTMLMediaElement }, { 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_played(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "played", 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)->Played())); 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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo played_getterinfo = { { get_played }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, 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_seekable(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "seekable", 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)->Seekable())); 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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo seekable_getterinfo = { { get_seekable }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, 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_ended(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "ended", 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)->Ended()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo ended_getterinfo = { { get_ended }, { prototypes::id::HTMLMediaElement }, { 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_autoplay(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "autoplay", 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)->Autoplay()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_autoplay(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "autoplay", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &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_vSetAutoplay(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetAutoplay(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.autoplay setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo autoplay_getterinfo = { { get_autoplay }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo autoplay_setterinfo = { { (JSJitGetterOp)set_autoplay }, { prototypes::id::HTMLMediaElement }, { 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_loop(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "loop", 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)->Loop()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_loop(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "loop", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &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_vSetLoop(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetLoop(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.loop setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo loop_getterinfo = { { get_loop }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo loop_setterinfo = { { (JSJitGetterOp)set_loop }, { prototypes::id::HTMLMediaElement }, { 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 play(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "play", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Play(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.play")) [[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 play_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = play(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo play_methodinfo = { { (JSJitGetterOp)play_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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 pause(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "pause", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vPause(rv))>, "Should be returning void here"); MOZ_KnownLive(self)->Pause(rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.pause")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo pause_methodinfo = { { (JSJitGetterOp)pause }, { prototypes::id::HTMLMediaElement }, { 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_controls(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "controls", 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)->Controls()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_controls(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "controls", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &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_vSetControls(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetControls(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.controls setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo controls_getterinfo = { { get_controls }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo controls_setterinfo = { { (JSJitGetterOp)set_controls }, { prototypes::id::HTMLMediaElement }, { 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_volume(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "volume", 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)->Volume()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_volume(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "HTMLMediaElement.volume setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "volume", 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; } else if (!std::isfinite(arg0)) { cx.ThrowErrorMessage("Value being assigned"); return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetVolume(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetVolume(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.volume setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo volume_getterinfo = { { get_volume }, { prototypes::id::HTMLMediaElement }, { 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 volume_setterinfo = { { (JSJitGetterOp)set_volume }, { prototypes::id::HTMLMediaElement }, { 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_muted(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "muted", 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)->Muted()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_muted(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "muted", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool 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_vSetMuted(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetMuted(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo muted_getterinfo = { { get_muted }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo muted_setterinfo = { { (JSJitGetterOp)set_muted }, { prototypes::id::HTMLMediaElement }, { 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_defaultMuted(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "defaultMuted", 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)->DefaultMuted()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_defaultMuted(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "defaultMuted", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &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_vSetDefaultMuted(arg0, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetDefaultMuted(arg0, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.defaultMuted setter")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo defaultMuted_getterinfo = { { get_defaultMuted }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo defaultMuted_setterinfo = { { (JSJitGetterOp)set_defaultMuted }, { prototypes::id::HTMLMediaElement }, { 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_audioTracks(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "audioTracks", 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)->AudioTracks())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo audioTracks_getterinfo = { { get_audioTracks }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, 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_videoTracks(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "videoTracks", 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)->VideoTracks())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo videoTracks_getterinfo = { { get_videoTracks }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, 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_textTracks(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "textTracks", 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)->GetTextTracks())); 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 textTracks_getterinfo = { { get_textTracks }, { prototypes::id::HTMLMediaElement }, { 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 addTextTrack(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "HTMLMediaElement.addTextTrack"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "addTextTrack", 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, "HTMLMediaElement.addTextTrack", 1)) { return false; } TextTrackKind arg0; { int index; if (!binding_detail::FindEnumStringIndex(cx, args[0], binding_detail::EnumStrings::Values, "TextTrackKind", "argument 1", &index)) { return false; } MOZ_ASSERT(index >= 0); arg0 = static_cast(index); } nsAutoString arg1; if (args.hasDefined(1)) { if (!ConvertJSValueToString(cx, args[1], eStringify, eStringify, arg1)) { return false; } } else { arg1.AssignLiteral(u""); } nsAutoString arg2; if (args.hasDefined(2)) { if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) { return false; } } else { arg2.AssignLiteral(u""); } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->AddTextTrack(arg0, NonNullHelper(Constify(arg1)), NonNullHelper(Constify(arg2))))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo addTextTrack_methodinfo = { { (JSJitGetterOp)addTextTrack }, { prototypes::id::HTMLMediaElement }, { 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_mozMediaSourceObject(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozMediaSourceObject", 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)->GetMozMediaSourceObject())); 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 mozMediaSourceObject_getterinfo = { { get_mozMediaSourceObject }, { prototypes::id::HTMLMediaElement }, { 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 mozRequestDebugInfo(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozRequestDebugInfo", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->MozRequestDebugInfo(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.mozRequestDebugInfo")) [[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 mozRequestDebugInfo_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = mozRequestDebugInfo(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo mozRequestDebugInfo_methodinfo = { { (JSJitGetterOp)mozRequestDebugInfo_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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 mozEnableDebugLog(JSContext* cx, unsigned argc, JS::Value* vp) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozEnableDebugLog", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::Rooted obj(cx, &args.callee()); GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj)); if (global.Failed()) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_v, "Should be returning void here"); mozilla::dom::HTMLMediaElement::MozEnableDebugLog(global); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } MOZ_CAN_RUN_SCRIPT static bool mozRequestDebugLog(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozRequestDebugLog", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->MozRequestDebugLog(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.mozRequestDebugLog")) [[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 mozRequestDebugLog_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = mozRequestDebugLog(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo mozRequestDebugLog_methodinfo = { { (JSJitGetterOp)mozRequestDebugLog_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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_srcObject(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "srcObject", 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)->GetSrcObject())); 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_srcObject(JSContext* cx_, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { BindingCallContext cx(cx_, "HTMLMediaElement.srcObject setter"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "srcObject", 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::DOMMediaStream* 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", "MediaStream"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Value being assigned"); return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetSrcObject(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetSrcObject(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo srcObject_getterinfo = { { get_srcObject }, { prototypes::id::HTMLMediaElement }, { 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 srcObject_setterinfo = { { (JSJitGetterOp)set_srcObject }, { prototypes::id::HTMLMediaElement }, { 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_preservesPitch(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "preservesPitch", 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)->PreservesPitch()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } MOZ_CAN_RUN_SCRIPT static bool set_preservesPitch(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "preservesPitch", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); bool 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_vSetPreservesPitch(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetPreservesPitch(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo preservesPitch_getterinfo = { { get_preservesPitch }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_BOOLEAN, /* returnType. Not relevant for setters. */ true, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; static const JSJitInfo preservesPitch_setterinfo = { { (JSJitGetterOp)set_preservesPitch }, { prototypes::id::HTMLMediaElement }, { 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 mozGetMetadata(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozGetMetadata", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; JS::Rooted result(cx); // NOTE: This assert does NOT call the function. static_assert(std::is_void_vMozGetMetadata(cx, &result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->MozGetMetadata(cx, &result, rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.mozGetMetadata")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (result) { JS::ExposeObjectToActiveJS(result); } args.rval().setObjectOrNull(result); if (!MaybeWrapObjectOrNullValue(cx, args.rval())) { return false; } return true; } static const JSJitInfo mozGetMetadata_methodinfo = { { (JSJitGetterOp)mozGetMetadata }, { prototypes::id::HTMLMediaElement }, { 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 get_mozFragmentEnd(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozFragmentEnd", 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)->MozFragmentEnd()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo mozFragmentEnd_getterinfo = { { get_mozFragmentEnd }, { prototypes::id::HTMLMediaElement }, { 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_mediaKeys(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mediaKeys", 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)->GetMediaKeys())); 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 mediaKeys_getterinfo = { { get_mediaKeys }, { prototypes::id::HTMLMediaElement }, { 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 setMediaKeys(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "HTMLMediaElement.setMediaKeys"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setMediaKeys", 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, "HTMLMediaElement.setMediaKeys", 1)) { return false; } mozilla::dom::MediaKeys* 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", "MediaKeys"); return false; } } } else if (args[0].isNullOrUndefined()) { arg0 = nullptr; } else { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SetMediaKeys(MOZ_KnownLive(Constify(arg0)), rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.setMediaKeys")) [[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 setMediaKeys_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = setMediaKeys(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo setMediaKeys_methodinfo = { { (JSJitGetterOp)setMediaKeys_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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_onencrypted(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "onencrypted", 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)->GetOnencrypted()); 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_onencrypted(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "onencrypted", 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_vSetOnencrypted(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetOnencrypted(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo onencrypted_getterinfo = { { get_onencrypted }, { prototypes::id::HTMLMediaElement }, { 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 onencrypted_setterinfo = { { (JSJitGetterOp)set_onencrypted }, { prototypes::id::HTMLMediaElement }, { 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_onwaitingforkey(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "onwaitingforkey", 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)->GetOnwaitingforkey()); 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_onwaitingforkey(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "onwaitingforkey", 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_vSetOnwaitingforkey(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here"); MOZ_KnownLive(self)->SetOnwaitingforkey(MOZ_KnownLive(Constify(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo onwaitingforkey_getterinfo = { { get_onwaitingforkey }, { prototypes::id::HTMLMediaElement }, { 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 onwaitingforkey_setterinfo = { { (JSJitGetterOp)set_onwaitingforkey }, { prototypes::id::HTMLMediaElement }, { 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_computedVolume(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "computedVolume", 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)->ComputedVolume()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo computedVolume_getterinfo = { { get_computedVolume }, { prototypes::id::HTMLMediaElement }, { 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_computedMuted(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "computedMuted", 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)->ComputedMuted()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo computedMuted_getterinfo = { { get_computedMuted }, { prototypes::id::HTMLMediaElement }, { 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_isSuspendedByInactiveDocOrDocShell(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "isSuspendedByInactiveDocOrDocShell", 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)->IsSuspendedByInactiveDocOrDocShell()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isSuspendedByInactiveDocOrDocShell_getterinfo = { { get_isSuspendedByInactiveDocOrDocShell }, { prototypes::id::HTMLMediaElement }, { 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 seekToNextFrame(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "seekToNextFrame", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SeekToNextFrame(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.seekToNextFrame")) [[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 seekToNextFrame_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = seekToNextFrame(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo seekToNextFrame_methodinfo = { { (JSJitGetterOp)seekToNextFrame_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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 setVisible(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setVisible", 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, "HTMLMediaElement.setVisible", 1)) { return false; } bool arg0; if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetVisible(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetVisible(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setVisible_methodinfo = { { (JSJitGetterOp)setVisible }, { prototypes::id::HTMLMediaElement }, { 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 hasSuspendTaint(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "hasSuspendTaint", 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)->HasSuspendTaint()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo hasSuspendTaint_methodinfo = { { (JSJitGetterOp)hasSuspendTaint }, { prototypes::id::HTMLMediaElement }, { 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 get_isInViewPort(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "isInViewPort", 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)->IsInViewPort()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isInViewPort_getterinfo = { { get_isInViewPort }, { prototypes::id::HTMLMediaElement }, { 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_mutedReasons(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mutedReasons", 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)->GetMutedReasons()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setNumber(result); return true; } static const JSJitInfo mutedReasons_getterinfo = { { get_mutedReasons }, { prototypes::id::HTMLMediaElement }, { 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_isVideoDecodingSuspended(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "isVideoDecodingSuspended", 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)->IsVideoDecodingSuspended()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isVideoDecodingSuspended_getterinfo = { { get_isVideoDecodingSuspended }, { prototypes::id::HTMLMediaElement }, { 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_totalVideoPlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "totalVideoPlayTime", 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)->TotalVideoPlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo totalVideoPlayTime_getterinfo = { { get_totalVideoPlayTime }, { prototypes::id::HTMLMediaElement }, { 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_totalVideoHDRPlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "totalVideoHDRPlayTime", 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)->TotalVideoHDRPlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo totalVideoHDRPlayTime_getterinfo = { { get_totalVideoHDRPlayTime }, { prototypes::id::HTMLMediaElement }, { 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_visiblePlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "visiblePlayTime", 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)->VisiblePlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo visiblePlayTime_getterinfo = { { get_visiblePlayTime }, { prototypes::id::HTMLMediaElement }, { 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_invisiblePlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "invisiblePlayTime", 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)->InvisiblePlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo invisiblePlayTime_getterinfo = { { get_invisiblePlayTime }, { prototypes::id::HTMLMediaElement }, { 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_totalAudioPlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "totalAudioPlayTime", 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)->TotalAudioPlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo totalAudioPlayTime_getterinfo = { { get_totalAudioPlayTime }, { prototypes::id::HTMLMediaElement }, { 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_audiblePlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "audiblePlayTime", 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)->AudiblePlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo audiblePlayTime_getterinfo = { { get_audiblePlayTime }, { prototypes::id::HTMLMediaElement }, { 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_inaudiblePlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "inaudiblePlayTime", 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)->InaudiblePlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo inaudiblePlayTime_getterinfo = { { get_inaudiblePlayTime }, { prototypes::id::HTMLMediaElement }, { 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_mutedPlayTime(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mutedPlayTime", 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)->MutedPlayTime()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo mutedPlayTime_getterinfo = { { get_mutedPlayTime }, { prototypes::id::HTMLMediaElement }, { 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 setFormatDiagnosticsReportForMimeType(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "HTMLMediaElement.setFormatDiagnosticsReportForMimeType"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setFormatDiagnosticsReportForMimeType", 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, "HTMLMediaElement.setFormatDiagnosticsReportForMimeType", 2)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } DecoderDoctorReportType arg1; { int index; if (!binding_detail::FindEnumStringIndex(cx, args[1], binding_detail::EnumStrings::Values, "DecoderDoctorReportType", "argument 2", &index)) { return false; } MOZ_ASSERT(index >= 0); arg1 = static_cast(index); } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetFormatDiagnosticsReportForMimeType(NonNullHelper(Constify(arg0)), arg1))>, "Should be returning void here"); MOZ_KnownLive(self)->SetFormatDiagnosticsReportForMimeType(NonNullHelper(Constify(arg0)), arg1); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setFormatDiagnosticsReportForMimeType_methodinfo = { { (JSJitGetterOp)setFormatDiagnosticsReportForMimeType }, { prototypes::id::HTMLMediaElement }, { 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 setDecodeError(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setDecodeError", 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, "HTMLMediaElement.setDecodeError", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetDecodeError(NonNullHelper(Constify(arg0)), rv))>, "Should be returning void here"); MOZ_KnownLive(self)->SetDecodeError(NonNullHelper(Constify(arg0)), rv); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.setDecodeError")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setDecodeError_methodinfo = { { (JSJitGetterOp)setDecodeError }, { prototypes::id::HTMLMediaElement }, { 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 setAudioSinkFailedStartup(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setAudioSinkFailedStartup", 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_vSetAudioSinkFailedStartup())>, "Should be returning void here"); MOZ_KnownLive(self)->SetAudioSinkFailedStartup(); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setUndefined(); return true; } static const JSJitInfo setAudioSinkFailedStartup_methodinfo = { { (JSJitGetterOp)setAudioSinkFailedStartup }, { prototypes::id::HTMLMediaElement }, { 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_sinkId(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "sinkId", 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_vGetSinkId(result))>, "Should be returning void here"); MOZ_KnownLive(self)->GetSinkId(result); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo sinkId_getterinfo = { { get_sinkId }, { prototypes::id::HTMLMediaElement }, { PrototypeTraits::Depth }, JSJitInfo::Getter, JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */ JSVAL_TYPE_STRING, /* returnType. Not relevant for setters. */ false, /* isInfallible. False in setters. */ false, /* isMovable. Not relevant for setters. */ false, /* isEliminatable. Not relevant for setters. */ false, /* isAlwaysInSlot. Only relevant for getters. */ false, /* isLazilyCachedInSlot. Only relevant for getters. */ false, /* isTypedMethod. Only relevant for methods. */ 0 /* Reserved slot index, if we're stored in a slot, else 0. */ }; MOZ_CAN_RUN_SCRIPT static bool setSinkId(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "setSinkId", 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, "HTMLMediaElement.setSinkId", 1)) { return false; } nsAutoString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SetSinkId(NonNullHelper(Constify(arg0)), rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.setSinkId")) [[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 setSinkId_promiseWrapper(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { bool ok = setSinkId(cx, obj, void_self, args); if (ok) { return true; } return ConvertExceptionToPromise(cx, args.rval()); } static const JSJitInfo setSinkId_methodinfo = { { (JSJitGetterOp)setSinkId_promiseWrapper }, { prototypes::id::HTMLMediaElement }, { 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_allowedToPlay(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "allowedToPlay", 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)->AllowedToPlay()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo allowedToPlay_getterinfo = { { get_allowedToPlay }, { prototypes::id::HTMLMediaElement }, { 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 captureStream(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "captureStream", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->CaptureStream(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.captureStream")) [[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 captureStream_methodinfo = { { (JSJitGetterOp)captureStream }, { prototypes::id::HTMLMediaElement }, { 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 mozCaptureStream(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozCaptureStream", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->MozCaptureStream(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.mozCaptureStream")) [[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 mozCaptureStream_methodinfo = { { (JSJitGetterOp)mozCaptureStream }, { prototypes::id::HTMLMediaElement }, { 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 mozCaptureStreamUntilEnded(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozCaptureStreamUntilEnded", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->MozCaptureStreamUntilEnded(rv))); if (rv.MaybeSetPendingException(cx, "HTMLMediaElement.mozCaptureStreamUntilEnded")) [[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 mozCaptureStreamUntilEnded_methodinfo = { { (JSJitGetterOp)mozCaptureStreamUntilEnded }, { prototypes::id::HTMLMediaElement }, { 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_mozAudioCaptured(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "HTMLMediaElement", "mozAudioCaptured", 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)->MozAudioCaptured()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo mozAudioCaptured_getterinfo = { { get_mozAudioCaptured }, { prototypes::id::HTMLMediaElement }, { 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_GLOBINIT static const JSFunctionSpec sStaticMethods_specs[] = { JS_FNSPEC("mozEnableDebugLog", mozEnableDebugLog, nullptr, 0, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sStaticMethods_disablers0 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &MediaUtils::HasDebuggerOrTabsPrivilege }; static const Prefable sStaticMethods[] = { { &sStaticMethods_disablers0, &sStaticMethods_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(1 <= 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 sMethods_specs[] = { JS_FNSPEC("load", (GenericMethod), reinterpret_cast(&load_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("canPlayType", (GenericMethod), reinterpret_cast(&canPlayType_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("fastSeek", (GenericMethod), reinterpret_cast(&fastSeek_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("updateCueDisplay", (GenericMethod), reinterpret_cast(&updateCueDisplay_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("play", (GenericMethod), reinterpret_cast(&play_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("pause", (GenericMethod), reinterpret_cast(&pause_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("addTextTrack", (GenericMethod), reinterpret_cast(&addTextTrack_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("mozRequestDebugInfo", (GenericMethod), reinterpret_cast(&mozRequestDebugInfo_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("mozRequestDebugLog", (GenericMethod), reinterpret_cast(&mozRequestDebugLog_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("mozGetMetadata", (GenericMethod), reinterpret_cast(&mozGetMetadata_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setMediaKeys", (GenericMethod), reinterpret_cast(&setMediaKeys_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("seekToNextFrame", (GenericMethod), reinterpret_cast(&seekToNextFrame_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setVisible", (GenericMethod), reinterpret_cast(&setVisible_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("hasSuspendTaint", (GenericMethod), reinterpret_cast(&hasSuspendTaint_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setSinkId", (GenericMethod), reinterpret_cast(&setSinkId_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("captureStream", (GenericMethod), reinterpret_cast(&captureStream_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("mozCaptureStream", (GenericMethod), reinterpret_cast(&mozCaptureStream_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("mozCaptureStreamUntilEnded", (GenericMethod), reinterpret_cast(&mozCaptureStreamUntilEnded_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sMethods_disablers4 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &IsChromeOrUAWidget }; static const PrefableDisablers sMethods_disablers10 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &MediaUtils::HasDebuggerOrTabsPrivilege }; static const PrefableDisablers sMethods_disablers16 = { WebIDLPrefIndex::media_seekToNextFrame_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers18 = { WebIDLPrefIndex::media_test_video_suspend, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers21 = { WebIDLPrefIndex::media_setsinkid_enabled, 0, true, OriginTrial(0), nullptr }; static const PrefableDisablers sMethods_disablers23 = { WebIDLPrefIndex::media_captureStream_enabled, 0, false, OriginTrial(0), nullptr }; static const Prefable sMethods[] = { { nullptr, &sMethods_specs[0] }, { &sMethods_disablers4, &sMethods_specs[4] }, { nullptr, &sMethods_specs[6] }, { &sMethods_disablers10, &sMethods_specs[10] }, { nullptr, &sMethods_specs[13] }, { &sMethods_disablers16, &sMethods_specs[16] }, { &sMethods_disablers18, &sMethods_specs[18] }, { &sMethods_disablers21, &sMethods_specs[21] }, { &sMethods_disablers23, &sMethods_specs[23] }, { nullptr, &sMethods_specs[25] }, { nullptr, nullptr } }; static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(3 <= 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("setFormatDiagnosticsReportForMimeType", (GenericMethod), reinterpret_cast(&setFormatDiagnosticsReportForMimeType_methodinfo), 2, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setDecodeError", (GenericMethod), reinterpret_cast(&setDecodeError_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("setAudioSinkFailedStartup", (GenericMethod), reinterpret_cast(&setAudioSinkFailedStartup_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const Prefable sChromeMethods[] = { { nullptr, &sChromeMethods_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(3 <= 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("error", JSPROP_ENUMERATE, GenericGetter, &error_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("src", JSPROP_ENUMERATE, GenericGetter, &src_getterinfo, GenericSetter, &src_setterinfo), JSPropertySpec::nativeAccessors("currentSrc", JSPROP_ENUMERATE, GenericGetter, ¤tSrc_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("crossOrigin", JSPROP_ENUMERATE, GenericGetter, &crossOrigin_getterinfo, GenericSetter, &crossOrigin_setterinfo), JSPropertySpec::nativeAccessors("networkState", JSPROP_ENUMERATE, GenericGetter, &networkState_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("preload", JSPROP_ENUMERATE, GenericGetter, &preload_getterinfo, GenericSetter, &preload_setterinfo), JSPropertySpec::nativeAccessors("buffered", JSPROP_ENUMERATE, GenericGetter, &buffered_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("readyState", JSPROP_ENUMERATE, GenericGetter, &readyState_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("seeking", JSPROP_ENUMERATE, GenericGetter, &seeking_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("currentTime", JSPROP_ENUMERATE, GenericGetter, ¤tTime_getterinfo, GenericSetter, ¤tTime_setterinfo), JSPropertySpec::nativeAccessors("duration", JSPROP_ENUMERATE, GenericGetter, &duration_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("paused", JSPROP_ENUMERATE, GenericGetter, &paused_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("defaultPlaybackRate", JSPROP_ENUMERATE, GenericGetter, &defaultPlaybackRate_getterinfo, GenericSetter, &defaultPlaybackRate_setterinfo), JSPropertySpec::nativeAccessors("playbackRate", JSPROP_ENUMERATE, GenericGetter, &playbackRate_getterinfo, GenericSetter, &playbackRate_setterinfo), JSPropertySpec::nativeAccessors("played", JSPROP_ENUMERATE, GenericGetter, &played_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("seekable", JSPROP_ENUMERATE, GenericGetter, &seekable_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("ended", JSPROP_ENUMERATE, GenericGetter, &ended_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("autoplay", JSPROP_ENUMERATE, GenericGetter, &autoplay_getterinfo, GenericSetter, &autoplay_setterinfo), JSPropertySpec::nativeAccessors("loop", JSPROP_ENUMERATE, GenericGetter, &loop_getterinfo, GenericSetter, &loop_setterinfo), JSPropertySpec::nativeAccessors("controls", JSPROP_ENUMERATE, GenericGetter, &controls_getterinfo, GenericSetter, &controls_setterinfo), JSPropertySpec::nativeAccessors("volume", JSPROP_ENUMERATE, GenericGetter, &volume_getterinfo, GenericSetter, &volume_setterinfo), JSPropertySpec::nativeAccessors("muted", JSPROP_ENUMERATE, GenericGetter, &muted_getterinfo, GenericSetter, &muted_setterinfo), JSPropertySpec::nativeAccessors("defaultMuted", JSPROP_ENUMERATE, GenericGetter, &defaultMuted_getterinfo, GenericSetter, &defaultMuted_setterinfo), JS_PS_END, JSPropertySpec::nativeAccessors("audioTracks", JSPROP_ENUMERATE, GenericGetter, &audioTracks_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("videoTracks", JSPROP_ENUMERATE, GenericGetter, &videoTracks_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("textTracks", JSPROP_ENUMERATE, GenericGetter, &textTracks_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("mozMediaSourceObject", JSPROP_ENUMERATE, GenericGetter, &mozMediaSourceObject_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("srcObject", JSPROP_ENUMERATE, GenericGetter, &srcObject_getterinfo, GenericSetter, &srcObject_setterinfo), JSPropertySpec::nativeAccessors("preservesPitch", JSPROP_ENUMERATE, GenericGetter, &preservesPitch_getterinfo, GenericSetter, &preservesPitch_setterinfo), JSPropertySpec::nativeAccessors("mozFragmentEnd", JSPROP_ENUMERATE, GenericGetter, &mozFragmentEnd_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("mediaKeys", JSPROP_ENUMERATE, GenericGetter, &mediaKeys_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("onencrypted", JSPROP_ENUMERATE, GenericGetter, &onencrypted_getterinfo, GenericSetter, &onencrypted_setterinfo), JSPropertySpec::nativeAccessors("onwaitingforkey", JSPROP_ENUMERATE, GenericGetter, &onwaitingforkey_getterinfo, GenericSetter, &onwaitingforkey_setterinfo), JS_PS_END, JSPropertySpec::nativeAccessors("computedVolume", JSPROP_ENUMERATE, GenericGetter, &computedVolume_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("computedMuted", JSPROP_ENUMERATE, GenericGetter, &computedMuted_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("sinkId", JSPROP_ENUMERATE, GenericGetter, &sinkId_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("allowedToPlay", JSPROP_ENUMERATE, GenericGetter, &allowedToPlay_getterinfo, nullptr, nullptr), JS_PS_END, JSPropertySpec::nativeAccessors("mozAudioCaptured", JSPROP_ENUMERATE, GenericGetter, &mozAudioCaptured_getterinfo, nullptr, nullptr), JS_PS_END }; static const PrefableDisablers sAttributes_disablers24 = { WebIDLPrefIndex::media_track_enabled, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sAttributes_disablers29 = { WebIDLPrefIndex::NoPref, 0, false, OriginTrial(0), &MediaUtils::HasDebuggerOrTabsPrivilege }; static const PrefableDisablers sAttributes_disablers38 = { WebIDLPrefIndex::media_useAudioChannelService_testing, 0, false, OriginTrial(0), nullptr }; static const PrefableDisablers sAttributes_disablers41 = { WebIDLPrefIndex::media_setsinkid_enabled, 0, true, OriginTrial(0), nullptr }; static const PrefableDisablers sAttributes_disablers43 = { WebIDLPrefIndex::media_allowed_to_play_enabled, 0, false, OriginTrial(0), nullptr }; static const Prefable sAttributes[] = { { nullptr, &sAttributes_specs[0] }, { &sAttributes_disablers24, &sAttributes_specs[24] }, { nullptr, &sAttributes_specs[27] }, { &sAttributes_disablers29, &sAttributes_specs[29] }, { nullptr, &sAttributes_specs[31] }, { &sAttributes_disablers38, &sAttributes_specs[38] }, { &sAttributes_disablers41, &sAttributes_specs[41] }, { &sAttributes_disablers43, &sAttributes_specs[43] }, { nullptr, &sAttributes_specs[45] }, { nullptr, nullptr } }; static_assert(9 <= 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 JSPropertySpec sChromeAttributes_specs[] = { JSPropertySpec::nativeAccessors("isEncrypted", JSPROP_ENUMERATE, GenericGetter, &isEncrypted_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isSuspendedByInactiveDocOrDocShell", JSPROP_ENUMERATE, GenericGetter, &isSuspendedByInactiveDocOrDocShell_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isInViewPort", JSPROP_ENUMERATE, GenericGetter, &isInViewPort_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("mutedReasons", JSPROP_ENUMERATE, GenericGetter, &mutedReasons_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isVideoDecodingSuspended", JSPROP_ENUMERATE, GenericGetter, &isVideoDecodingSuspended_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("totalVideoPlayTime", JSPROP_ENUMERATE, GenericGetter, &totalVideoPlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("totalVideoHDRPlayTime", JSPROP_ENUMERATE, GenericGetter, &totalVideoHDRPlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("visiblePlayTime", JSPROP_ENUMERATE, GenericGetter, &visiblePlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("invisiblePlayTime", JSPROP_ENUMERATE, GenericGetter, &invisiblePlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("totalAudioPlayTime", JSPROP_ENUMERATE, GenericGetter, &totalAudioPlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("audiblePlayTime", JSPROP_ENUMERATE, GenericGetter, &audiblePlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("inaudiblePlayTime", JSPROP_ENUMERATE, GenericGetter, &inaudiblePlayTime_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("mutedPlayTime", JSPROP_ENUMERATE, GenericGetter, &mutedPlayTime_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(13 <= 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 ConstantSpec sConstants_specs[] = { { "NETWORK_EMPTY", JS::Int32Value(0) }, { "NETWORK_IDLE", JS::Int32Value(1) }, { "NETWORK_LOADING", JS::Int32Value(2) }, { "NETWORK_NO_SOURCE", JS::Int32Value(3) }, { "HAVE_NOTHING", JS::Int32Value(0) }, { "HAVE_METADATA", JS::Int32Value(1) }, { "HAVE_CURRENT_DATA", JS::Int32Value(2) }, { "HAVE_FUTURE_DATA", JS::Int32Value(3) }, { "HAVE_ENOUGH_DATA", JS::Int32Value(4) }, { 0, JS::UndefinedValue() } }; static const Prefable sConstants[] = { { nullptr, &sConstants_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(9 <= 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[66]; static PropertyInfo sNativeProperties_propertyInfos[66]; static const NativePropertiesN<4> sNativeProperties = { true, 0 /* sStaticMethods */, false, 0, true, 1 /* sMethods */, true, 2 /* sAttributes */, false, 0, false, 0, true, 3 /* sConstants */, -1, 66, sNativeProperties_sortedPropertyIndices, { { sStaticMethods, &sNativeProperties_propertyInfos[0] }, { sMethods, &sNativeProperties_propertyInfos[1] }, { sAttributes, &sNativeProperties_propertyInfos[19] }, { sConstants, &sNativeProperties_propertyInfos[57] } } }; static_assert(66 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)), "We have a property info count that is oversized"); static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[16]; static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[16]; static const NativePropertiesN<2> sChromeOnlyNativeProperties = { false, 0, false, 0, true, 0 /* sChromeMethods */, true, 1 /* sChromeAttributes */, false, 0, false, 0, false, 0, -1, 16, sChromeOnlyNativeProperties_sortedPropertyIndices, { { sChromeMethods, &sChromeOnlyNativeProperties_propertyInfos[0] }, { sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[3] } } }; static_assert(16 < 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::HTMLMediaElement, constructors::id::HTMLMediaElement, &sXrayExpandoObjectClass }; static const DOMInterfaceInfo sInterfaceObjectInfo = { { ThrowingConstructor, &sNativePropertyHooks }, HTMLElement_Binding::GetConstructorObjectHandle, PrototypeTraits::Depth, prototypes::id::HTMLMediaElement, true, 0, "HTMLMediaElement", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "HTMLMediaElementPrototype", 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::HTMLMediaElement, PrototypeTraits::Depth, &sNativePropertyHooks, HTMLElement_Binding::GetProtoObject }; void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::HTMLMediaElement); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::HTMLMediaElement); JS::Handle parentProto(HTMLElement_Binding::GetProtoObjectHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(HTMLElement_Binding::GetConstructorObjectHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast(), "HTMLMediaElement", aDefineOnGlobal != DefineInterfaceProperty::No, nullptr, 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::HTMLMediaElement, &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::HTMLMediaElement, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace HTMLMediaElement_Binding } // namespace mozilla::dom