Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM PromiseDebugging.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_PROMISEDEBUGGINGBINDING_H_
#define DOM_PROMISEDEBUGGINGBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Span.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class PromiseDebugging;
struct PromiseDebuggingStateHolderAtoms;
class ProtoAndIfaceCache;
class UncaughtRejectionObserver;
struct UncaughtRejectionObserverAtoms;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
enum class PromiseDebuggingState : uint8_t {
Pending,
Fulfilled,
Rejected,
};
namespace binding_detail {
template <> struct EnumStrings<PromiseDebuggingState> {
static const nsLiteralCString Values[3];
};
} // namespace binding_detail
bool
ToJSValue(JSContext* aCx, PromiseDebuggingState aArgument, JS::MutableHandle<JS::Value> aValue);
struct PromiseDebuggingStateHolder : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR JS::Value mReason;
MOZ_INIT_OUTSIDE_CTOR PromiseDebuggingState mState;
MOZ_INIT_OUTSIDE_CTOR JS::Value mValue;
PromiseDebuggingStateHolder();
explicit inline PromiseDebuggingStateHolder(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
PromiseDebuggingStateHolder(PromiseDebuggingStateHolder&& aOther) = default;
private:
PromiseDebuggingStateHolder(const PromiseDebuggingStateHolder&) = delete;
PromiseDebuggingStateHolder& operator=(const PromiseDebuggingStateHolder&) = delete;
static bool
InitIds(JSContext* cx, PromiseDebuggingStateHolderAtoms* atomsCache);
public:
bool
Init(const char* sourceDescription = "Value", bool passedToJSImpl = false);
bool
ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
void
TraceDictionary(JSTracer* trc);
};
namespace binding_detail {
struct FastPromiseDebuggingStateHolder : public PromiseDebuggingStateHolder
{
inline FastPromiseDebuggingStateHolder()
: PromiseDebuggingStateHolder(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
namespace PromiseDebugging_Binding {
typedef mozilla::dom::PromiseDebugging NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
void
CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
{
/* Get the interface object for this class. This will create the object as
needed. */
return GetPerInterfaceObjectHandle(aCx, constructors::id::PromiseDebugging,
&CreateInterfaceObjects,
aDefineOnGlobal);
}
JSObject*
GetConstructorObject(JSContext* aCx);
} // namespace PromiseDebugging_Binding
class UncaughtRejectionObserver : public CallbackInterface
{
public:
explicit inline UncaughtRejectionObserver(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
}
explicit inline UncaughtRejectionObserver(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackInterface(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
explicit inline UncaughtRejectionObserver(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackInterface(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
}
bool OnLeftUncaught(JS::Handle<JSObject*> p, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr);
void OnConsumed(JS::Handle<JSObject*> p, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr);
inline bool
operator==(const UncaughtRejectionObserver& aOther) const
{
return CallbackInterface::operator==(aOther);
}
private:
static bool
InitIds(JSContext* cx, UncaughtRejectionObserverAtoms* atomsCache);
};
namespace binding_detail {
class FastUncaughtRejectionObserver : public UncaughtRejectionObserver
{
public:
explicit inline FastUncaughtRejectionObserver(JSObject* aCallback, JSObject* aCallbackGlobal)
: UncaughtRejectionObserver(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
UncaughtRejectionObserver::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
UncaughtRejectionObserver::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
} // namespace dom
template <>
struct MaxContiguousEnumValue<dom::PromiseDebuggingState>
{
static constexpr dom::PromiseDebuggingState value = dom::PromiseDebuggingState::Rejected;
static_assert(static_cast<uint8_t>(dom::PromiseDebuggingState::Pending) == 0,
"We rely on this in ContiguousEnumValues");
static_assert(mozilla::ArrayLength(dom::binding_detail::EnumStrings<dom::PromiseDebuggingState>::Values) - 1 == UnderlyingValue(value),
"Mismatch between enum strings and enum count");
};
} // namespace mozilla
#endif // DOM_PROMISEDEBUGGINGBINDING_H_