/* THIS FILE IS AUTOGENERATED FROM DOMMatrix.webidl BY Codegen.py - DO NOT EDIT */ #include #include "AtomList.h" #include "DOMMatrixBinding.h" #include "DOMPointBinding.h" #include "MainThreadUtils.h" #include "WrapperFactory.h" #include "js/Array.h" #include "js/CallAndConstruct.h" #include "js/Exception.h" #include "js/ForOfIterator.h" #include "js/MapAndSet.h" #include "js/Object.h" #include "js/PropertyAndElement.h" #include "js/PropertyDescriptor.h" #include "js/experimental/JitInfo.h" #include "jsfriendapi.h" #include "mozilla/Atomics.h" #include "mozilla/OwningNonNull.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/dom/BindingCallContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/DOMMatrix.h" #include "mozilla/dom/DOMPoint.h" #include "mozilla/dom/NonRefcountedDOMObject.h" #include "mozilla/dom/PrimitiveConversions.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/StructuredCloneTags.h" #include "mozilla/dom/TypedArray.h" #include "mozilla/dom/WebIDLPrefs.h" #include "mozilla/dom/XrayExpandoClass.h" namespace mozilla::dom { namespace binding_detail {}; // Just to make sure it's known as a namespace using namespace mozilla::dom::binding_detail; void ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aUnion, const char* aName, uint32_t aFlags) { if (aUnion.IsDOMMatrixReadOnly()) { ImplCycleCollectionTraverse(aCallback, aUnion.GetAsDOMMatrixReadOnly(), "mDOMMatrixReadOnly", aFlags); } } void ImplCycleCollectionUnlink(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aUnion) { aUnion.Uninit(); } DOMMatrix2DInit::DOMMatrix2DInit() { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool DOMMatrix2DInit::InitIds(JSContext* cx, DOMMatrix2DInitAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->m42_id.init(cx, "m42") || !atomsCache->m41_id.init(cx, "m41") || !atomsCache->m22_id.init(cx, "m22") || !atomsCache->m21_id.init(cx, "m21") || !atomsCache->m12_id.init(cx, "m12") || !atomsCache->m11_id.init(cx, "m11") || !atomsCache->f_id.init(cx, "f") || !atomsCache->e_id.init(cx, "e") || !atomsCache->d_id.init(cx, "d") || !atomsCache->c_id.init(cx, "c") || !atomsCache->b_id.init(cx, "b") || !atomsCache->a_id.init(cx, "a")) { return false; } return true; } bool DOMMatrix2DInit::Init(BindingCallContext& cx, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // Passing a null JSContext is OK only if we're initing from null, // Since in that case we will not have to do any property gets // Also evaluate isNullOrUndefined in order to avoid false-positive // checkers by static analysis tools MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); DOMMatrix2DInitAtoms* atomsCache = nullptr; if (cx) { atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } } if (!IsConvertibleToDictionary(val)) { return cx.ThrowErrorMessage(sourceDescription, "dictionary"); } bool isNull = val.isNullOrUndefined(); // We only need these if !isNull, in which case we have |cx|. Maybe > object; Maybe > temp; if (!isNull) { MOZ_ASSERT(cx); object.emplace(cx, &val.toObject()); temp.emplace(cx); } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->a_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mA.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'a' member of DOMMatrix2DInit", &(mA.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->b_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mB.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'b' member of DOMMatrix2DInit", &(mB.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->c_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mC.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'c' member of DOMMatrix2DInit", &(mC.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->d_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mD.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'d' member of DOMMatrix2DInit", &(mD.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->e_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mE.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'e' member of DOMMatrix2DInit", &(mE.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->f_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mF.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'f' member of DOMMatrix2DInit", &(mF.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m11_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM11.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m11' member of DOMMatrix2DInit", &(mM11.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m12_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM12.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m12' member of DOMMatrix2DInit", &(mM12.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m21_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM21.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m21' member of DOMMatrix2DInit", &(mM21.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m22_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM22.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m22' member of DOMMatrix2DInit", &(mM22.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m41_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM41.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m41' member of DOMMatrix2DInit", &(mM41.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m42_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mM42.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'m42' member of DOMMatrix2DInit", &(mM42.Value()))) { return false; } mIsAnyMemberPresent = true; } return true; } bool DOMMatrix2DInit::Init(JSContext* cx_, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // We don't want to use sourceDescription for our context here; // that's not really what it's formatted for. BindingCallContext cx(cx_, nullptr); return Init(cx, val, sourceDescription, passedToJSImpl); } void DOMMatrix2DInit::TraceDictionary(JSTracer* trc) { } DOMMatrix2DInit& DOMMatrix2DInit::operator=(const DOMMatrix2DInit& aOther) { MaybeEmptyDictionaryBase::operator=(aOther); mA.Reset(); if (aOther.mA.WasPassed()) { mA.Construct(aOther.mA.Value()); } mB.Reset(); if (aOther.mB.WasPassed()) { mB.Construct(aOther.mB.Value()); } mC.Reset(); if (aOther.mC.WasPassed()) { mC.Construct(aOther.mC.Value()); } mD.Reset(); if (aOther.mD.WasPassed()) { mD.Construct(aOther.mD.Value()); } mE.Reset(); if (aOther.mE.WasPassed()) { mE.Construct(aOther.mE.Value()); } mF.Reset(); if (aOther.mF.WasPassed()) { mF.Construct(aOther.mF.Value()); } mM11.Reset(); if (aOther.mM11.WasPassed()) { mM11.Construct(aOther.mM11.Value()); } mM12.Reset(); if (aOther.mM12.WasPassed()) { mM12.Construct(aOther.mM12.Value()); } mM21.Reset(); if (aOther.mM21.WasPassed()) { mM21.Construct(aOther.mM21.Value()); } mM22.Reset(); if (aOther.mM22.WasPassed()) { mM22.Construct(aOther.mM22.Value()); } mM41.Reset(); if (aOther.mM41.WasPassed()) { mM41.Construct(aOther.mM41.Value()); } mM42.Reset(); if (aOther.mM42.WasPassed()) { mM42.Construct(aOther.mM42.Value()); } return *this; } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUTF8String(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot nsAutoCString& memberSlot = RawSetAsUTF8String(); if (!ConvertJSValueToString(cx, value, eStringify, eStringify, memberSlot)) { return false; } } return true; } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUnrestrictedDoubleSequence(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot binding_detail::AutoSequence& memberSlot = RawSetAsUnrestrictedDoubleSequence(); JS::ForOfIterator iter(cx); if (!iter.init(value, JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { DestroyUnrestrictedDoubleSequence(); tryNext = true; return true; } binding_detail::AutoSequence &arr = memberSlot; if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } double* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } double& slot = *slotPtr; if (!ValueToPrimitive(cx, temp, "Element of sequence branch of (USVString or sequence or DOMMatrixReadOnly)", &slot)) { return false; } } } return true; } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUnrestrictedDoubleSequence(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToUnrestrictedDoubleSequence(cx, value, tryNext, passedToJSImpl); } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToDOMMatrixReadOnly(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot NonNull& memberSlot = RawSetAsDOMMatrixReadOnly(); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyDOMMatrixReadOnly(); tryNext = true; return true; } } } return true; } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToDOMMatrixReadOnly(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToDOMMatrixReadOnly(cx, value, tryNext, passedToJSImpl); } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (value.isObject()) { done = (failed = !TrySetToDOMMatrixReadOnly(cx, value, tryNext, passedToJSImpl)) || !tryNext; if (!done) { done = (failed = !TrySetToUnrestrictedDoubleSequence(cx, value, tryNext, passedToJSImpl)) || !tryNext; } } if (!done) { do { done = (failed = !TrySetToUTF8String(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "DOMMatrixReadOnly, sequence"); return false; } return true; } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } bool UTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::ToJSVal(JSContext* cx, JS::Handle scopeObj, JS::MutableHandle rval) const { switch (mType) { case eUninitialized: { return false; } case eUTF8String: { if (!NonVoidUTF8StringToJsval(cx, mValue.mUTF8String.Value(), rval)) { return false; } return true; } case eUnrestrictedDoubleSequence: { uint32_t length = mValue.mUnrestrictedDoubleSequence.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { tmp.set(JS::NumberValue(double(mValue.mUnrestrictedDoubleSequence.Value()[sequenceIdx0]))); break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } rval.setObject(*returnArray); return true; } case eDOMMatrixReadOnly: { if (!GetOrCreateDOMReflector(cx, mValue.mDOMMatrixReadOnly.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } default: { return false; } } } OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&& aOther) : mType(eUninitialized) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eUTF8String: { mType = eUTF8String; mValue.mUTF8String.SetValue(std::move(aOther.mValue.mUTF8String.Value())); break; } case eUnrestrictedDoubleSequence: { mType = eUnrestrictedDoubleSequence; mValue.mUnrestrictedDoubleSequence.SetValue(std::move(aOther.mValue.mUnrestrictedDoubleSequence.Value())); break; } case eDOMMatrixReadOnly: { mType = eDOMMatrixReadOnly; mValue.mDOMMatrixReadOnly.SetValue(std::move(aOther.mValue.mDOMMatrixReadOnly.Value())); break; } } } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUTF8String(JSContext* cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot nsCString& memberSlot = RawSetAsUTF8String(); if (!ConvertJSValueToString(cx, value, eStringify, eStringify, memberSlot)) { return false; } } return true; } [[nodiscard]] nsCString& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::RawSetAsUTF8String() { if (mType == eUTF8String) { return mValue.mUTF8String.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eUTF8String; return mValue.mUTF8String.SetValue(); } [[nodiscard]] nsCString& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::SetAsUTF8String() { if (mType == eUTF8String) { return mValue.mUTF8String.Value(); } Uninit(); mType = eUTF8String; return mValue.mUTF8String.SetValue(); } void OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::DestroyUTF8String() { MOZ_RELEASE_ASSERT(IsUTF8String(), "Wrong type!"); mValue.mUTF8String.Destroy(); mType = eUninitialized; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUnrestrictedDoubleSequence(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot Sequence& memberSlot = RawSetAsUnrestrictedDoubleSequence(); JS::ForOfIterator iter(cx); if (!iter.init(value, JS::ForOfIterator::AllowNonIterable)) { return false; } if (!iter.valueIsIterable()) { DestroyUnrestrictedDoubleSequence(); tryNext = true; return true; } Sequence &arr = memberSlot; if (mozilla::Maybe sizeHint = iter.sizeHint()) { if (!arr.SetCapacity(*sizeHint, mozilla::fallible)) { JS_ReportOutOfMemory(cx); return false; } } JS::Rooted temp(cx); while (true) { bool done; if (!iter.next(&temp, &done)) { return false; } if (done) { break; } double* slotPtr = arr.AppendElement(mozilla::fallible); if (!slotPtr) { JS_ReportOutOfMemory(cx); return false; } double& slot = *slotPtr; if (!ValueToPrimitive(cx, temp, "Element of sequence branch of (USVString or sequence or DOMMatrixReadOnly)", &slot)) { return false; } } } return true; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToUnrestrictedDoubleSequence(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToUnrestrictedDoubleSequence(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] Sequence& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::RawSetAsUnrestrictedDoubleSequence() { if (mType == eUnrestrictedDoubleSequence) { return mValue.mUnrestrictedDoubleSequence.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eUnrestrictedDoubleSequence; return mValue.mUnrestrictedDoubleSequence.SetValue(); } [[nodiscard]] Sequence& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::SetAsUnrestrictedDoubleSequence() { if (mType == eUnrestrictedDoubleSequence) { return mValue.mUnrestrictedDoubleSequence.Value(); } Uninit(); mType = eUnrestrictedDoubleSequence; return mValue.mUnrestrictedDoubleSequence.SetValue(); } void OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::DestroyUnrestrictedDoubleSequence() { MOZ_RELEASE_ASSERT(IsUnrestrictedDoubleSequence(), "Wrong type!"); mValue.mUnrestrictedDoubleSequence.Destroy(); mType = eUninitialized; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToDOMMatrixReadOnly(BindingCallContext& cx, JS::Handle value, bool& tryNext, bool passedToJSImpl) { tryNext = false; { // scope for memberSlot OwningNonNull& memberSlot = RawSetAsDOMMatrixReadOnly(); static_assert(IsRefcounted::value, "We can only store refcounted classes."); { // Our JSContext should be in the right global to do unwrapping in. nsresult rv = UnwrapObject(value, memberSlot, cx); if (NS_FAILED(rv)) { DestroyDOMMatrixReadOnly(); tryNext = true; return true; } } } return true; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::TrySetToDOMMatrixReadOnly(JSContext* cx_, JS::Handle value, bool& tryNext, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return TrySetToDOMMatrixReadOnly(cx, value, tryNext, passedToJSImpl); } [[nodiscard]] OwningNonNull& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::RawSetAsDOMMatrixReadOnly() { if (mType == eDOMMatrixReadOnly) { return mValue.mDOMMatrixReadOnly.Value(); } MOZ_ASSERT(mType == eUninitialized); mType = eDOMMatrixReadOnly; return mValue.mDOMMatrixReadOnly.SetValue(); } [[nodiscard]] OwningNonNull& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::SetAsDOMMatrixReadOnly() { if (mType == eDOMMatrixReadOnly) { return mValue.mDOMMatrixReadOnly.Value(); } Uninit(); mType = eDOMMatrixReadOnly; return mValue.mDOMMatrixReadOnly.SetValue(); } void OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::DestroyDOMMatrixReadOnly() { MOZ_RELEASE_ASSERT(IsDOMMatrixReadOnly(), "Wrong type!"); mValue.mDOMMatrixReadOnly.Destroy(); mType = eUninitialized; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::Init(BindingCallContext& cx, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { MOZ_ASSERT(mType == eUninitialized); bool done = false, failed = false, tryNext; if (value.isObject()) { done = (failed = !TrySetToDOMMatrixReadOnly(cx, value, tryNext, passedToJSImpl)) || !tryNext; if (!done) { done = (failed = !TrySetToUnrestrictedDoubleSequence(cx, value, tryNext, passedToJSImpl)) || !tryNext; } } if (!done) { do { done = (failed = !TrySetToUTF8String(cx, value, tryNext)) || !tryNext; break; } while (false); } if (failed) { return false; } if (!done) { cx.ThrowErrorMessage(sourceDescription, "DOMMatrixReadOnly, sequence"); return false; } return true; } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::Init(JSContext* cx_, JS::Handle value, const char* sourceDescription, bool passedToJSImpl) { BindingCallContext cx(cx_, nullptr); return Init(cx, value, sourceDescription, passedToJSImpl); } void OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::Uninit() { switch (mType) { case eUninitialized: { break; } case eUTF8String: { DestroyUTF8String(); break; } case eUnrestrictedDoubleSequence: { DestroyUnrestrictedDoubleSequence(); break; } case eDOMMatrixReadOnly: { DestroyDOMMatrixReadOnly(); break; } } } bool OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::ToJSVal(JSContext* cx, JS::Handle scopeObj, JS::MutableHandle rval) const { switch (mType) { case eUninitialized: { return false; } case eUTF8String: { if (!NonVoidUTF8StringToJsval(cx, mValue.mUTF8String.Value(), rval)) { return false; } return true; } case eUnrestrictedDoubleSequence: { uint32_t length = mValue.mUnrestrictedDoubleSequence.Value().Length(); JS::Rooted returnArray(cx, JS::NewArrayObject(cx, length)); if (!returnArray) { return false; } // Scope for 'tmp' { JS::Rooted tmp(cx); for (uint32_t sequenceIdx0 = 0; sequenceIdx0 < length; ++sequenceIdx0) { // Control block to let us common up the JS_DefineElement calls when there // are different ways to succeed at wrapping the object. do { tmp.set(JS::NumberValue(double(mValue.mUnrestrictedDoubleSequence.Value()[sequenceIdx0]))); break; } while (false); if (!JS_DefineElement(cx, returnArray, sequenceIdx0, tmp, JSPROP_ENUMERATE)) { return false; } } } rval.setObject(*returnArray); return true; } case eDOMMatrixReadOnly: { if (!GetOrCreateDOMReflector(cx, mValue.mDOMMatrixReadOnly.Value(), rval)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } default: { return false; } } } OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::operator=(OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly&& aOther) { this->~OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly(); new (this) OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly (std::move(aOther)); return *this; } OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly::operator=(const OwningUTF8StringOrUnrestrictedDoubleSequenceOrDOMMatrixReadOnly& aOther) { switch (aOther.mType) { case eUninitialized: { MOZ_ASSERT(mType == eUninitialized, "We need to destroy ourselves?"); break; } case eUTF8String: { SetAsUTF8String() = aOther.GetAsUTF8String(); break; } case eUnrestrictedDoubleSequence: { SetAsUnrestrictedDoubleSequence() = aOther.GetAsUnrestrictedDoubleSequence(); break; } case eDOMMatrixReadOnly: { SetAsDOMMatrixReadOnly() = aOther.GetAsDOMMatrixReadOnly(); break; } } return *this; } DOMMatrixInit::DOMMatrixInit() : DOMMatrix2DInit(FastDictionaryInitializer()) { // Safe to pass a null context if we pass a null value Init(nullptr, JS::NullHandleValue); } bool DOMMatrixInit::InitIds(JSContext* cx, DOMMatrixInitAtoms* atomsCache) { MOZ_ASSERT(reinterpret_cast(atomsCache)->isVoid()); // Initialize these in reverse order so that any failure leaves the first one // uninitialized. if (!atomsCache->m44_id.init(cx, "m44") || !atomsCache->m43_id.init(cx, "m43") || !atomsCache->m34_id.init(cx, "m34") || !atomsCache->m33_id.init(cx, "m33") || !atomsCache->m32_id.init(cx, "m32") || !atomsCache->m31_id.init(cx, "m31") || !atomsCache->m24_id.init(cx, "m24") || !atomsCache->m23_id.init(cx, "m23") || !atomsCache->m14_id.init(cx, "m14") || !atomsCache->m13_id.init(cx, "m13") || !atomsCache->is2D_id.init(cx, "is2D")) { return false; } return true; } bool DOMMatrixInit::Init(BindingCallContext& cx, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // Passing a null JSContext is OK only if we're initing from null, // Since in that case we will not have to do any property gets // Also evaluate isNullOrUndefined in order to avoid false-positive // checkers by static analysis tools MOZ_ASSERT_IF(!cx, val.isNull() && val.isNullOrUndefined()); DOMMatrixInitAtoms* atomsCache = nullptr; if (cx) { atomsCache = GetAtomCache(cx); if (reinterpret_cast(atomsCache)->isVoid() && !InitIds(cx, atomsCache)) { return false; } } // Per spec, we init the parent's members first if (!DOMMatrix2DInit::Init(cx, val)) { return false; } bool isNull = val.isNullOrUndefined(); // We only need these if !isNull, in which case we have |cx|. Maybe > object; Maybe > temp; if (!isNull) { MOZ_ASSERT(cx); object.emplace(cx, &val.toObject()); temp.emplace(cx); } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->is2D_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { mIs2D.Construct(); if (!ValueToPrimitive(cx, temp.ref(), "'is2D' member of DOMMatrixInit", &(mIs2D.Value()))) { return false; } mIsAnyMemberPresent = true; } if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m13_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m13' member of DOMMatrixInit", &mM13)) { return false; } } else { mM13 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m14_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m14' member of DOMMatrixInit", &mM14)) { return false; } } else { mM14 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m23_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m23' member of DOMMatrixInit", &mM23)) { return false; } } else { mM23 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m24_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m24' member of DOMMatrixInit", &mM24)) { return false; } } else { mM24 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m31_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m31' member of DOMMatrixInit", &mM31)) { return false; } } else { mM31 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m32_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m32' member of DOMMatrixInit", &mM32)) { return false; } } else { mM32 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m33_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m33' member of DOMMatrixInit", &mM33)) { return false; } } else { mM33 = 1.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m34_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m34' member of DOMMatrixInit", &mM34)) { return false; } } else { mM34 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m43_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m43' member of DOMMatrixInit", &mM43)) { return false; } } else { mM43 = 0.0; } mIsAnyMemberPresent = true; if (!isNull) { if (!JS_GetPropertyById(cx, *object, atomsCache->m44_id, temp.ptr())) { return false; } } if (!isNull && !temp->isUndefined()) { if (!ValueToPrimitive(cx, temp.ref(), "'m44' member of DOMMatrixInit", &mM44)) { return false; } } else { mM44 = 1.0; } mIsAnyMemberPresent = true; return true; } bool DOMMatrixInit::Init(JSContext* cx_, JS::Handle val, const char* sourceDescription, bool passedToJSImpl) { // We don't want to use sourceDescription for our context here; // that's not really what it's formatted for. BindingCallContext cx(cx_, nullptr); return Init(cx, val, sourceDescription, passedToJSImpl); } void DOMMatrixInit::TraceDictionary(JSTracer* trc) { DOMMatrix2DInit::TraceDictionary(trc); } DOMMatrixInit& DOMMatrixInit::operator=(const DOMMatrixInit& aOther) { DOMMatrix2DInit::operator=(aOther); mIs2D.Reset(); if (aOther.mIs2D.WasPassed()) { mIs2D.Construct(aOther.mIs2D.Value()); } mM13 = aOther.mM13; mM14 = aOther.mM14; mM23 = aOther.mM23; mM24 = aOther.mM24; mM31 = aOther.mM31; mM32 = aOther.mM32; mM33 = aOther.mM33; mM34 = aOther.mM34; mM43 = aOther.mM43; mM44 = aOther.mM44; return *this; } namespace DOMMatrix_Binding { static_assert(IsRefcounted::value == IsRefcounted::value, "Can't inherit from an interface with a different ownership model."); MOZ_CAN_RUN_SCRIPT static bool fromMatrix(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrix.fromMatrix"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "fromMatrix", 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; } binding_detail::FastDOMMatrixInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrix::FromMatrix(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.fromMatrix")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool fromFloat32Array(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrix.fromFloat32Array"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "fromFloat32Array", 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()); if (!args.requireAtLeast(cx, "DOMMatrix.fromFloat32Array", 1)) { return false; } GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj)); if (global.Failed()) { return false; } RootedSpiderMonkeyInterface arg0(cx); if (args[0].isObject()) { if (!arg0.Init(&args[0].toObject())) { cx.ThrowErrorMessage("Argument 1", "Float32Array"); return false; } if (JS::IsArrayBufferViewShared(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsLargeArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsResizableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsImmutableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } } else { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrix::FromFloat32Array(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.fromFloat32Array")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool fromFloat64Array(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrix.fromFloat64Array"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "fromFloat64Array", 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()); if (!args.requireAtLeast(cx, "DOMMatrix.fromFloat64Array", 1)) { return false; } GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj)); if (global.Failed()) { return false; } RootedSpiderMonkeyInterface arg0(cx); if (args[0].isObject()) { if (!arg0.Init(&args[0].toObject())) { cx.ThrowErrorMessage("Argument 1", "Float64Array"); return false; } if (JS::IsArrayBufferViewShared(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsLargeArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsResizableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsImmutableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } } else { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrix::FromFloat64Array(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.fromFloat64Array")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool get_a(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "a", 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)->A()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_a(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "a", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetA(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetA(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo a_getterinfo = { { get_a }, { prototypes::id::DOMMatrix }, { 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 a_setterinfo = { { (JSJitGetterOp)set_a }, { prototypes::id::DOMMatrix }, { 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_b(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "b", 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)->B()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_b(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "b", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetB(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetB(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo b_getterinfo = { { get_b }, { prototypes::id::DOMMatrix }, { 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 b_setterinfo = { { (JSJitGetterOp)set_b }, { prototypes::id::DOMMatrix }, { 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_c(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "c", 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)->C()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_c(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "c", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetC(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetC(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo c_getterinfo = { { get_c }, { prototypes::id::DOMMatrix }, { 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 c_setterinfo = { { (JSJitGetterOp)set_c }, { prototypes::id::DOMMatrix }, { 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_d(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "d", 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)->D()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_d(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "d", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetD(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetD(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo d_getterinfo = { { get_d }, { prototypes::id::DOMMatrix }, { 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 d_setterinfo = { { (JSJitGetterOp)set_d }, { prototypes::id::DOMMatrix }, { 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_e(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "e", 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)->E()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_e(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "e", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetE(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetE(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo e_getterinfo = { { get_e }, { prototypes::id::DOMMatrix }, { 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 e_setterinfo = { { (JSJitGetterOp)set_e }, { prototypes::id::DOMMatrix }, { 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_f(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "f", 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)->F()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_f(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "f", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetF(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetF(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo f_getterinfo = { { get_f }, { prototypes::id::DOMMatrix }, { 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 f_setterinfo = { { (JSJitGetterOp)set_f }, { prototypes::id::DOMMatrix }, { 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_m11(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m11", 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)->M11()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m11(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m11", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM11(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM11(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m11_getterinfo = { { get_m11 }, { prototypes::id::DOMMatrix }, { 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 m11_setterinfo = { { (JSJitGetterOp)set_m11 }, { prototypes::id::DOMMatrix }, { 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_m12(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m12", 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)->M12()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m12(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m12", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM12(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM12(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m12_getterinfo = { { get_m12 }, { prototypes::id::DOMMatrix }, { 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 m12_setterinfo = { { (JSJitGetterOp)set_m12 }, { prototypes::id::DOMMatrix }, { 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_m13(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m13", 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)->M13()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m13(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m13", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM13(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM13(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m13_getterinfo = { { get_m13 }, { prototypes::id::DOMMatrix }, { 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 m13_setterinfo = { { (JSJitGetterOp)set_m13 }, { prototypes::id::DOMMatrix }, { 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_m14(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m14", 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)->M14()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m14(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m14", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM14(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM14(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m14_getterinfo = { { get_m14 }, { prototypes::id::DOMMatrix }, { 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 m14_setterinfo = { { (JSJitGetterOp)set_m14 }, { prototypes::id::DOMMatrix }, { 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_m21(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m21", 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)->M21()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m21(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m21", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM21(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM21(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m21_getterinfo = { { get_m21 }, { prototypes::id::DOMMatrix }, { 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 m21_setterinfo = { { (JSJitGetterOp)set_m21 }, { prototypes::id::DOMMatrix }, { 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_m22(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m22", 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)->M22()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m22(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m22", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM22(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM22(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m22_getterinfo = { { get_m22 }, { prototypes::id::DOMMatrix }, { 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 m22_setterinfo = { { (JSJitGetterOp)set_m22 }, { prototypes::id::DOMMatrix }, { 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_m23(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m23", 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)->M23()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m23(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m23", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM23(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM23(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m23_getterinfo = { { get_m23 }, { prototypes::id::DOMMatrix }, { 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 m23_setterinfo = { { (JSJitGetterOp)set_m23 }, { prototypes::id::DOMMatrix }, { 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_m24(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m24", 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)->M24()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m24(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m24", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM24(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM24(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m24_getterinfo = { { get_m24 }, { prototypes::id::DOMMatrix }, { 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 m24_setterinfo = { { (JSJitGetterOp)set_m24 }, { prototypes::id::DOMMatrix }, { 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_m31(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m31", 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)->M31()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m31(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m31", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM31(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM31(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m31_getterinfo = { { get_m31 }, { prototypes::id::DOMMatrix }, { 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 m31_setterinfo = { { (JSJitGetterOp)set_m31 }, { prototypes::id::DOMMatrix }, { 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_m32(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m32", 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)->M32()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m32(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m32", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM32(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM32(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m32_getterinfo = { { get_m32 }, { prototypes::id::DOMMatrix }, { 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 m32_setterinfo = { { (JSJitGetterOp)set_m32 }, { prototypes::id::DOMMatrix }, { 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_m33(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m33", 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)->M33()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m33(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m33", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM33(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM33(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m33_getterinfo = { { get_m33 }, { prototypes::id::DOMMatrix }, { 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 m33_setterinfo = { { (JSJitGetterOp)set_m33 }, { prototypes::id::DOMMatrix }, { 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_m34(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m34", 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)->M34()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m34(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m34", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM34(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM34(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m34_getterinfo = { { get_m34 }, { prototypes::id::DOMMatrix }, { 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 m34_setterinfo = { { (JSJitGetterOp)set_m34 }, { prototypes::id::DOMMatrix }, { 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_m41(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m41", 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)->M41()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m41(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m41", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM41(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM41(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m41_getterinfo = { { get_m41 }, { prototypes::id::DOMMatrix }, { 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 m41_setterinfo = { { (JSJitGetterOp)set_m41 }, { prototypes::id::DOMMatrix }, { 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_m42(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m42", 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)->M42()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m42(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m42", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM42(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM42(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m42_getterinfo = { { get_m42 }, { prototypes::id::DOMMatrix }, { 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 m42_setterinfo = { { (JSJitGetterOp)set_m42 }, { prototypes::id::DOMMatrix }, { 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_m43(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m43", 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)->M43()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m43(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m43", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM43(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM43(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m43_getterinfo = { { get_m43 }, { prototypes::id::DOMMatrix }, { 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 m43_setterinfo = { { (JSJitGetterOp)set_m43 }, { prototypes::id::DOMMatrix }, { 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_m44(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m44", 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)->M44()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } MOZ_CAN_RUN_SCRIPT static bool set_m44(JSContext* cx, JS::Handle obj, void* void_self, JSJitSetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "m44", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_SETTER) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (!ValueToPrimitive(cx, args[0], "Value being assigned", &arg0)) { return false; } // NOTE: This assert does NOT call the function. static_assert(std::is_void_vSetM44(arg0))>, "Should be returning void here"); MOZ_KnownLive(self)->SetM44(arg0); MOZ_ASSERT(!JS_IsExceptionPending(cx)); return true; } static const JSJitInfo m44_getterinfo = { { get_m44 }, { prototypes::id::DOMMatrix }, { 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 m44_setterinfo = { { (JSJitGetterOp)set_m44 }, { prototypes::id::DOMMatrix }, { 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 multiplySelf(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "DOMMatrix.multiplySelf"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "multiplySelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastDOMMatrixInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->MultiplySelf(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.multiplySelf")) [[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 multiplySelf_methodinfo = { { (JSJitGetterOp)multiplySelf }, { prototypes::id::DOMMatrix }, { 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 preMultiplySelf(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "DOMMatrix.preMultiplySelf"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "preMultiplySelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastDOMMatrixInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->PreMultiplySelf(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.preMultiplySelf")) [[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 preMultiplySelf_methodinfo = { { (JSJitGetterOp)preMultiplySelf }, { prototypes::id::DOMMatrix }, { 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 translateSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "translateSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->TranslateSelf(arg0, arg1, arg2))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo translateSelf_methodinfo = { { (JSJitGetterOp)translateSelf }, { prototypes::id::DOMMatrix }, { 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 scaleSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "scaleSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 1.0; } Optional arg1; if (args.hasDefined(1)) { arg1.Construct(); if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1.Value())) { return false; } } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 1.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } double arg4; if (args.hasDefined(4)) { if (!ValueToPrimitive(cx, args[4], "Argument 5", &arg4)) { return false; } } else { arg4 = 0.0; } double arg5; if (args.hasDefined(5)) { if (!ValueToPrimitive(cx, args[5], "Argument 6", &arg5)) { return false; } } else { arg5 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->ScaleSelf(arg0, Constify(arg1), arg2, arg3, arg4, arg5))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo scaleSelf_methodinfo = { { (JSJitGetterOp)scaleSelf }, { prototypes::id::DOMMatrix }, { 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 scale3dSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "scale3dSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 1.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Scale3dSelf(arg0, arg1, arg2, arg3))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo scale3dSelf_methodinfo = { { (JSJitGetterOp)scale3dSelf }, { prototypes::id::DOMMatrix }, { 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 rotateSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "rotateSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } Optional arg1; if (args.hasDefined(1)) { arg1.Construct(); if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1.Value())) { return false; } } Optional arg2; if (args.hasDefined(2)) { arg2.Construct(); if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2.Value())) { return false; } } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RotateSelf(arg0, Constify(arg1), 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 rotateSelf_methodinfo = { { (JSJitGetterOp)rotateSelf }, { prototypes::id::DOMMatrix }, { 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 rotateFromVectorSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "rotateFromVectorSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RotateFromVectorSelf(arg0, arg1))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo rotateFromVectorSelf_methodinfo = { { (JSJitGetterOp)rotateFromVectorSelf }, { prototypes::id::DOMMatrix }, { 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 rotateAxisAngleSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "rotateAxisAngleSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RotateAxisAngleSelf(arg0, arg1, arg2, arg3))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo rotateAxisAngleSelf_methodinfo = { { (JSJitGetterOp)rotateAxisAngleSelf }, { prototypes::id::DOMMatrix }, { 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 skewXSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "skewXSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SkewXSelf(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo skewXSelf_methodinfo = { { (JSJitGetterOp)skewXSelf }, { prototypes::id::DOMMatrix }, { 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 skewYSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "skewYSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SkewYSelf(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo skewYSelf_methodinfo = { { (JSJitGetterOp)skewYSelf }, { prototypes::id::DOMMatrix }, { 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 invertSelf(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "invertSelf", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->InvertSelf())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo invertSelf_methodinfo = { { (JSJitGetterOp)invertSelf }, { prototypes::id::DOMMatrix }, { 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 setMatrixValue(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "setMatrixValue", 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, "DOMMatrix.setMatrixValue", 1)) { return false; } nsAutoCString arg0; if (!ConvertJSValueToString(cx, args[0], eStringify, eStringify, arg0)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SetMatrixValue(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix.setMatrixValue")) [[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 setMatrixValue_methodinfo = { { (JSJitGetterOp)setMatrixValue }, { prototypes::id::DOMMatrix }, { 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. */ }; static void _finalize(JS::GCContext* gcx, JSObject* obj) { mozilla::dom::DOMMatrix* self = UnwrapPossiblyNotInitializedDOMObject(obj); if (self) { JS::SetNativeObjectReservedSlot(obj, DOM_OBJECT_SLOT, JS::UndefinedValue()); ClearWrapper(self, self, obj); if (size_t mallocBytes = BindingJSObjectMallocBytes(self)) { JS::RemoveAssociatedMemory(obj, mallocBytes, JS::MemoryUse::DOMBinding); } AddForDeferredFinalization(self); } } MOZ_GLOBINIT static const JSFunctionSpec sStaticMethods_specs[] = { JS_FNSPEC("fromMatrix", fromMatrix, nullptr, 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("fromFloat32Array", fromFloat32Array, nullptr, 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("fromFloat64Array", fromFloat64Array, nullptr, 1, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const Prefable sStaticMethods[] = { { nullptr, &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(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 sMethods_specs[] = { JS_FNSPEC("multiplySelf", (GenericMethod), reinterpret_cast(&multiplySelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("preMultiplySelf", (GenericMethod), reinterpret_cast(&preMultiplySelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("translateSelf", (GenericMethod), reinterpret_cast(&translateSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scaleSelf", (GenericMethod), reinterpret_cast(&scaleSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scale3dSelf", (GenericMethod), reinterpret_cast(&scale3dSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotateSelf", (GenericMethod), reinterpret_cast(&rotateSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotateFromVectorSelf", (GenericMethod), reinterpret_cast(&rotateFromVectorSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotateAxisAngleSelf", (GenericMethod), reinterpret_cast(&rotateAxisAngleSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("skewXSelf", (GenericMethod), reinterpret_cast(&skewXSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("skewYSelf", (GenericMethod), reinterpret_cast(&skewYSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("invertSelf", (GenericMethod), reinterpret_cast(&invertSelf_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("setMatrixValue", (GenericMethod), reinterpret_cast(&setMatrixValue_methodinfo), 1, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sMethods_disablers12 = { WebIDLPrefIndex::NoPref, GlobalNames::DedicatedWorkerGlobalScope | GlobalNames::ServiceWorkerGlobalScope | GlobalNames::SharedWorkerGlobalScope, false, OriginTrial(0), nullptr }; static const Prefable sMethods[] = { { nullptr, &sMethods_specs[0] }, { &sMethods_disablers12, &sMethods_specs[12] }, { nullptr, nullptr } }; static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(11 <= 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("a", JSPROP_ENUMERATE, GenericGetter, &a_getterinfo, GenericSetter, &a_setterinfo), JSPropertySpec::nativeAccessors("b", JSPROP_ENUMERATE, GenericGetter, &b_getterinfo, GenericSetter, &b_setterinfo), JSPropertySpec::nativeAccessors("c", JSPROP_ENUMERATE, GenericGetter, &c_getterinfo, GenericSetter, &c_setterinfo), JSPropertySpec::nativeAccessors("d", JSPROP_ENUMERATE, GenericGetter, &d_getterinfo, GenericSetter, &d_setterinfo), JSPropertySpec::nativeAccessors("e", JSPROP_ENUMERATE, GenericGetter, &e_getterinfo, GenericSetter, &e_setterinfo), JSPropertySpec::nativeAccessors("f", JSPROP_ENUMERATE, GenericGetter, &f_getterinfo, GenericSetter, &f_setterinfo), JSPropertySpec::nativeAccessors("m11", JSPROP_ENUMERATE, GenericGetter, &m11_getterinfo, GenericSetter, &m11_setterinfo), JSPropertySpec::nativeAccessors("m12", JSPROP_ENUMERATE, GenericGetter, &m12_getterinfo, GenericSetter, &m12_setterinfo), JSPropertySpec::nativeAccessors("m13", JSPROP_ENUMERATE, GenericGetter, &m13_getterinfo, GenericSetter, &m13_setterinfo), JSPropertySpec::nativeAccessors("m14", JSPROP_ENUMERATE, GenericGetter, &m14_getterinfo, GenericSetter, &m14_setterinfo), JSPropertySpec::nativeAccessors("m21", JSPROP_ENUMERATE, GenericGetter, &m21_getterinfo, GenericSetter, &m21_setterinfo), JSPropertySpec::nativeAccessors("m22", JSPROP_ENUMERATE, GenericGetter, &m22_getterinfo, GenericSetter, &m22_setterinfo), JSPropertySpec::nativeAccessors("m23", JSPROP_ENUMERATE, GenericGetter, &m23_getterinfo, GenericSetter, &m23_setterinfo), JSPropertySpec::nativeAccessors("m24", JSPROP_ENUMERATE, GenericGetter, &m24_getterinfo, GenericSetter, &m24_setterinfo), JSPropertySpec::nativeAccessors("m31", JSPROP_ENUMERATE, GenericGetter, &m31_getterinfo, GenericSetter, &m31_setterinfo), JSPropertySpec::nativeAccessors("m32", JSPROP_ENUMERATE, GenericGetter, &m32_getterinfo, GenericSetter, &m32_setterinfo), JSPropertySpec::nativeAccessors("m33", JSPROP_ENUMERATE, GenericGetter, &m33_getterinfo, GenericSetter, &m33_setterinfo), JSPropertySpec::nativeAccessors("m34", JSPROP_ENUMERATE, GenericGetter, &m34_getterinfo, GenericSetter, &m34_setterinfo), JSPropertySpec::nativeAccessors("m41", JSPROP_ENUMERATE, GenericGetter, &m41_getterinfo, GenericSetter, &m41_setterinfo), JSPropertySpec::nativeAccessors("m42", JSPROP_ENUMERATE, GenericGetter, &m42_getterinfo, GenericSetter, &m42_setterinfo), JSPropertySpec::nativeAccessors("m43", JSPROP_ENUMERATE, GenericGetter, &m43_getterinfo, GenericSetter, &m43_setterinfo), JSPropertySpec::nativeAccessors("m44", JSPROP_ENUMERATE, GenericGetter, &m44_getterinfo, GenericSetter, &m44_setterinfo), 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(22 <= 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[37]; static PropertyInfo sNativeProperties_propertyInfos[37]; static const NativePropertiesN<3> sNativeProperties = { true, 0 /* sStaticMethods */, false, 0, true, 1 /* sMethods */, true, 2 /* sAttributes */, false, 0, false, 0, false, 0, -1, 37, sNativeProperties_sortedPropertyIndices, { { sStaticMethods, &sNativeProperties_propertyInfos[0] }, { sMethods, &sNativeProperties_propertyInfos[3] }, { sAttributes, &sNativeProperties_propertyInfos[15] } } }; static_assert(37 < 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::DOMMatrix, constructors::id::DOMMatrix, &DefaultXrayExpandoObjectClass }; static bool _constructor(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrix constructor"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrix", "constructor", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::Rooted obj(cx, &args.callee()); if (!args.isConstructing()) { return ThrowConstructorWithoutNew(cx, "DOMMatrix"); } JS::Rooted desiredProto(cx); if (!GetDesiredProto(cx, args, prototypes::id::DOMMatrix, CreateInterfaceObjects, &desiredProto)) { return false; } GlobalObject global(cx, obj); if (global.Failed()) { return false; } bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); Optional arg0; if (args.hasDefined(0)) { arg0.Construct(); if (!arg0.Value().Init(cx, args[0], "Argument 1", false)) { return false; } } Maybe 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::DOMMatrix::Constructor(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrix constructor")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const DOMInterfaceInfo sInterfaceObjectInfo = { { _constructor, &sNativePropertyHooks }, DOMMatrixReadOnly_Binding::GetConstructorObjectHandle, PrototypeTraits::Depth, prototypes::id::DOMMatrix, true, 0, "DOMMatrix", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "DOMMatrixPrototype", 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::DOMMatrix, PrototypeTraits::Depth, &sNativePropertyHooks, DOMMatrixReadOnly_Binding::GetProtoObject }; static bool Serialize(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle aObj) { MOZ_ASSERT(IsDOMObject(aObj), "Non-DOM object passed"); MOZ_ASSERT(GetDOMClass(aObj)->mSerializer == &Serialize, "Wrong object passed"); return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMMATRIX, 0) && UnwrapDOMObject(aObj)->WriteStructuredClone(aCx, aWriter); } JSObject* Deserialize(JSContext* aCx, nsIGlobalObject* aGlobal, JSStructuredCloneReader* aReader) { // Protect the result from a moving GC in ~RefPtr JS::Rooted result(aCx); { // Scope for the RefPtr RefPtr obj = mozilla::dom::DOMMatrix::ReadStructuredClone(aCx, aGlobal, aReader); if (!obj) { return nullptr; } result = obj->WrapObject(aCx, nullptr); if (!result) { return nullptr; } } return result; } static JS::Handle GetProtoObjectHandle(JSContext* aCx); static const JSClassOps sClassOps = { nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* enumerate */ nullptr, /* newEnumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */ _finalize, /* finalize */ nullptr, /* call */ nullptr, /* construct */ nullptr, /* trace */ }; static const DOMJSClass sClass = { { "DOMMatrix", JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_PRESERVES_WRAPPER, &sClassOps, JS_NULL_CLASS_SPEC, &NativeTypeHelpers::sClassExtension, JS_NULL_OBJECT_OPS }, { prototypes::id::DOMMatrixReadOnly, prototypes::id::DOMMatrix, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, std::is_base_of_v, &sNativePropertyHooks, GetProtoObjectHandle, GetCCParticipant::Get(), Serialize, NativeTypeHelpers::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::DOMMatrix* aObject, nsWrapperCache* aCache, JS::Handle aGivenProto, JS::MutableHandle aReflector) { static_assert(!std::is_base_of_v, "Shouldn't have wrappercached things that are not refcounted."); static_assert(std::is_same_v); MOZ_ASSERT(static_cast(aObject) == reinterpret_cast(aObject), "Multiple inheritance for mozilla::dom::DOMMatrixReadOnly is broken."); MOZ_ASSERT(ToSupportsIsCorrect(aObject)); MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); MOZ_ASSERT(!aCache->GetWrapper(), "You should probably not be using Wrap() directly; use " "GetOrCreateDOMReflector instead"); MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), "nsISupports must be on our primary inheritance chain"); // If the wrapper cache contains a dead reflector then finalize that // now, ensuring that the finalizer for the old reflector always // runs before the new reflector is created and attached. This // avoids the awkward situation where there are multiple reflector // objects that contain pointers to the same native. if (JSObject* oldReflector = aCache->GetWrapperMaybeDead()) { _finalize(nullptr /* unused */, oldReflector); MOZ_ASSERT(!aCache->GetWrapperMaybeDead()); } JS::Rooted global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); if (!global) { return false; } MOZ_ASSERT(JS_IsGlobalObject(global)); JS::AssertObjectIsNotGray(global); // That might have ended up wrapping us already, due to the wonders // of XBL. Check for that, and bail out as needed. aReflector.set(aCache->GetWrapper()); if (aReflector) { #ifdef DEBUG AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); #endif // DEBUG return true; } JSAutoRealm ar(aCx, global); JS::Handle canonicalProto = GetProtoObjectHandle(aCx); if (!canonicalProto) { return false; } JS::Rooted proto(aCx); if (aGivenProto) { proto = aGivenProto; // Unfortunately, while aGivenProto was in the compartment of aCx // coming in, we changed compartments to that of "parent" so may need // to wrap the proto here. if (js::GetContextCompartment(aCx) != JS::GetCompartment(proto)) { if (!JS_WrapObject(aCx, &proto)) { return false; } } } else { proto = canonicalProto; } BindingJSObjectCreator creator(aCx); creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); if (!aReflector) { return false; } aCache->SetWrapper(aReflector); creator.InitializationSucceeded(); MOZ_ASSERT(aCache->GetWrapperPreserveColor() && aCache->GetWrapperPreserveColor() == aReflector); // If proto != canonicalProto, we have to preserve our wrapper; // otherwise we won't be able to properly recreate it later, since // we won't know what proto to use. Note that we don't check // aGivenProto here, since it's entirely possible (and even // somewhat common) to have a non-null aGivenProto which is the // same as canonicalProto. if (proto != canonicalProto) { PreserveWrapper(aObject); } return true; } static const char* const legacyWindowAliases[] = { "WebKitCSSMatrix", nullptr }; void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::DOMMatrix); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::DOMMatrix); JS::Handle parentProto(DOMMatrixReadOnly_Binding::GetProtoObjectHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(DOMMatrixReadOnly_Binding::GetConstructorObjectHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), nullptr, "DOMMatrix", aDefineOnGlobal != DefineInterfaceProperty::No, nullptr, false, legacyWindowAliases); } static JS::Handle GetProtoObjectHandle(JSContext* aCx) { /* Get the interface prototype object for this class. This will create the object as needed. */ return GetPerInterfaceObjectHandle(aCx, prototypes::id::DOMMatrix, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } JS::Handle GetConstructorObjectHandle(JSContext* aCx) { /* Get the interface object for this class. This will create the object as needed. */ return GetPerInterfaceObjectHandle(aCx, constructors::id::DOMMatrix, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace DOMMatrix_Binding namespace DOMMatrixReadOnly_Binding { MOZ_CAN_RUN_SCRIPT static bool fromMatrix(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrixReadOnly.fromMatrix"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "fromMatrix", 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; } binding_detail::FastDOMMatrixInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrixReadOnly::FromMatrix(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.fromMatrix")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool fromFloat32Array(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrixReadOnly.fromFloat32Array"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "fromFloat32Array", 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()); if (!args.requireAtLeast(cx, "DOMMatrixReadOnly.fromFloat32Array", 1)) { return false; } GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj)); if (global.Failed()) { return false; } RootedSpiderMonkeyInterface arg0(cx); if (args[0].isObject()) { if (!arg0.Init(&args[0].toObject())) { cx.ThrowErrorMessage("Argument 1", "Float32Array"); return false; } if (JS::IsArrayBufferViewShared(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsLargeArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsResizableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsImmutableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } } else { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrixReadOnly::FromFloat32Array(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.fromFloat32Array")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool fromFloat64Array(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrixReadOnly.fromFloat64Array"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "fromFloat64Array", 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()); if (!args.requireAtLeast(cx, "DOMMatrixReadOnly.fromFloat64Array", 1)) { return false; } GlobalObject global(cx, xpc::XrayAwareCalleeGlobal(obj)); if (global.Failed()) { return false; } RootedSpiderMonkeyInterface arg0(cx); if (args[0].isObject()) { if (!arg0.Init(&args[0].toObject())) { cx.ThrowErrorMessage("Argument 1", "Float64Array"); return false; } if (JS::IsArrayBufferViewShared(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsLargeArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsResizableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } if (JS::IsImmutableArrayBufferView(arg0.Obj())) { cx.ThrowErrorMessage("Argument 1"); return false; } } else { cx.ThrowErrorMessage("Argument 1"); return false; } FastErrorResult rv; auto result(StrongOrRawPtr(mozilla::dom::DOMMatrixReadOnly::FromFloat64Array(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.fromFloat64Array")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } MOZ_CAN_RUN_SCRIPT static bool get_a(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "a", 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)->A()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo a_getterinfo = { { get_a }, { prototypes::id::DOMMatrixReadOnly }, { 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_b(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "b", 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)->B()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo b_getterinfo = { { get_b }, { prototypes::id::DOMMatrixReadOnly }, { 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_c(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "c", 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)->C()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo c_getterinfo = { { get_c }, { prototypes::id::DOMMatrixReadOnly }, { 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_d(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "d", 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)->D()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo d_getterinfo = { { get_d }, { prototypes::id::DOMMatrixReadOnly }, { 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_e(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "e", 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)->E()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo e_getterinfo = { { get_e }, { prototypes::id::DOMMatrixReadOnly }, { 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_f(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "f", 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)->F()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo f_getterinfo = { { get_f }, { prototypes::id::DOMMatrixReadOnly }, { 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_m11(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m11", 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)->M11()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m11_getterinfo = { { get_m11 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m12(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m12", 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)->M12()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m12_getterinfo = { { get_m12 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m13(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m13", 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)->M13()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m13_getterinfo = { { get_m13 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m14(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m14", 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)->M14()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m14_getterinfo = { { get_m14 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m21(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m21", 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)->M21()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m21_getterinfo = { { get_m21 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m22(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m22", 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)->M22()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m22_getterinfo = { { get_m22 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m23(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m23", 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)->M23()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m23_getterinfo = { { get_m23 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m24(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m24", 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)->M24()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m24_getterinfo = { { get_m24 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m31(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m31", 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)->M31()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m31_getterinfo = { { get_m31 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m32(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m32", 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)->M32()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m32_getterinfo = { { get_m32 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m33(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m33", 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)->M33()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m33_getterinfo = { { get_m33 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m34(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m34", 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)->M34()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m34_getterinfo = { { get_m34 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m41(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m41", 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)->M41()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m41_getterinfo = { { get_m41 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m42(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m42", 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)->M42()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m42_getterinfo = { { get_m42 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m43(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m43", 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)->M43()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m43_getterinfo = { { get_m43 }, { prototypes::id::DOMMatrixReadOnly }, { 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_m44(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "m44", 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)->M44()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().set(JS::NumberValue(double(result))); return true; } static const JSJitInfo m44_getterinfo = { { get_m44 }, { prototypes::id::DOMMatrixReadOnly }, { 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 translate(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "translate", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Translate(arg0, arg1, arg2))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo translate_methodinfo = { { (JSJitGetterOp)translate }, { prototypes::id::DOMMatrixReadOnly }, { 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 scale(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "scale", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 1.0; } Optional arg1; if (args.hasDefined(1)) { arg1.Construct(); if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1.Value())) { return false; } } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 1.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } double arg4; if (args.hasDefined(4)) { if (!ValueToPrimitive(cx, args[4], "Argument 5", &arg4)) { return false; } } else { arg4 = 0.0; } double arg5; if (args.hasDefined(5)) { if (!ValueToPrimitive(cx, args[5], "Argument 6", &arg5)) { return false; } } else { arg5 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Scale(arg0, Constify(arg1), arg2, arg3, arg4, arg5))); 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 scale_methodinfo = { { (JSJitGetterOp)scale }, { prototypes::id::DOMMatrixReadOnly }, { 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 scaleNonUniform(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "scaleNonUniform", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 1.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 1.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->ScaleNonUniform(arg0, arg1))); 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 scaleNonUniform_methodinfo = { { (JSJitGetterOp)scaleNonUniform }, { prototypes::id::DOMMatrixReadOnly }, { 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 scale3d(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "scale3d", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 1.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Scale3d(arg0, arg1, arg2, arg3))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo scale3d_methodinfo = { { (JSJitGetterOp)scale3d }, { prototypes::id::DOMMatrixReadOnly }, { 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 rotate(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "rotate", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } Optional arg1; if (args.hasDefined(1)) { arg1.Construct(); if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1.Value())) { return false; } } Optional arg2; if (args.hasDefined(2)) { arg2.Construct(); if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2.Value())) { return false; } } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Rotate(arg0, Constify(arg1), Constify(arg2)))); 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 rotate_methodinfo = { { (JSJitGetterOp)rotate }, { prototypes::id::DOMMatrixReadOnly }, { 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 rotateFromVector(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "rotateFromVector", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RotateFromVector(arg0, arg1))); 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 rotateFromVector_methodinfo = { { (JSJitGetterOp)rotateFromVector }, { prototypes::id::DOMMatrixReadOnly }, { 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 rotateAxisAngle(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "rotateAxisAngle", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } double arg1; if (args.hasDefined(1)) { if (!ValueToPrimitive(cx, args[1], "Argument 2", &arg1)) { return false; } } else { arg1 = 0.0; } double arg2; if (args.hasDefined(2)) { if (!ValueToPrimitive(cx, args[2], "Argument 3", &arg2)) { return false; } } else { arg2 = 0.0; } double arg3; if (args.hasDefined(3)) { if (!ValueToPrimitive(cx, args[3], "Argument 4", &arg3)) { return false; } } else { arg3 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->RotateAxisAngle(arg0, arg1, arg2, arg3))); 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 rotateAxisAngle_methodinfo = { { (JSJitGetterOp)rotateAxisAngle }, { prototypes::id::DOMMatrixReadOnly }, { 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 skewX(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "skewX", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SkewX(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo skewX_methodinfo = { { (JSJitGetterOp)skewX }, { prototypes::id::DOMMatrixReadOnly }, { 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 skewY(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "skewY", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); double arg0; if (args.hasDefined(0)) { if (!ValueToPrimitive(cx, args[0], "Argument 1", &arg0)) { return false; } } else { arg0 = 0.0; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->SkewY(arg0))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo skewY_methodinfo = { { (JSJitGetterOp)skewY }, { prototypes::id::DOMMatrixReadOnly }, { 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 multiply(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "DOMMatrixReadOnly.multiply"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "multiply", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastDOMMatrixInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } FastErrorResult rv; auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Multiply(Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.multiply")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo multiply_methodinfo = { { (JSJitGetterOp)multiply }, { prototypes::id::DOMMatrixReadOnly }, { 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 flipX(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "flipX", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->FlipX())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo flipX_methodinfo = { { (JSJitGetterOp)flipX }, { prototypes::id::DOMMatrixReadOnly }, { 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 flipY(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "flipY", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->FlipY())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo flipY_methodinfo = { { (JSJitGetterOp)flipY }, { prototypes::id::DOMMatrixReadOnly }, { 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 inverse(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "inverse", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); auto result(StrongOrRawPtr(MOZ_KnownLive(self)->Inverse())); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo inverse_methodinfo = { { (JSJitGetterOp)inverse }, { prototypes::id::DOMMatrixReadOnly }, { 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_is2D(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "is2D", 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)->Is2D()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo is2D_getterinfo = { { get_is2D }, { prototypes::id::DOMMatrixReadOnly }, { 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_isIdentity(JSContext* cx, JS::Handle obj, void* void_self, JSJitGetterCallArgs args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "isIdentity", 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)->IsIdentity()); MOZ_ASSERT(!JS_IsExceptionPending(cx)); args.rval().setBoolean(result); return true; } static const JSJitInfo isIdentity_getterinfo = { { get_isIdentity }, { prototypes::id::DOMMatrixReadOnly }, { 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 transformPoint(JSContext* cx_, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { BindingCallContext cx(cx_, "DOMMatrixReadOnly.transformPoint"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "transformPoint", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); binding_detail::FastDOMPointInit arg0; if (!arg0.Init(cx, (args.hasDefined(0)) ? args[0] : JS::NullHandleValue, "Argument 1", false)) { return false; } auto result(StrongOrRawPtr(MOZ_KnownLive(self)->TransformPoint(Constify(arg0)))); MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!GetOrCreateDOMReflector(cx, result, args.rval())) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const JSJitInfo transformPoint_methodinfo = { { (JSJitGetterOp)transformPoint }, { prototypes::id::DOMMatrixReadOnly }, { 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 toFloat32Array(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "toFloat32Array", 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_vToFloat32Array(cx, &result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ToFloat32Array(cx, &result, rv); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.toFloat32Array")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); JS::ExposeObjectToActiveJS(result); args.rval().setObject(*result); if (!MaybeWrapNonDOMObjectValue(cx, args.rval())) { return false; } return true; } static const JSJitInfo toFloat32Array_methodinfo = { { (JSJitGetterOp)toFloat32Array }, { prototypes::id::DOMMatrixReadOnly }, { 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 toFloat64Array(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "toFloat64Array", 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_vToFloat64Array(cx, &result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->ToFloat64Array(cx, &result, rv); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.toFloat64Array")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); JS::ExposeObjectToActiveJS(result); args.rval().setObject(*result); if (!MaybeWrapNonDOMObjectValue(cx, args.rval())) { return false; } return true; } static const JSJitInfo toFloat64Array_methodinfo = { { (JSJitGetterOp)toFloat64Array }, { prototypes::id::DOMMatrixReadOnly }, { 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 __stringifier(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "__stringifier", 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; nsAutoCString result; // NOTE: This assert does NOT call the function. static_assert(std::is_void_vStringify(result, rv))>, "Should be returning void here"); MOZ_KnownLive(self)->Stringify(result, rv); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly.toString")) [[unlikely]] { return false; } MOZ_ASSERT(!JS_IsExceptionPending(cx)); if (!NonVoidUTF8StringToJsval(cx, result, args.rval())) { return false; } return true; } static const JSJitInfo __stringifier_methodinfo = { { (JSJitGetterOp)__stringifier }, { prototypes::id::DOMMatrixReadOnly }, { 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 toJSON(JSContext* cx, JS::Handle obj, void* void_self, const JSJitMethodCallArgs& args) { AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "toJSON", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::STRING_TEMPLATE_METHOD) | uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); auto* self = static_cast(void_self); JS::Rooted result(cx, JS_NewPlainObject(cx)); if (!result) { return false; } if (!DOMMatrixReadOnly_Binding::CollectJSONAttributes(cx, obj, MOZ_KnownLive(self), result)) { return false; } args.rval().setObject(*result); return true; } static const JSJitInfo toJSON_methodinfo = { { (JSJitGetterOp)toJSON }, { prototypes::id::DOMMatrixReadOnly }, { 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. */ }; static void _finalize(JS::GCContext* gcx, JSObject* obj) { mozilla::dom::DOMMatrixReadOnly* self = UnwrapPossiblyNotInitializedDOMObject(obj); if (self) { JS::SetNativeObjectReservedSlot(obj, DOM_OBJECT_SLOT, JS::UndefinedValue()); ClearWrapper(self, self, obj); if (size_t mallocBytes = BindingJSObjectMallocBytes(self)) { JS::RemoveAssociatedMemory(obj, mallocBytes, JS::MemoryUse::DOMBinding); } AddForDeferredFinalization(self); } } MOZ_GLOBINIT static const JSFunctionSpec sStaticMethods_specs[] = { JS_FNSPEC("fromMatrix", fromMatrix, nullptr, 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("fromFloat32Array", fromFloat32Array, nullptr, 1, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("fromFloat64Array", fromFloat64Array, nullptr, 1, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const Prefable sStaticMethods[] = { { nullptr, &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(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 sMethods_specs[] = { JS_FNSPEC("translate", (GenericMethod), reinterpret_cast(&translate_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scale", (GenericMethod), reinterpret_cast(&scale_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scaleNonUniform", (GenericMethod), reinterpret_cast(&scaleNonUniform_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("scale3d", (GenericMethod), reinterpret_cast(&scale3d_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotate", (GenericMethod), reinterpret_cast(&rotate_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotateFromVector", (GenericMethod), reinterpret_cast(&rotateFromVector_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("rotateAxisAngle", (GenericMethod), reinterpret_cast(&rotateAxisAngle_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("skewX", (GenericMethod), reinterpret_cast(&skewX_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("skewY", (GenericMethod), reinterpret_cast(&skewY_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("multiply", (GenericMethod), reinterpret_cast(&multiply_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("flipX", (GenericMethod), reinterpret_cast(&flipX_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("flipY", (GenericMethod), reinterpret_cast(&flipY_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("inverse", (GenericMethod), reinterpret_cast(&inverse_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("transformPoint", (GenericMethod), reinterpret_cast(&transformPoint_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("toFloat32Array", (GenericMethod), reinterpret_cast(&toFloat32Array_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("toFloat64Array", (GenericMethod), reinterpret_cast(&toFloat64Array_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FNSPEC("toJSON", (GenericMethod), reinterpret_cast(&toJSON_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END, JS_FNSPEC("toString", (GenericMethod), reinterpret_cast(&__stringifier_methodinfo), 0, JSPROP_ENUMERATE, nullptr), JS_FS_END }; static const PrefableDisablers sMethods_disablers18 = { WebIDLPrefIndex::NoPref, GlobalNames::DedicatedWorkerGlobalScope | GlobalNames::ServiceWorkerGlobalScope | GlobalNames::SharedWorkerGlobalScope, false, OriginTrial(0), nullptr }; static const Prefable sMethods[] = { { nullptr, &sMethods_specs[0] }, { &sMethods_disablers18, &sMethods_specs[18] }, { nullptr, nullptr } }; static_assert(2 <= 1ull << NUM_BITS_PROPERTY_INFO_PREF_INDEX, "We have a prefable index that is >= (1 << NUM_BITS_PROPERTY_INFO_PREF_INDEX)"); static_assert(17 <= 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("a", JSPROP_ENUMERATE, GenericGetter, &a_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("b", JSPROP_ENUMERATE, GenericGetter, &b_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("c", JSPROP_ENUMERATE, GenericGetter, &c_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("d", JSPROP_ENUMERATE, GenericGetter, &d_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("e", JSPROP_ENUMERATE, GenericGetter, &e_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("f", JSPROP_ENUMERATE, GenericGetter, &f_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m11", JSPROP_ENUMERATE, GenericGetter, &m11_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m12", JSPROP_ENUMERATE, GenericGetter, &m12_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m13", JSPROP_ENUMERATE, GenericGetter, &m13_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m14", JSPROP_ENUMERATE, GenericGetter, &m14_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m21", JSPROP_ENUMERATE, GenericGetter, &m21_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m22", JSPROP_ENUMERATE, GenericGetter, &m22_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m23", JSPROP_ENUMERATE, GenericGetter, &m23_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m24", JSPROP_ENUMERATE, GenericGetter, &m24_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m31", JSPROP_ENUMERATE, GenericGetter, &m31_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m32", JSPROP_ENUMERATE, GenericGetter, &m32_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m33", JSPROP_ENUMERATE, GenericGetter, &m33_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m34", JSPROP_ENUMERATE, GenericGetter, &m34_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m41", JSPROP_ENUMERATE, GenericGetter, &m41_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m42", JSPROP_ENUMERATE, GenericGetter, &m42_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m43", JSPROP_ENUMERATE, GenericGetter, &m43_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("m44", JSPROP_ENUMERATE, GenericGetter, &m44_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("is2D", JSPROP_ENUMERATE, GenericGetter, &is2D_getterinfo, nullptr, nullptr), JSPropertySpec::nativeAccessors("isIdentity", JSPROP_ENUMERATE, GenericGetter, &isIdentity_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(24 <= 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[45]; static PropertyInfo sNativeProperties_propertyInfos[45]; static const NativePropertiesN<3> sNativeProperties = { true, 0 /* sStaticMethods */, false, 0, true, 1 /* sMethods */, true, 2 /* sAttributes */, false, 0, false, 0, false, 0, -1, 45, sNativeProperties_sortedPropertyIndices, { { sStaticMethods, &sNativeProperties_propertyInfos[0] }, { sMethods, &sNativeProperties_propertyInfos[3] }, { sAttributes, &sNativeProperties_propertyInfos[21] } } }; static_assert(45 < 1ull << (CHAR_BIT * sizeof(sNativeProperties.propertyInfoCount)), "We have a property info count that is oversized"); MOZ_CAN_RUN_SCRIPT bool CollectJSONAttributes(JSContext* cx, JS::Handle obj, mozilla::dom::DOMMatrixReadOnly* self, JS::Rooted& result) { { // scope for "temp" JS::Rooted temp(cx); if (!get_a(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "a", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_b(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "b", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_c(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "c", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_d(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "d", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_e(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "e", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_f(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "f", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m11(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m11", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m12(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m12", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m13(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m13", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m14(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m14", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m21(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m21", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m22(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m22", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m23(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m23", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m24(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m24", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m31(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m31", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m32(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m32", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m33(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m33", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m34(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m34", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m41(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m41", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m42(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m42", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m43(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m43", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_m44(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "m44", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_is2D(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "is2D", temp, JSPROP_ENUMERATE)) { return false; } } { // scope for "temp" JS::Rooted temp(cx); if (!get_isIdentity(cx, obj, self, JSJitGetterCallArgs(&temp))) { return false; } if (!JS_DefineProperty(cx, result, "isIdentity", temp, JSPROP_ENUMERATE)) { return false; } } return true; } bool sNativePropertiesInited = false; const NativePropertyHooks sNativePropertyHooks = { nullptr, { sNativeProperties.Upcast(), nullptr, &sNativePropertiesInited }, prototypes::id::DOMMatrixReadOnly, constructors::id::DOMMatrixReadOnly, &DefaultXrayExpandoObjectClass }; static bool _constructor(JSContext* cx_, unsigned argc, JS::Value* vp) { BindingCallContext cx(cx_, "DOMMatrixReadOnly constructor"); AUTO_PROFILER_LABEL_DYNAMIC_FAST( "DOMMatrixReadOnly", "constructor", DOM, cx, uint32_t(js::ProfilingStackFrame::Flags::RELEVANT_FOR_JS)); JS::CallArgs args = JS::CallArgsFromVp(argc, vp); JS::Rooted obj(cx, &args.callee()); if (!args.isConstructing()) { return ThrowConstructorWithoutNew(cx, "DOMMatrixReadOnly"); } JS::Rooted desiredProto(cx); if (!GetDesiredProto(cx, args, prototypes::id::DOMMatrixReadOnly, CreateInterfaceObjects, &desiredProto)) { return false; } GlobalObject global(cx, obj); if (global.Failed()) { return false; } bool objIsXray = xpc::WrapperFactory::IsXrayWrapper(obj); Optional arg0; if (args.hasDefined(0)) { arg0.Construct(); if (!arg0.Value().Init(cx, args[0], "Argument 1", false)) { return false; } } Maybe 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::DOMMatrixReadOnly::Constructor(global, Constify(arg0), rv))); if (rv.MaybeSetPendingException(cx, "DOMMatrixReadOnly constructor")) [[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 (!GetOrCreateDOMReflector(cx, result, args.rval(), desiredProto)) { MOZ_ASSERT(JS_IsExceptionPending(cx)); return false; } return true; } static const DOMInterfaceInfo sInterfaceObjectInfo = { { _constructor, &sNativePropertyHooks }, JS::GetRealmFunctionPrototypeHandle, PrototypeTraits::Depth, prototypes::id::DOMMatrixReadOnly, true, 0, "DOMMatrixReadOnly", }; static const DOMIfaceAndProtoJSClass sPrototypeClass = { { "DOMMatrixReadOnlyPrototype", 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::DOMMatrixReadOnly, PrototypeTraits::Depth, &sNativePropertyHooks, JS::GetRealmObjectPrototype }; static bool Serialize(JSContext* aCx, JSStructuredCloneWriter* aWriter, JS::Handle aObj) { MOZ_ASSERT(IsDOMObject(aObj), "Non-DOM object passed"); MOZ_ASSERT(GetDOMClass(aObj)->mSerializer == &Serialize, "Wrong object passed"); return JS_WriteUint32Pair(aWriter, SCTAG_DOM_DOMMATRIXREADONLY, 0) && UnwrapDOMObject(aObj)->WriteStructuredClone(aCx, aWriter); } JSObject* Deserialize(JSContext* aCx, nsIGlobalObject* aGlobal, JSStructuredCloneReader* aReader) { // Protect the result from a moving GC in ~RefPtr JS::Rooted result(aCx); { // Scope for the RefPtr RefPtr obj = mozilla::dom::DOMMatrixReadOnly::ReadStructuredClone(aCx, aGlobal, aReader); if (!obj) { return nullptr; } result = obj->WrapObject(aCx, nullptr); if (!result) { return nullptr; } } return result; } static const JSClassOps sClassOps = { nullptr, /* addProperty */ nullptr, /* delProperty */ nullptr, /* enumerate */ nullptr, /* newEnumerate */ nullptr, /* resolve */ nullptr, /* mayResolve */ _finalize, /* finalize */ nullptr, /* call */ nullptr, /* construct */ nullptr, /* trace */ }; static const DOMJSClass sClass = { { "DOMMatrixReadOnly", JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE | JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_PRESERVES_WRAPPER, &sClassOps, JS_NULL_CLASS_SPEC, &NativeTypeHelpers::sClassExtension, JS_NULL_OBJECT_OPS }, { prototypes::id::DOMMatrixReadOnly, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count, prototypes::id::_ID_Count }, std::is_base_of_v, &sNativePropertyHooks, GetProtoObjectHandle, GetCCParticipant::Get(), Serialize, NativeTypeHelpers::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::DOMMatrixReadOnly* aObject, nsWrapperCache* aCache, JS::Handle aGivenProto, JS::MutableHandle aReflector) { static_assert(!std::is_base_of_v, "Shouldn't have wrappercached things that are not refcounted."); static_assert(std::is_same_v); MOZ_ASSERT(ToSupportsIsCorrect(aObject)); MOZ_ASSERT_IF(aGivenProto, js::IsObjectInContextCompartment(aGivenProto, aCx)); MOZ_ASSERT(!aCache->GetWrapper(), "You should probably not be using Wrap() directly; use " "GetOrCreateDOMReflector instead"); MOZ_ASSERT(ToSupportsIsOnPrimaryInheritanceChain(aObject, aCache), "nsISupports must be on our primary inheritance chain"); // If the wrapper cache contains a dead reflector then finalize that // now, ensuring that the finalizer for the old reflector always // runs before the new reflector is created and attached. This // avoids the awkward situation where there are multiple reflector // objects that contain pointers to the same native. if (JSObject* oldReflector = aCache->GetWrapperMaybeDead()) { _finalize(nullptr /* unused */, oldReflector); MOZ_ASSERT(!aCache->GetWrapperMaybeDead()); } JS::Rooted global(aCx, FindAssociatedGlobal(aCx, aObject->GetParentObject())); if (!global) { return false; } MOZ_ASSERT(JS_IsGlobalObject(global)); JS::AssertObjectIsNotGray(global); // That might have ended up wrapping us already, due to the wonders // of XBL. Check for that, and bail out as needed. aReflector.set(aCache->GetWrapper()); if (aReflector) { #ifdef DEBUG AssertReflectorHasGivenProto(aCx, aReflector, aGivenProto); #endif // DEBUG return true; } JSAutoRealm ar(aCx, global); JS::Handle canonicalProto = GetProtoObjectHandle(aCx); if (!canonicalProto) { return false; } JS::Rooted proto(aCx); if (aGivenProto) { proto = aGivenProto; // Unfortunately, while aGivenProto was in the compartment of aCx // coming in, we changed compartments to that of "parent" so may need // to wrap the proto here. if (js::GetContextCompartment(aCx) != JS::GetCompartment(proto)) { if (!JS_WrapObject(aCx, &proto)) { return false; } } } else { proto = canonicalProto; } BindingJSObjectCreator creator(aCx); creator.CreateObject(aCx, sClass.ToJSClass(), proto, aObject, aReflector); if (!aReflector) { return false; } aCache->SetWrapper(aReflector); creator.InitializationSucceeded(); MOZ_ASSERT(aCache->GetWrapperPreserveColor() && aCache->GetWrapperPreserveColor() == aReflector); // If proto != canonicalProto, we have to preserve our wrapper; // otherwise we won't be able to properly recreate it later, since // we won't know what proto to use. Note that we don't check // aGivenProto here, since it's entirely possible (and even // somewhat common) to have a non-null aGivenProto which is the // same as canonicalProto. if (proto != canonicalProto) { PreserveWrapper(aObject); } return true; } void CreateInterfaceObjects(JSContext* aCx, JS::Handle aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal) { JS::Heap* protoCache = &aProtoAndIfaceCache.EntrySlotOrCreate(prototypes::id::DOMMatrixReadOnly); JS::Heap* interfaceCache = &aProtoAndIfaceCache.EntrySlotOrCreate(constructors::id::DOMMatrixReadOnly); JS::Handle parentProto(JS::GetRealmObjectPrototypeHandle(aCx)); if (!parentProto) { return; } JS::Handle constructorProto(JS::GetRealmFunctionPrototypeHandle(aCx)); if (!constructorProto) { return; } dom::CreateInterfaceObjects(aCx, aGlobal, parentProto, &sPrototypeClass, protoCache, constructorProto, &sInterfaceObjectInfo, 0, false, Span{}, interfaceCache, sNativeProperties.Upcast(), nullptr, "DOMMatrixReadOnly", 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::DOMMatrixReadOnly, &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::DOMMatrixReadOnly, &CreateInterfaceObjects, DefineInterfaceProperty::CheckExposure); } } // namespace DOMMatrixReadOnly_Binding } // namespace mozilla::dom