/* THIS FILE IS AUTOGENERATED FROM CSSMathValue.webidl BY Codegen.py - DO NOT EDIT */ #include #include "CSSMathValueBinding.h" #include "CSSNumericValueBinding.h" #include "MainThreadUtils.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/OwningNonNull.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/StaticPrefs_layout.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/CSSMathValue.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/XrayExpandoClass.h" namespace mozilla { namespace dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; namespace binding_detail { constexpr nsLiteralCString EnumStrings::Values[7]; } // namespace binding_detail bool ToJSValue(JSContext* aCx, CSSMathOperator aArgument, JS::MutableHandle aValue) { MOZ_ASSERT(uint32_t(aArgument) < std::size(binding_detail::EnumStrings::Values)); JSString* resultStr = JS_NewStringCopyN(aCx, binding_detail::EnumStrings::Values[uint32_t(aArgument)].BeginReading(), binding_detail::EnumStrings::Values[uint32_t(aArgument)].Length()); if (!resultStr) { return false; } aValue.setString(resultStr); return true; } namespace CSSMathValue_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_operator(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "CSSMathValue", "operator", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_GETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); CSSMathOperator result(MOZ_KnownLive(self)->Operator()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!ToJSValue(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo operator_getterinfo = { { get_operator }, { prototypes::id::CSSMathValue }, { 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_GLOBINIT static const JSPropertySpec sAttributes_specs[] = { JSPropertySpec::nativeAccessors("operator", JSPROP_ENUMERATE, GenericGetter, &operator_getterinfo, nullptr, nullptr), JS_PS_END }; static const Prefable sAttributes[] = { { nullptr, &sAttributes_specs[0] }, { nullptr, nullptr } }; static_assert(1 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(1 <= 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[1]; static PropertyInfo sNativeProperties_propertyInfos[1]; static const NativePropertiesN<1> sNativeProperties = { false, 0, false, 0, false, 0, true, 0 /* sAttributes */, false, 0, false, 0, false, 0, -1, 1, sNativeProperties_sortedPropertyIndices, { { sAttributes, &sNativeProperties_propertyInfos[0] } } }; static_assert(1 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)), "We have a property info count that is oversized"); bool sNativePropertiesInited = false; const NativePropertyHooks sNativePropertyHooks = { nullptr, { sNativeProperties.Upcast(), nullptr, &sNativePropertiesInited }, prototypes::id::CSSMathValue, constructors::id::CSSMathValue, &DefaultXrayExpandoObjectClass }; static const DOMInterfaceInfo sInterfaceObjectInfo = { { ThrowingConstructor, &sNativePropertyHooks }, CSSNumericValue_Binding::GetConstructorObjectHandle, PrototypeTraits::Depth, prototypes::id::CSSMathValue, true, 0, "CSSMathValue", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "CSSMathValuePrototype", 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::CSSMathValue, PrototypeTraits::Depth, &sNativePropertyHooks, CSSNumericValue_Binding::GetProtoObject }; bool ConstructorEnabled(JSContext* aCx, JS::Handle aObj) { return StaticPrefs::layout_css_typed_om_enabled(); } void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::CSSMathValue); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::CSSMathValue); JS::Handle parentProto(CSSNumericValue_Binding::GetProtoObjectHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(CSSNumericValue_Binding::GetConstructorObjectHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), nullptr, "CSSMathValue", ShouldExpose(aCx, aGlobal, aDefineOnGlobal), 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::CSSMathValue, &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::CSSMathValue, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace CSSMathValue_Binding } // namespace dom } // namespace mozilla