Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM VTTCue.webidl BY Codegen.py - DO NOT EDIT */
#include <type_traits>
#include "MainThreadUtils.h"
#include "TextTrackCueBinding.h"
#include "VTTCueBinding.h"
#include "WrapperFactory.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 "jsapi.h"
#include "mozilla/Atomics.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/BindingCallContext.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DOMJSClass.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/HTMLDivElement.h"
#include "mozilla/dom/NonRefcountedDOMObject.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrimitiveConversions.h"
#include "mozilla/dom/TextTrackCue.h"
#include "mozilla/dom/TextTrackRegion.h"
#include "mozilla/dom/XrayExpandoClass.h"
#include "nsContentUtils.h"
namespace mozilla {
namespace dom {
namespace binding_detail {}; // Just to make sure it's known as a namespace
using namespace mozilla::dom::binding_detail;
namespace binding_detail {
const nsLiteralCString EnumStrings<AutoKeyword>::Values[1] = {
"auto"_ns,
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, AutoKeyword aArgument, JS::MutableHandle<JS::Value> aValue)
{
MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(binding_detail::EnumStrings<AutoKeyword>::Values));
JSString* resultStr =
JS_NewStringCopyN(aCx, binding_detail::EnumStrings<AutoKeyword>::Values[uint32_t(aArgument)].BeginReading(),
binding_detail::EnumStrings<AutoKeyword>::Values[uint32_t(aArgument)].Length());
if (!resultStr) {
return false;
}
aValue.setString(resultStr);
return true;
}
namespace binding_detail {
const nsLiteralCString EnumStrings<LineAlignSetting>::Values[3] = {
"start"_ns,
"center"_ns,
"end"_ns,
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, LineAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue)
{
MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(binding_detail::EnumStrings<LineAlignSetting>::Values));
JSString* resultStr =
JS_NewStringCopyN(aCx, binding_detail::EnumStrings<LineAlignSetting>::Values[uint32_t(aArgument)].BeginReading(),
binding_detail::EnumStrings<LineAlignSetting>::Values[uint32_t(aArgument)].Length());
if (!resultStr) {
return false;
}
aValue.setString(resultStr);
return true;
}
namespace binding_detail {
const nsLiteralCString EnumStrings<PositionAlignSetting>::Values[4] = {
"line-left"_ns,
"center"_ns,
"line-right"_ns,
"auto"_ns,
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, PositionAlignSetting aArgument, JS::MutableHandle<JS::Value> aValue)
{
MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(binding_detail::EnumStrings<PositionAlignSetting>::Values));
JSString* resultStr =
JS_NewStringCopyN(aCx, binding_detail::EnumStrings<PositionAlignSetting>::Values[uint32_t(aArgument)].BeginReading(),
binding_detail::EnumStrings<PositionAlignSetting>::Values[uint32_t(aArgument)].Length());
if (!resultStr) {
return false;
}
aValue.setString(resultStr);
return true;
}
namespace binding_detail {
const nsLiteralCString EnumStrings<AlignSetting>::Values[5] = {
"start"_ns,
"center"_ns,
"end"_ns,
"left"_ns,
"right"_ns,
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, AlignSetting aArgument, JS::MutableHandle<JS::Value> aValue)
{
MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(binding_detail::EnumStrings<AlignSetting>::Values));
JSString* resultStr =
JS_NewStringCopyN(aCx, binding_detail::EnumStrings<AlignSetting>::Values[uint32_t(aArgument)].BeginReading(),
binding_detail::EnumStrings<AlignSetting>::Values[uint32_t(aArgument)].Length());
if (!resultStr) {
return false;
}
aValue.setString(resultStr);
return true;
}
namespace binding_detail {
const nsLiteralCString EnumStrings<DirectionSetting>::Values[3] = {
""_ns,
"rl"_ns,
"lr"_ns,
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, DirectionSetting aArgument, JS::MutableHandle<JS::Value> aValue)
{
MOZ_ASSERT(uint32_t(aArgument) < ArrayLength(binding_detail::EnumStrings<DirectionSetting>::Values));
JSString* resultStr =
JS_NewStringCopyN(aCx, binding_detail::EnumStrings<DirectionSetting>::Values[uint32_t(aArgument)].BeginReading(),
binding_detail::EnumStrings<DirectionSetting>::Values[uint32_t(aArgument)].Length());
if (!resultStr) {
return false;
}
aValue.setString(resultStr);
return true;
}
bool
DoubleOrAutoKeyword::TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
tryNext = false;
{ // scope for memberSlot
double& memberSlot = RawSetAsDouble();
if (!ValueToPrimitive<double, eDefault>(cx, value, "Double branch of (double or AutoKeyword)", &memberSlot)) {
return false;
} else if (!std::isfinite(memberSlot)) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Double branch of (double or AutoKeyword)");
return false;
}
}
return true;
}
bool
DoubleOrAutoKeyword::TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return TrySetToDouble(cx, value, tryNext, passedToJSImpl);
}
bool
DoubleOrAutoKeyword::TrySetToAutoKeyword(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
tryNext = false;
{ // scope for memberSlot
AutoKeyword& memberSlot = RawSetAsAutoKeyword();
{
int index;
if (!binding_detail::FindEnumStringIndex<true>(cx, value,
binding_detail::EnumStrings<AutoKeyword>::Values,
"AutoKeyword", "AutoKeyword branch of (double or AutoKeyword)",
&index)) {
return false;
}
MOZ_ASSERT(index >= 0);
memberSlot = static_cast<AutoKeyword>(index);
}
}
return true;
}
bool
DoubleOrAutoKeyword::TrySetToAutoKeyword(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return TrySetToAutoKeyword(cx, value, tryNext, passedToJSImpl);
}
bool
DoubleOrAutoKeyword::Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription, bool passedToJSImpl)
{
MOZ_ASSERT(mType == eUninitialized);
bool done = false, failed = false, tryNext;
do {
if (value.isNumber()) {
done = (failed = !TrySetToDouble(cx, value, tryNext)) || !tryNext;
break;
}
done = (failed = !TrySetToAutoKeyword(cx, value, tryNext)) || !tryNext;
break;
} while (false);
if (failed) {
return false;
}
if (!done) {
cx.ThrowErrorMessage<MSG_NOT_IN_UNION>(sourceDescription, "");
return false;
}
return true;
}
bool
DoubleOrAutoKeyword::Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return Init(cx, value, sourceDescription, passedToJSImpl);
}
bool
DoubleOrAutoKeyword::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
{
switch (mType) {
case eUninitialized: {
return false;
}
case eDouble: {
rval.set(JS_NumberValue(double(mValue.mDouble.Value())));
return true;
}
case eAutoKeyword: {
if (!ToJSValue(cx, mValue.mAutoKeyword.Value(), rval)) {
return false;
}
return true;
}
default: {
return false;
}
}
}
OwningDoubleOrAutoKeyword::OwningDoubleOrAutoKeyword(OwningDoubleOrAutoKeyword&& aOther)
: mType(eUninitialized)
{
switch (aOther.mType) {
case eUninitialized: {
MOZ_ASSERT(mType == eUninitialized,
"We need to destroy ourselves?");
break;
}
case eDouble: {
mType = eDouble;
mValue.mDouble.SetValue(std::move(aOther.mValue.mDouble.Value()));
break;
}
case eAutoKeyword: {
mType = eAutoKeyword;
mValue.mAutoKeyword.SetValue(std::move(aOther.mValue.mAutoKeyword.Value()));
break;
}
}
}
bool
OwningDoubleOrAutoKeyword::TrySetToDouble(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
tryNext = false;
{ // scope for memberSlot
double& memberSlot = RawSetAsDouble();
if (!ValueToPrimitive<double, eDefault>(cx, value, "Double branch of (double or AutoKeyword)", &memberSlot)) {
return false;
} else if (!std::isfinite(memberSlot)) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Double branch of (double or AutoKeyword)");
return false;
}
}
return true;
}
bool
OwningDoubleOrAutoKeyword::TrySetToDouble(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return TrySetToDouble(cx, value, tryNext, passedToJSImpl);
}
[[nodiscard]] double&
OwningDoubleOrAutoKeyword::RawSetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eDouble;
return mValue.mDouble.SetValue();
}
[[nodiscard]] double&
OwningDoubleOrAutoKeyword::SetAsDouble()
{
if (mType == eDouble) {
return mValue.mDouble.Value();
}
Uninit();
mType = eDouble;
return mValue.mDouble.SetValue();
}
void
OwningDoubleOrAutoKeyword::DestroyDouble()
{
MOZ_RELEASE_ASSERT(IsDouble(), "Wrong type!");
mValue.mDouble.Destroy();
mType = eUninitialized;
}
bool
OwningDoubleOrAutoKeyword::TrySetToAutoKeyword(BindingCallContext& cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
tryNext = false;
{ // scope for memberSlot
AutoKeyword& memberSlot = RawSetAsAutoKeyword();
{
int index;
if (!binding_detail::FindEnumStringIndex<true>(cx, value,
binding_detail::EnumStrings<AutoKeyword>::Values,
"AutoKeyword", "AutoKeyword branch of (double or AutoKeyword)",
&index)) {
return false;
}
MOZ_ASSERT(index >= 0);
memberSlot = static_cast<AutoKeyword>(index);
}
}
return true;
}
bool
OwningDoubleOrAutoKeyword::TrySetToAutoKeyword(JSContext* cx_, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return TrySetToAutoKeyword(cx, value, tryNext, passedToJSImpl);
}
[[nodiscard]] AutoKeyword&
OwningDoubleOrAutoKeyword::RawSetAsAutoKeyword()
{
if (mType == eAutoKeyword) {
return mValue.mAutoKeyword.Value();
}
MOZ_ASSERT(mType == eUninitialized);
mType = eAutoKeyword;
return mValue.mAutoKeyword.SetValue();
}
[[nodiscard]] AutoKeyword&
OwningDoubleOrAutoKeyword::SetAsAutoKeyword()
{
if (mType == eAutoKeyword) {
return mValue.mAutoKeyword.Value();
}
Uninit();
mType = eAutoKeyword;
return mValue.mAutoKeyword.SetValue();
}
void
OwningDoubleOrAutoKeyword::DestroyAutoKeyword()
{
MOZ_RELEASE_ASSERT(IsAutoKeyword(), "Wrong type!");
mValue.mAutoKeyword.Destroy();
mType = eUninitialized;
}
bool
OwningDoubleOrAutoKeyword::Init(BindingCallContext& cx, JS::Handle<JS::Value> value, const char* sourceDescription, bool passedToJSImpl)
{
MOZ_ASSERT(mType == eUninitialized);
bool done = false, failed = false, tryNext;
do {
if (value.isNumber()) {
done = (failed = !TrySetToDouble(cx, value, tryNext)) || !tryNext;
break;
}
done = (failed = !TrySetToAutoKeyword(cx, value, tryNext)) || !tryNext;
break;
} while (false);
if (failed) {
return false;
}
if (!done) {
cx.ThrowErrorMessage<MSG_NOT_IN_UNION>(sourceDescription, "");
return false;
}
return true;
}
bool
OwningDoubleOrAutoKeyword::Init(JSContext* cx_, JS::Handle<JS::Value> value, const char* sourceDescription, bool passedToJSImpl)
{
BindingCallContext cx(cx_, nullptr);
return Init(cx, value, sourceDescription, passedToJSImpl);
}
void
OwningDoubleOrAutoKeyword::Uninit()
{
switch (mType) {
case eUninitialized: {
break;
}
case eDouble: {
DestroyDouble();
break;
}
case eAutoKeyword: {
DestroyAutoKeyword();
break;
}
}
}
bool
OwningDoubleOrAutoKeyword::ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const
{
switch (mType) {
case eUninitialized: {
return false;
}
case eDouble: {
rval.set(JS_NumberValue(double(mValue.mDouble.Value())));
return true;
}
case eAutoKeyword: {
if (!ToJSValue(cx, mValue.mAutoKeyword.Value(), rval)) {
return false;
}
return true;
}
default: {
return false;
}
}
}
OwningDoubleOrAutoKeyword&
OwningDoubleOrAutoKeyword::operator=(OwningDoubleOrAutoKeyword&& aOther)
{
this->~OwningDoubleOrAutoKeyword();
new (this) OwningDoubleOrAutoKeyword (std::move(aOther));
return *this;
}
OwningDoubleOrAutoKeyword&
OwningDoubleOrAutoKeyword::operator=(const OwningDoubleOrAutoKeyword& aOther)
{
switch (aOther.mType) {
case eUninitialized: {
MOZ_ASSERT(mType == eUninitialized,
"We need to destroy ourselves?");
break;
}
case eDouble: {
SetAsDouble() = aOther.GetAsDouble();
break;
}
case eAutoKeyword: {
SetAsAutoKeyword() = aOther.GetAsAutoKeyword();
break;
}
}
return *this;
}
namespace VTTCue_Binding {
static_assert(IsRefcounted<NativeType>::value == IsRefcounted<TextTrackCue_Binding::NativeType>::value,
"Can't inherit from an interface with a different ownership model.");
MOZ_CAN_RUN_SCRIPT static bool
get_region(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "region", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
auto result(StrongOrRawPtr<mozilla::dom::TextTrackRegion>(MOZ_KnownLive(self)->GetRegion()));
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_region(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.region setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "region", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
mozilla::dom::TextTrackRegion* arg0;
if (args[0].isObject()) {
{
// Our JSContext should be in the right global to do unwrapping in.
nsresult rv = UnwrapObject<prototypes::id::VTTRegion, mozilla::dom::TextTrackRegion>(args[0], arg0, cx);
if (NS_FAILED(rv)) {
cx.ThrowErrorMessage<MSG_DOES_NOT_IMPLEMENT_INTERFACE>("Value being assigned", "VTTRegion");
return false;
}
}
} else if (args[0].isNullOrUndefined()) {
arg0 = nullptr;
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Value being assigned");
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetRegion(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here");
MOZ_KnownLive(self)->SetRegion(MOZ_KnownLive(Constify(arg0)));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo region_getterinfo = {
{ get_region },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 region_setterinfo = {
{ (JSJitGetterOp)set_region },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_vertical(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "vertical", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
DirectionSetting result(MOZ_KnownLive(self)->Vertical());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!ToJSValue(cx, result, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_vertical(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.vertical setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "vertical", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
DirectionSetting arg0;
{
int index;
if (!binding_detail::FindEnumStringIndex<false>(cx, args[0],
binding_detail::EnumStrings<DirectionSetting>::Values,
"DirectionSetting", "value being assigned",
&index)) {
return false;
}
if (index < 0) {
return true;
}
arg0 = static_cast<DirectionSetting>(index);
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetVertical(arg0))>, "Should be returning void here");
MOZ_KnownLive(self)->SetVertical(arg0);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo vertical_getterinfo = {
{ get_vertical },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 vertical_setterinfo = {
{ (JSJitGetterOp)set_vertical },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_snapToLines(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "snapToLines", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
bool result(MOZ_KnownLive(self)->SnapToLines());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setBoolean(result);
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_snapToLines(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "snapToLines", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
bool arg0;
if (!ValueToPrimitive<bool, eDefault>(cx, args[0], "Value being assigned", &arg0)) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetSnapToLines(arg0))>, "Should be returning void here");
MOZ_KnownLive(self)->SetSnapToLines(arg0);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo snapToLines_getterinfo = {
{ get_snapToLines },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 snapToLines_setterinfo = {
{ (JSJitGetterOp)set_snapToLines },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_line(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "line", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
OwningDoubleOrAutoKeyword result;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->GetLine(result))>, "Should be returning void here");
MOZ_KnownLive(self)->GetLine(result);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!result.ToJSVal(cx, obj, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_line(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.line setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "line", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
DoubleOrAutoKeyword arg0;
if (!arg0.Init(cx, args[0], "Value being assigned", false)) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetLine(Constify(arg0)))>, "Should be returning void here");
MOZ_KnownLive(self)->SetLine(Constify(arg0));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo line_getterinfo = {
{ get_line },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 line_setterinfo = {
{ (JSJitGetterOp)set_line },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_lineAlign(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "lineAlign", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
LineAlignSetting result(MOZ_KnownLive(self)->LineAlign());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!ToJSValue(cx, result, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_lineAlign(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.lineAlign setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "lineAlign", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
LineAlignSetting arg0;
{
int index;
if (!binding_detail::FindEnumStringIndex<false>(cx, args[0],
binding_detail::EnumStrings<LineAlignSetting>::Values,
"LineAlignSetting", "value being assigned",
&index)) {
return false;
}
if (index < 0) {
return true;
}
arg0 = static_cast<LineAlignSetting>(index);
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetLineAlign(arg0, rv))>, "Should be returning void here");
MOZ_KnownLive(self)->SetLineAlign(arg0, rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "VTTCue.lineAlign setter"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo lineAlign_getterinfo = {
{ get_lineAlign },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 lineAlign_setterinfo = {
{ (JSJitGetterOp)set_lineAlign },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::Depth },
JSJitInfo::Setter,
JSJitInfo::AliasEverything, /* aliasSet. Not relevant for setters. */
JSVAL_TYPE_UNDEFINED, /* returnType. Not relevant for setters. */
false, /* isInfallible. False in setters. */
false, /* isMovable. Not relevant for setters. */
false, /* isEliminatable. Not relevant for setters. */
false, /* isAlwaysInSlot. Only relevant for getters. */
false, /* isLazilyCachedInSlot. Only relevant for getters. */
false, /* isTypedMethod. Only relevant for methods. */
0 /* Reserved slot index, if we're stored in a slot, else 0. */
};
MOZ_CAN_RUN_SCRIPT static bool
get_position(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "position", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
OwningDoubleOrAutoKeyword result;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->GetPosition(result))>, "Should be returning void here");
MOZ_KnownLive(self)->GetPosition(result);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!result.ToJSVal(cx, obj, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_position(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.position setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "position", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
DoubleOrAutoKeyword arg0;
if (!arg0.Init(cx, args[0], "Value being assigned", false)) {
return false;
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetPosition(Constify(arg0), rv))>, "Should be returning void here");
MOZ_KnownLive(self)->SetPosition(Constify(arg0), rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "VTTCue.position setter"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo position_getterinfo = {
{ get_position },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 position_setterinfo = {
{ (JSJitGetterOp)set_position },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_positionAlign(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "positionAlign", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
PositionAlignSetting result(MOZ_KnownLive(self)->PositionAlign());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!ToJSValue(cx, result, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_positionAlign(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.positionAlign setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "positionAlign", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
PositionAlignSetting arg0;
{
int index;
if (!binding_detail::FindEnumStringIndex<false>(cx, args[0],
binding_detail::EnumStrings<PositionAlignSetting>::Values,
"PositionAlignSetting", "value being assigned",
&index)) {
return false;
}
if (index < 0) {
return true;
}
arg0 = static_cast<PositionAlignSetting>(index);
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetPositionAlign(arg0, rv))>, "Should be returning void here");
MOZ_KnownLive(self)->SetPositionAlign(arg0, rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "VTTCue.positionAlign setter"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo positionAlign_getterinfo = {
{ get_positionAlign },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 positionAlign_setterinfo = {
{ (JSJitGetterOp)set_positionAlign },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_size(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "size", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
double result(MOZ_KnownLive(self)->Size());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().set(JS_NumberValue(double(result)));
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_size(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.size setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "size", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
double arg0;
if (!ValueToPrimitive<double, eDefault>(cx, args[0], "Value being assigned", &arg0)) {
return false;
} else if (!std::isfinite(arg0)) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Value being assigned");
return false;
}
FastErrorResult rv;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetSize(arg0, rv))>, "Should be returning void here");
MOZ_KnownLive(self)->SetSize(arg0, rv);
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "VTTCue.size setter"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo size_getterinfo = {
{ get_size },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 size_setterinfo = {
{ (JSJitGetterOp)set_size },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_align(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "align", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
AlignSetting result(MOZ_KnownLive(self)->Align());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!ToJSValue(cx, result, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_align(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.align setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "align", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
AlignSetting arg0;
{
int index;
if (!binding_detail::FindEnumStringIndex<false>(cx, args[0],
binding_detail::EnumStrings<AlignSetting>::Values,
"AlignSetting", "value being assigned",
&index)) {
return false;
}
if (index < 0) {
return true;
}
arg0 = static_cast<AlignSetting>(index);
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetAlign(arg0))>, "Should be returning void here");
MOZ_KnownLive(self)->SetAlign(arg0);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo align_getterinfo = {
{ get_align },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 align_setterinfo = {
{ (JSJitGetterOp)set_align },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_text(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "text", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
DOMString result;
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->GetText(result))>, "Should be returning void here");
MOZ_KnownLive(self)->GetText(result);
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!xpc::NonVoidStringToJsval(cx, result, args.rval())) {
return false;
}
return true;
}
MOZ_CAN_RUN_SCRIPT static bool
set_text(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "text", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
binding_detail::FakeString<char16_t> arg0;
if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) {
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetText(NonNullHelper(Constify(arg0))))>, "Should be returning void here");
MOZ_KnownLive(self)->SetText(NonNullHelper(Constify(arg0)));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo text_getterinfo = {
{ get_text },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 text_setterinfo = {
{ (JSJitGetterOp)set_text },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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
getCueAsHTML(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, const JSJitMethodCallArgs& args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "getCueAsHTML", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
auto result(StrongOrRawPtr<mozilla::dom::DocumentFragment>(MOZ_KnownLive(self)->GetCueAsHTML()));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!GetOrCreateDOMReflector(cx, result, args.rval())) {
MOZ_ASSERT(JS_IsExceptionPending(cx));
return false;
}
return true;
}
static const JSJitInfo getCueAsHTML_methodinfo = {
{ (JSJitGetterOp)getCueAsHTML },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_displayState(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "displayState", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
auto result(StrongOrRawPtr<mozilla::dom::HTMLDivElement>(MOZ_KnownLive(self)->GetDisplayState()));
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_displayState(JSContext* cx_, JS::Handle<JSObject*> obj, void* void_self, JSJitSetterCallArgs args)
{
BindingCallContext cx(cx_, "VTTCue.displayState setter");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "displayState", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
mozilla::dom::HTMLDivElement* arg0;
if (args[0].isObject()) {
{
// Our JSContext should be in the right global to do unwrapping in.
nsresult rv = UnwrapObject<prototypes::id::HTMLDivElement, mozilla::dom::HTMLDivElement>(args[0], arg0, cx);
if (NS_FAILED(rv)) {
cx.ThrowErrorMessage<MSG_DOES_NOT_IMPLEMENT_INTERFACE>("Value being assigned", "HTMLDivElement");
return false;
}
}
} else if (args[0].isNullOrUndefined()) {
arg0 = nullptr;
} else {
cx.ThrowErrorMessage<MSG_NOT_OBJECT>("Value being assigned");
return false;
}
// NOTE: This assert does NOT call the function.
static_assert(std::is_void_v<decltype(MOZ_KnownLive(self)->SetDisplayState(MOZ_KnownLive(Constify(arg0))))>, "Should be returning void here");
MOZ_KnownLive(self)->SetDisplayState(MOZ_KnownLive(Constify(arg0)));
MOZ_ASSERT(!JS_IsExceptionPending(cx));
return true;
}
static const JSJitInfo displayState_getterinfo = {
{ get_displayState },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 displayState_setterinfo = {
{ (JSJitGetterOp)set_displayState },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_hasBeenReset(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "hasBeenReset", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
bool result(MOZ_KnownLive(self)->HasBeenReset());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setBoolean(result);
return true;
}
static const JSJitInfo hasBeenReset_getterinfo = {
{ get_hasBeenReset },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_computedLine(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "computedLine", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
double result(MOZ_KnownLive(self)->ComputedLine());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().set(JS_NumberValue(double(result)));
return true;
}
static const JSJitInfo computedLine_getterinfo = {
{ get_computedLine },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_computedPosition(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "computedPosition", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
double result(MOZ_KnownLive(self)->ComputedPosition());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().set(JS_NumberValue(double(result)));
return true;
}
static const JSJitInfo computedPosition_getterinfo = {
{ get_computedPosition },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_computedPositionAlign(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "computedPositionAlign", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
PositionAlignSetting result(MOZ_KnownLive(self)->ComputedPositionAlign());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
if (!ToJSValue(cx, result, args.rval())) {
return false;
}
return true;
}
static const JSJitInfo computedPositionAlign_getterinfo = {
{ get_computedPositionAlign },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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_getActive(JSContext* cx, JS::Handle<JSObject*> obj, void* void_self, JSJitGetterCallArgs args)
{
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "getActive", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) |
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
auto* self = static_cast<mozilla::dom::TextTrackCue*>(void_self);
bool result(MOZ_KnownLive(self)->GetActive());
MOZ_ASSERT(!JS_IsExceptionPending(cx));
args.rval().setBoolean(result);
return true;
}
static const JSJitInfo getActive_getterinfo = {
{ get_getActive },
{ prototypes::id::VTTCue },
{ PrototypeTraits<prototypes::id::VTTCue>::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 bool
_addProperty(JSContext* cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::Handle<JS::Value> val)
{
mozilla::dom::TextTrackCue* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackCue>(obj);
// We don't want to preserve if we don't have a wrapper, and we
// obviously can't preserve if we're not initialized.
if (self && self->GetWrapperPreserveColor()) {
PreserveWrapper(self);
}
return true;
}
static void
_finalize(JS::GCContext* gcx, JSObject* obj)
{
mozilla::dom::TextTrackCue* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackCue>(obj);
if (self) {
JS::SetReservedSlot(obj, DOM_OBJECT_SLOT, JS::UndefinedValue());
ClearWrapper(self, self, obj);
if (size_t mallocBytes = BindingJSObjectMallocBytes(self)) {
JS::RemoveAssociatedMemory(obj, mallocBytes,
JS::MemoryUse::DOMBinding);
}
AddForDeferredFinalization<mozilla::dom::TextTrackCue>(self);
}
}
static nsWrapperCache*
_getWrapperCache(JS::Handle<JSObject*> obj)
{
mozilla::dom::TextTrackCue* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackCue>(obj);
return self;
}
static size_t
_objectMoved(JSObject* obj, JSObject* old)
{
mozilla::dom::TextTrackCue* self = UnwrapPossiblyNotInitializedDOMObject<mozilla::dom::TextTrackCue>(obj);
if (self) {
UpdateWrapper(self, self, obj, old);
}
return 0;
}
static const JSFunctionSpec sMethods_specs[] = {
JS_FNSPEC("getCueAsHTML", (GenericMethod<NormalThisPolicy, ThrowExceptions>), reinterpret_cast<const JSJitInfo*>(&getCueAsHTML_methodinfo), 0, JSPROP_ENUMERATE, nullptr),
JS_FS_END
};
static const Prefable<const JSFunctionSpec> sMethods[] = {
{ nullptr, &sMethods_specs[0] },
{ nullptr, nullptr }
};
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
"We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
"We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
static const JSPropertySpec sAttributes_specs[] = {
JSPropertySpec::nativeAccessors("region", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &region_getterinfo, GenericSetter<NormalThisPolicy>, &region_setterinfo),
JSPropertySpec::nativeAccessors("vertical", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &vertical_getterinfo, GenericSetter<NormalThisPolicy>, &vertical_setterinfo),
JSPropertySpec::nativeAccessors("snapToLines", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &snapToLines_getterinfo, GenericSetter<NormalThisPolicy>, &snapToLines_setterinfo),
JSPropertySpec::nativeAccessors("line", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &line_getterinfo, GenericSetter<NormalThisPolicy>, &line_setterinfo),
JSPropertySpec::nativeAccessors("lineAlign", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &lineAlign_getterinfo, GenericSetter<NormalThisPolicy>, &lineAlign_setterinfo),
JSPropertySpec::nativeAccessors("position", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &position_getterinfo, GenericSetter<NormalThisPolicy>, &position_setterinfo),
JSPropertySpec::nativeAccessors("positionAlign", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &positionAlign_getterinfo, GenericSetter<NormalThisPolicy>, &positionAlign_setterinfo),
JSPropertySpec::nativeAccessors("size", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &size_getterinfo, GenericSetter<NormalThisPolicy>, &size_setterinfo),
JSPropertySpec::nativeAccessors("align", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &align_getterinfo, GenericSetter<NormalThisPolicy>, &align_setterinfo),
JSPropertySpec::nativeAccessors("text", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &text_getterinfo, GenericSetter<NormalThisPolicy>, &text_setterinfo),
JS_PS_END
};
static const Prefable<const JSPropertySpec> sAttributes[] = {
{ nullptr, &sAttributes_specs[0] },
{ nullptr, nullptr }
};
static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX,
"We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)");
static_assert(10 <= 1ull << NUM_BITS_PROPERTY_INFO_SPEC_INDEX,
"We have a spec index that is >= (1 << NUM_BITS_PROPERTY_INFO_SPEC_INDEX)");
static const JSPropertySpec sChromeAttributes_specs[] = {
JSPropertySpec::nativeAccessors("displayState", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &displayState_getterinfo, GenericSetter<NormalThisPolicy>, &displayState_setterinfo),
JSPropertySpec::nativeAccessors("hasBeenReset", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &hasBeenReset_getterinfo, nullptr, nullptr),
JSPropertySpec::nativeAccessors("computedLine", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &computedLine_getterinfo, nullptr, nullptr),
JSPropertySpec::nativeAccessors("computedPosition", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &computedPosition_getterinfo, nullptr, nullptr),
JSPropertySpec::nativeAccessors("computedPositionAlign", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &computedPositionAlign_getterinfo, nullptr, nullptr),
JSPropertySpec::nativeAccessors("getActive", JSPROP_ENUMERATE, GenericGetter<NormalThisPolicy, ThrowExceptions>, &getActive_getterinfo, nullptr, nullptr),
JS_PS_END
};
static const Prefable<const JSPropertySpec> 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(6 <= 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[11];
static PropertyInfo sNativeProperties_propertyInfos[11];
static const NativePropertiesN<2> sNativeProperties = {
false, 0,
false, 0,
true, 0 /* sMethods */,
true, 1 /* sAttributes */,
false, 0,
false, 0,
false, 0,
-1,
11,
sNativeProperties_sortedPropertyIndices,
{
{ sMethods, &sNativeProperties_propertyInfos[0] },
{ sAttributes, &sNativeProperties_propertyInfos[1] }
}
};
static_assert(11 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)),
"We have a property info count that is oversized");
static uint16_t sChromeOnlyNativeProperties_sortedPropertyIndices[6];
static PropertyInfo sChromeOnlyNativeProperties_propertyInfos[6];
static const NativePropertiesN<1> sChromeOnlyNativeProperties = {
false, 0,
false, 0,
false, 0,
true, 0 /* sChromeAttributes */,
false, 0,
false, 0,
false, 0,
-1,
6,
sChromeOnlyNativeProperties_sortedPropertyIndices,
{
{ sChromeAttributes, &sChromeOnlyNativeProperties_propertyInfos[0] }
}
};
static_assert(6 < 1ull << (CHAR_BIT * sizeof(sChromeOnlyNativeProperties.propertyInfoCount)),
"We have a property info count that is oversized");
bool sNativePropertiesInited = false;
const NativePropertyHooks sNativePropertyHooks = {
nullptr,
{ sNativeProperties.Upcast(), sChromeOnlyNativeProperties.Upcast(), &sNativePropertiesInited },
prototypes::id::VTTCue,
constructors::id::VTTCue,
&DefaultXrayExpandoObjectClass
};
static bool
_constructor(JSContext* cx_, unsigned argc, JS::Value* vp)
{
BindingCallContext cx(cx_, "VTTCue constructor");
AUTO_PROFILER_LABEL_DYNAMIC_FAST(
"VTTCue", "constructor", DOM, cx,
uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS));
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
JS::Rooted<JSObject*> obj(cx, &args.callee());
if (!args.isConstructing()) {
return ThrowConstructorWithoutNew(cx, "VTTCue");
}
JS::Rooted<JSObject*> desiredProto(cx);
if (!GetDesiredProto(cx, args,
prototypes::id::VTTCue,
CreateInterfaceObjects,
&desiredProto)) {
return false;
}
if (!args.requireAtLeast(cx, "VTTCue constructor", 3)) {
return false;
}
GlobalObject global(cx, obj);
if (global.Failed()) {
return false;
}
bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj);
double arg0;
if (!ValueToPrimitive<double, eDefault>(cx, args[0], "Argument 1", &arg0)) {
return false;
} else if (!std::isfinite(arg0)) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Argument 1");
return false;
}
double arg1;
if (!ValueToPrimitive<double, eDefault>(cx, args[1], "Argument 2", &arg1)) {
return false;
} else if (!std::isfinite(arg1)) {
cx.ThrowErrorMessage<MSG_NOT_FINITE>("Argument 2");
return false;
}
binding_detail::FakeString<char16_t> arg2;
if (!ConvertJSValueToString(cx, args[2], eStringify, eStringify, arg2)) {
return false;
}
Maybe<JSAutoRealm> ar;
if (objIsXray) {
// Since our object is an Xray, we can just CheckedUnwrapStatic:
// we know Xrays have no dynamic unwrap behavior.
obj = js::CheckedUnwrapStatic(obj);
if (!obj) {
return false;
}
ar.emplace(cx, obj);
if (!JS_WrapObject(cx, &desiredProto)) {
return false;
}
}
FastErrorResult rv;
auto result(StrongOrRawPtr<mozilla::dom::TextTrackCue>(mozilla::dom::TextTrackCue::Constructor(global, arg0, arg1, NonNullHelper(Constify(arg2)), rv)));
if (MOZ_UNLIKELY(rv.MaybeSetPendingException(cx, "VTTCue constructor"))) {
return false;
}
MOZ_ASSERT(!JS_IsExceptionPending(cx));
static_assert(!std::is_pointer_v<decltype(result)>,
"NewObject implies that we need to keep the object alive with a strong reference.");
if (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) {
MOZ_ASSERT(JS_IsExceptionPending(cx));
return false;
}
return true;
}
static const DOMInterfaceInfo sInterfaceObjectInfo = {
{ _constructor, &sNativePropertyHooks },
TextTrackCue_Binding::GetConstructorObject,
prototypes::id::VTTCue,
PrototypeTraits<prototypes::id::VTTCue>::Depth,
true,
};
static const DOMIfaceAndProtoJSClass sPrototypeClass = {
{
"VTTCuePrototype",
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::VTTCue,
PrototypeTraits<prototypes::id::VTTCue>::Depth,
&sNativePropertyHooks,
TextTrackCue_Binding::GetProtoObject
};
static const JSClassOps sClassOps = {
_addProperty, /* addProperty */
nullptr, /* delProperty */
nullptr, /* enumerate */
nullptr, /* newEnumerate */
nullptr, /* resolve */
nullptr, /* mayResolve */
_finalize, /* finalize */
nullptr, /* call */
nullptr, /* construct */
nullptr, /* trace */
};
static const js::ClassExtension sClassExtension = {
_objectMoved /* objectMovedOp */
};
static const DOMJSClass sClass = {
{ "VTTCue",
JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1),
&sClassOps,
JS_NULL_CLASS_SPEC,
&sClassExtension,
JS_NULL_OBJECT_OPS
},
{ prototypes::id::EventTarget, prototypes::id::TextTrackCue, prototypes::id::VTTCue, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count },
std::is_base_of_v<nsISupports, mozilla::dom::TextTrackCue>,
&sNativePropertyHooks,
FindAssociatedGlobalForNative<mozilla::dom::TextTrackCue>::Get,
GetProtoObjectHandle,
GetCCParticipant<mozilla::dom::TextTrackCue>::Get(),
nullptr,
_getWrapperCache
};
static_assert(1 == DOM_INSTANCE_RESERVED_SLOTS,
"Must have the right minimal number of reserved slots.");
static_assert(1 >= 1,
"Must have enough reserved slots.");
bool
Wrap(JSContext* aCx, mozilla::dom::TextTrackCue* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector)
{
static_assert(!std::is_base_of_v<NonRefcountedDOMObject, mozilla::dom::TextTrackCue>,
"Shouldn't have wrappercached things that are not refcounted.");
static_assert(std::is_same_v<decltype(aObject), mozilla::dom::TextTrackCue*>);
MOZ_ASSERT(static_cast<mozilla::dom::TextTrackCue*>(aObject) ==
reinterpret_cast<mozilla::dom::TextTrackCue*>(aObject),
"Multiple inheritance for mozilla::dom::TextTrackCue is broken.");
MOZ_ASSERT(static_cast<mozilla::dom::EventTarget*>(aObject) ==
reinterpret_cast<mozilla::dom::EventTarget*>(aObject),
"Multiple inheritance for mozilla::dom::EventTarget is broken.");
MOZ_ASSERT(ToSupportsIsCorrect(aObject));
MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx));
MOZ_ASSERT(!aCache->GetWrapper(),
"You should probably not be using Wrap() directly; use "
"GetOrCreateDOMReflector instead");
MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache),
"nsISupports must be on our primary inheritance chain");
// If the wrapper cache contains a dead reflector then finalize that
// now, ensuring that the finalizer for the old reflector always
// runs before the new reflector is created and attached. This
// avoids the awkward situation where there are multiple reflector
// objects that contain pointers to the same native.
if (JSObject* oldReflector = aCache->GetWrapperMaybeDead()) {
_finalize(nullptr /* unused */, oldReflector);
MOZ_ASSERT(!aCache->GetWrapperMaybeDead());
}
JS::Rooted<JSObject*> global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject()));
if (!global) {
return false;
}
MOZ_ASSERT(JS_IsGlobalObject(global));
JS::AssertObjectIsNotGray(global);
// That might have ended up wrapping us already, due to the wonders
// of XBL. Check for that, and bail out as needed.
aReflector.set(aCache->GetWrapper());
if (aReflector) {
#ifdef DEBUG
AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto);
#endif // DEBUG
return true;
}
JSAutoRealm ar(aCx, global);
JS::Handle<JSObject*> canonicalProto = GetProtoObjectHandle(aCx);
if (!canonicalProto) {
return false;
}
JS::Rooted<JSObject*> proto(aCx);
if (aGivenProto) {
proto = aGivenProto;
// Unfortunately, while aGivenProto was in the compartment of aCx
// coming in, we changed compartments to that of "parent" so may need
// to wrap the proto here.
if (js::GetContextCompartment(aCx) != JS::GetCompartment(proto)) {
if (!JS_WrapObject(aCx, &proto)) {
return false;
}
}
} else {
proto = canonicalProto;
}
BindingJSObjectCreator<mozilla::dom::TextTrackCue> creator(aCx);
creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector);
if (!aReflector) {
return false;
}
aCache->SetWrapper(aReflector);
creator.InitializationSucceeded();
MOZ_ASSERT(aCache->GetWrapperPreserveColor() &&
aCache->GetWrapperPreserveColor() == aReflector);
// If proto != canonicalProto, we have to preserve our wrapper;
// otherwise we won't be able to properly recreate it later, since
// we won't know what proto to use. Note that we don't check
// aGivenProto here, since it's entirely possible (and even
// somewhat common) to have a non-null aGivenProto which is the
// same as canonicalProto.
if (proto != canonicalProto) {
PreserveWrapper(aObject);
}
return true;
}
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal)
{
JS::Heap<JSObject*>* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::VTTCue);
JS::Heap<JSObject*>* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::VTTCue);
JS::Handle<JSObject*> parentProto(TextTrackCue_Binding::GetProtoObjectHandle(aCx));
if (!parentProto) {
return;
}
JS::Handle<JSObject*> constructorProto(TextTrackCue_Binding::GetConstructorObjectHandle(aCx));
if (!constructorProto) {
return;
}
dom::CreateInterfaceObjects(aCx, aGlobal, parentProto,
&sPrototypeClass, protoCache,
constructorProto, &sInterfaceObjectInfo, 3, false, Span<const LegacyFactoryFunction, 0>{},
interfaceCache,
sNativeProperties.Upcast(),
sChromeOnlyNativeProperties.Upcast(),
"VTTCue", aDefineOnGlobal,
nullptr,
false,
nullptr);
}
JSObject*
GetConstructorObject(JSContext* aCx)
{
return GetConstructorObjectHandle(aCx);
}
} // namespace VTTCue_Binding
} // namespace dom
} // namespace mozilla