Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM TestInterfaceObservableArray.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_TESTINTERFACEOBSERVABLEARRAYBINDING_H_
#define DOM_TESTINTERFACEOBSERVABLEARRAYBINDING_H_
#include "js/CallAndConstruct.h"
#include "jsapi.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackFunction.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
struct ObservableArrayCallbacksAtoms;
class ProtoAndIfaceCache;
class SetDeleteBooleanCallback;
class SetDeleteInterfaceCallback;
class SetDeleteObjectCallback;
class TestInterfaceObservableArray;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
struct ObservableArrayCallbacks : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteBooleanCallback>> mDeleteBooleanCallback;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteInterfaceCallback>> mDeleteInterfaceCallback;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteObjectCallback>> mDeleteObjectCallback;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteBooleanCallback>> mSetBooleanCallback;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteInterfaceCallback>> mSetInterfaceCallback;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<SetDeleteObjectCallback>> mSetObjectCallback;
ObservableArrayCallbacks();
explicit inline ObservableArrayCallbacks(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
ObservableArrayCallbacks(ObservableArrayCallbacks&& aOther) = default;
private:
ObservableArrayCallbacks(const ObservableArrayCallbacks&) = delete;
ObservableArrayCallbacks& operator=(const ObservableArrayCallbacks&) = delete;
static bool
InitIds(JSContext* cx, ObservableArrayCallbacksAtoms* atomsCache);
public:
bool
Init(BindingCallContext& cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
Init(JSContext* cx_, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
void
TraceDictionary(JSTracer* trc);
inline void
TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
{
ImplCycleCollectionTraverse(aCallback, mDeleteBooleanCallback, "mDeleteBooleanCallback", aFlags);
ImplCycleCollectionTraverse(aCallback, mDeleteInterfaceCallback, "mDeleteInterfaceCallback", aFlags);
ImplCycleCollectionTraverse(aCallback, mDeleteObjectCallback, "mDeleteObjectCallback", aFlags);
ImplCycleCollectionTraverse(aCallback, mSetBooleanCallback, "mSetBooleanCallback", aFlags);
ImplCycleCollectionTraverse(aCallback, mSetInterfaceCallback, "mSetInterfaceCallback", aFlags);
ImplCycleCollectionTraverse(aCallback, mSetObjectCallback, "mSetObjectCallback", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mDeleteBooleanCallback);
ImplCycleCollectionUnlink(mDeleteInterfaceCallback);
ImplCycleCollectionUnlink(mDeleteObjectCallback);
ImplCycleCollectionUnlink(mSetBooleanCallback);
ImplCycleCollectionUnlink(mSetInterfaceCallback);
ImplCycleCollectionUnlink(mSetObjectCallback);
}
};
namespace binding_detail {
struct FastObservableArrayCallbacks : public ObservableArrayCallbacks
{
inline FastObservableArrayCallbacks()
: ObservableArrayCallbacks(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class SetDeleteBooleanCallback : public CallbackFunction
{
public:
explicit inline SetDeleteBooleanCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteBooleanCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteBooleanCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteBooleanCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, bool value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteBooleanCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, value, index, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(bool value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteBooleanCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, value, index, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, bool value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(thisVal, value, index, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(bool value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(value, index, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const SetDeleteBooleanCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, bool value, uint32_t index, ErrorResult& aRv);
};
namespace binding_detail {
class FastSetDeleteBooleanCallback : public SetDeleteBooleanCallback
{
public:
explicit inline FastSetDeleteBooleanCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: SetDeleteBooleanCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
SetDeleteBooleanCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
SetDeleteBooleanCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
class SetDeleteInterfaceCallback : public CallbackFunction
{
public:
explicit inline SetDeleteInterfaceCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteInterfaceCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, TestInterfaceObservableArray& value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteInterfaceCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, value, index, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(TestInterfaceObservableArray& value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteInterfaceCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, value, index, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, TestInterfaceObservableArray& value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(thisVal, value, index, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(TestInterfaceObservableArray& value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(value, index, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const SetDeleteInterfaceCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, TestInterfaceObservableArray& value, uint32_t index, ErrorResult& aRv);
};
namespace binding_detail {
class FastSetDeleteInterfaceCallback : public SetDeleteInterfaceCallback
{
public:
explicit inline FastSetDeleteInterfaceCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: SetDeleteInterfaceCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
SetDeleteInterfaceCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
SetDeleteInterfaceCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
class SetDeleteObjectCallback : public CallbackFunction
{
public:
explicit inline SetDeleteObjectCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteObjectCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteObjectCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline SetDeleteObjectCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, JS::Handle<JSObject*> value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteObjectCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
JS::Rooted<JS::Value> thisValJS(s.GetContext());
if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
return Call(s.GetCallContext(), thisValJS, value, index, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(JS::Handle<JSObject*> value, uint32_t index, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
{
MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
if (!aExecutionReason) {
aExecutionReason = "SetDeleteObjectCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, value, index, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, JS::Handle<JSObject*> value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(thisVal, value, index, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(JS::Handle<JSObject*> value, uint32_t index, const char* aExecutionReason = nullptr)
{
return Call(value, index, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const SetDeleteObjectCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, JS::Handle<JSObject*> value, uint32_t index, ErrorResult& aRv);
};
namespace binding_detail {
class FastSetDeleteObjectCallback : public SetDeleteObjectCallback
{
public:
explicit inline FastSetDeleteObjectCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: SetDeleteObjectCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
SetDeleteObjectCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
SetDeleteObjectCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
namespace TestInterfaceObservableArray_Binding {
typedef mozilla::dom::TestInterfaceObservableArray NativeType;
namespace ObservableArrayBooleanHelpers {
bool
ElementAt(mozilla::dom::TestInterfaceObservableArray* self, uint32_t aIndex, ErrorResult& aRv);
void
ReplaceElementAt(mozilla::dom::TestInterfaceObservableArray* self, uint32_t aIndex, bool aValue, ErrorResult& aRv);
void
AppendElement(mozilla::dom::TestInterfaceObservableArray* self, bool aValue, ErrorResult& aRv);
void
RemoveLastElement(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
uint32_t
Length(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
} // namespace ObservableArrayBooleanHelpers
namespace ObservableArrayObjectHelpers {
void
ElementAt(mozilla::dom::TestInterfaceObservableArray* self, JSContext* cx, uint32_t aIndex, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv);
void
ReplaceElementAt(mozilla::dom::TestInterfaceObservableArray* self, uint32_t aIndex, JS::Handle<JSObject*> aValue, ErrorResult& aRv);
void
AppendElement(mozilla::dom::TestInterfaceObservableArray* self, JS::Handle<JSObject*> aValue, ErrorResult& aRv);
void
RemoveLastElement(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
uint32_t
Length(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
} // namespace ObservableArrayObjectHelpers
namespace ObservableArrayInterfaceHelpers {
already_AddRefed<TestInterfaceObservableArray>
ElementAt(mozilla::dom::TestInterfaceObservableArray* self, uint32_t aIndex, ErrorResult& aRv);
void
ReplaceElementAt(mozilla::dom::TestInterfaceObservableArray* self, uint32_t aIndex, TestInterfaceObservableArray& aValue, ErrorResult& aRv);
void
AppendElement(mozilla::dom::TestInterfaceObservableArray* self, TestInterfaceObservableArray& aValue, ErrorResult& aRv);
void
RemoveLastElement(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
uint32_t
Length(mozilla::dom::TestInterfaceObservableArray* self, ErrorResult& aRv);
} // namespace ObservableArrayInterfaceHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceObservableArray* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
template <class T>
inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
{
JS::Rooted<JSObject*> reflector(aCx);
return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
}
void
ClearCachedObservableArrayBooleanValue(mozilla::dom::TestInterfaceObservableArray* aObject);
void
ClearCachedObservableArrayObjectValue(mozilla::dom::TestInterfaceObservableArray* aObject);
void
ClearCachedObservableArrayInterfaceValue(mozilla::dom::TestInterfaceObservableArray* aObject);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, DefineInterfaceProperty aDefineOnGlobal);
JS::Handle<JSObject*>
GetConstructorObjectHandle(JSContext* aCx);
inline bool CreateAndDefineOnGlobal(JSContext* aCx)
{
// Get the interface or namespace object for this class. This will
// create the object as needed and always define the properties for
// it on the global. The caller should make sure the interface or
// namespace is exposed on the global before calling this.
return GetPerInterfaceObjectHandle(aCx, constructors::id::TestInterfaceObservableArray,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceObservableArray_Binding
} // namespace mozilla::dom
#endif // DOM_TESTINTERFACEOBSERVABLEARRAYBINDING_H_