Source code

Copy as Markdown

Other Tools

/* THIS FILE IS AUTOGENERATED FROM TestCallback.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_TESTCALLBACKBINDING_H_
#define DOM_TESTCALLBACKBINDING_H_
#include "js/CallAndConstruct.h"
#include "js/RootingAPI.h"
#include "js/TypeDecls.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackFunction.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/UnionTypes.h"
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class OwningStringOrLong;
class ProtoAndIfaceCache;
class StringOrLong;
class TestUnionArguments;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
class TestUnionArguments : public CallbackFunction
{
public:
explicit inline TestUnionArguments(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestUnionArguments(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestUnionArguments(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestUnionArguments(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const StringOrLong& arg1, const Nullable<StringOrLong>& arg2, const Optional<StringOrLong>& arg3, const Optional<Nullable<StringOrLong>>& arg4, 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 = "TestUnionArguments";
}
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, arg1, arg2, arg3, arg4, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const StringOrLong& arg1, const Nullable<StringOrLong>& arg2, const Optional<StringOrLong>& arg3, const Optional<Nullable<StringOrLong>>& arg4, 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 = "TestUnionArguments";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, arg1, arg2, arg3, arg4, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const StringOrLong& arg1, const Nullable<StringOrLong>& arg2, const Optional<StringOrLong>& arg3, const Optional<Nullable<StringOrLong>>& arg4, const char* aExecutionReason = nullptr)
{
return Call(thisVal, arg1, arg2, arg3, arg4, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const StringOrLong& arg1, const Nullable<StringOrLong>& arg2, const Optional<StringOrLong>& arg3, const Optional<Nullable<StringOrLong>>& arg4, const char* aExecutionReason = nullptr)
{
return Call(arg1, arg2, arg3, arg4, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const TestUnionArguments& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, const StringOrLong& arg1, const Nullable<StringOrLong>& arg2, const Optional<StringOrLong>& arg3, const Optional<Nullable<StringOrLong>>& arg4, ErrorResult& aRv);
};
namespace binding_detail {
class FastTestUnionArguments : public TestUnionArguments
{
public:
explicit inline FastTestUnionArguments(JSObject* aCallback, JSObject* aCallbackGlobal)
: TestUnionArguments(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
TestUnionArguments::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
TestUnionArguments::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
} // namespace mozilla::dom
#endif // DOM_TESTCALLBACKBINDING_H_