Copy as Markdown
Other Tools
/* THIS FILE IS AUTOGENERATED FROM TestInterfaceJSMaplikeSetlikeIterable.webidl BY Codegen.py - DO NOT EDIT */
#ifndef DOM_TESTINTERFACEJSMAPLIKESETLIKEITERABLEBINDING_H_
#define DOM_TESTINTERFACEJSMAPLIKESETLIKEITERABLEBINDING_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/Promise.h"
#include "mozilla/dom/PrototypeList.h"
#include "mozilla/dom/ToJSValue.h"
class nsINode;
namespace mozilla {
namespace dom {
struct NativePropertyHooks;
class OwningStringOrLong;
class Promise;
class ProtoAndIfaceCache;
class StringOrLong;
class TestInterfaceAsyncIterableDouble;
class TestInterfaceAsyncIterableDoubleUnion;
class TestInterfaceAsyncIterableSingle;
struct TestInterfaceAsyncIterableSingleOptionsAtoms;
class TestInterfaceAsyncIterableSingleWithArgs;
struct TestInterfaceAsyncIteratorOptionsAtoms;
class TestInterfaceIterableDouble;
class TestInterfaceIterableDoubleUnion;
class TestInterfaceIterableSingle;
class TestInterfaceMaplike;
class TestInterfaceMaplikeJSObject;
class TestInterfaceMaplikeObject;
class TestInterfaceSetlike;
class TestInterfaceSetlikeNode;
class TestThrowingCallback;
} // namespace dom
} // namespace mozilla
namespace mozilla::dom {
struct TestInterfaceAsyncIterableSingleOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR bool mFailToInit;
TestInterfaceAsyncIterableSingleOptions();
explicit inline TestInterfaceAsyncIterableSingleOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
TestInterfaceAsyncIterableSingleOptions(TestInterfaceAsyncIterableSingleOptions&& aOther) = default;
explicit inline TestInterfaceAsyncIterableSingleOptions(const TestInterfaceAsyncIterableSingleOptions& aOther)
{
*this = aOther;
}
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);
TestInterfaceAsyncIterableSingleOptions&
operator=(const TestInterfaceAsyncIterableSingleOptions& aOther);
private:
static bool
InitIds(JSContext* cx, TestInterfaceAsyncIterableSingleOptionsAtoms* atomsCache);
};
namespace binding_detail {
struct FastTestInterfaceAsyncIterableSingleOptions : public TestInterfaceAsyncIterableSingleOptions
{
inline FastTestInterfaceAsyncIterableSingleOptions()
: TestInterfaceAsyncIterableSingleOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
struct TestInterfaceAsyncIteratorOptions : public DictionaryBase
{
MOZ_INIT_OUTSIDE_CTOR Sequence<OwningNonNull<Promise>> mBlockingPromises;
MOZ_INIT_OUTSIDE_CTOR uint32_t mFailNextAfter;
MOZ_INIT_OUTSIDE_CTOR uint32_t mMultiplier;
MOZ_INIT_OUTSIDE_CTOR bool mThrowFromNext;
MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<TestThrowingCallback>> mThrowFromReturn;
TestInterfaceAsyncIteratorOptions();
explicit inline TestInterfaceAsyncIteratorOptions(const FastDictionaryInitializer& )
{
// Do nothing here; this is used by our "Fast" subclass
}
TestInterfaceAsyncIteratorOptions(TestInterfaceAsyncIteratorOptions&& aOther) = default;
private:
TestInterfaceAsyncIteratorOptions(const TestInterfaceAsyncIteratorOptions&) = delete;
TestInterfaceAsyncIteratorOptions& operator=(const TestInterfaceAsyncIteratorOptions&) = delete;
static bool
InitIds(JSContext* cx, TestInterfaceAsyncIteratorOptionsAtoms* 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, mBlockingPromises, "mBlockingPromises", aFlags);
ImplCycleCollectionTraverse(aCallback, mThrowFromReturn, "mThrowFromReturn", aFlags);
}
inline void
UnlinkForCC()
{
ImplCycleCollectionUnlink(mBlockingPromises);
ImplCycleCollectionUnlink(mThrowFromReturn);
}
};
namespace binding_detail {
struct FastTestInterfaceAsyncIteratorOptions : public TestInterfaceAsyncIteratorOptions
{
inline FastTestInterfaceAsyncIteratorOptions()
: TestInterfaceAsyncIteratorOptions(FastDictionaryInitializer())
{
// Doesn't matter what int we pass to the parent constructor
}
};
} // namespace binding_detail
class TestThrowingCallback : public CallbackFunction
{
public:
explicit inline TestThrowingCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestThrowingCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
: CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestThrowingCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
: CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
{
MOZ_ASSERT(JS::IsCallable(mCallback));
}
explicit inline TestThrowingCallback(CallbackFunction* aOther)
: CallbackFunction(aOther)
{
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, 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 = "TestThrowingCallback";
}
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, aRv);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(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 = "TestThrowingCallback";
}
CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
if (!s.GetContext()) {
MOZ_ASSERT(aRv.Failed());
return;
}
return Call(s.GetCallContext(), JS::UndefinedHandleValue, aRv);
}
template <typename T>
MOZ_CAN_RUN_SCRIPT inline void
Call(const T& thisVal, const char* aExecutionReason = nullptr)
{
return Call(thisVal, IgnoreErrors(), aExecutionReason);
}
MOZ_CAN_RUN_SCRIPT inline void
Call(const char* aExecutionReason = nullptr)
{
return Call(IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
}
inline bool
operator==(const TestThrowingCallback& aOther) const
{
return CallbackFunction::operator==(aOther);
}
private:
MOZ_CAN_RUN_SCRIPT void Call(BindingCallContext& cx, JS::Handle<JS::Value> aThisVal, ErrorResult& aRv);
};
namespace binding_detail {
class FastTestThrowingCallback : public TestThrowingCallback
{
public:
explicit inline FastTestThrowingCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
: TestThrowingCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
{
}
inline void
Trace(JSTracer* aTracer)
{
TestThrowingCallback::Trace(aTracer);
}
inline void
FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
{
TestThrowingCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
}
};
} // namespace binding_detail
namespace TestInterfaceAsyncIterableDouble_Binding {
typedef mozilla::dom::TestInterfaceAsyncIterableDouble NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceAsyncIterableDouble* 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
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::TestInterfaceAsyncIterableDouble,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceAsyncIterableDouble_Binding
namespace TestInterfaceAsyncIterableDoubleUnion_Binding {
typedef mozilla::dom::TestInterfaceAsyncIterableDoubleUnion NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceAsyncIterableDoubleUnion* 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
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::TestInterfaceAsyncIterableDoubleUnion,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceAsyncIterableDoubleUnion_Binding
namespace TestInterfaceAsyncIterableSingle_Binding {
typedef mozilla::dom::TestInterfaceAsyncIterableSingle NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceAsyncIterableSingle* 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
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::TestInterfaceAsyncIterableSingle,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceAsyncIterableSingle_Binding
namespace TestInterfaceAsyncIterableSingleWithArgs_Binding {
typedef mozilla::dom::TestInterfaceAsyncIterableSingleWithArgs NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceAsyncIterableSingleWithArgs* 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
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::TestInterfaceAsyncIterableSingleWithArgs,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceAsyncIterableSingleWithArgs_Binding
namespace TestInterfaceIterableDouble_Binding {
typedef mozilla::dom::TestInterfaceIterableDouble NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceIterableDouble* 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
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::TestInterfaceIterableDouble,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceIterableDouble_Binding
namespace TestInterfaceIterableDoubleUnion_Binding {
typedef mozilla::dom::TestInterfaceIterableDoubleUnion NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceIterableDoubleUnion* 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
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::TestInterfaceIterableDoubleUnion,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceIterableDoubleUnion_Binding
namespace TestInterfaceIterableSingle_Binding {
typedef mozilla::dom::TestInterfaceIterableSingle NativeType;
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceIterableSingle* 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
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::TestInterfaceIterableSingle,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceIterableSingle_Binding
namespace TestInterfaceMaplike_Binding {
typedef mozilla::dom::TestInterfaceMaplike NativeType;
namespace MaplikeHelpers {
void
Clear(mozilla::dom::TestInterfaceMaplike* self, ErrorResult& aRv);
bool
Delete(mozilla::dom::TestInterfaceMaplike* self, const nsAString& aKey, ErrorResult& aRv);
bool
Has(mozilla::dom::TestInterfaceMaplike* self, const nsAString& aKey, ErrorResult& aRv);
void
Set(mozilla::dom::TestInterfaceMaplike* self, const nsAString& aKey, int32_t aValue, ErrorResult& aRv);
int32_t
Get(mozilla::dom::TestInterfaceMaplike* self, const nsAString& aKey, ErrorResult& aRv);
} // namespace MaplikeHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceMaplike* 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
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::TestInterfaceMaplike,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceMaplike_Binding
namespace TestInterfaceMaplikeJSObject_Binding {
typedef mozilla::dom::TestInterfaceMaplikeJSObject NativeType;
namespace MaplikeHelpers {
void
Clear(mozilla::dom::TestInterfaceMaplikeJSObject* self, ErrorResult& aRv);
bool
Delete(mozilla::dom::TestInterfaceMaplikeJSObject* self, const nsAString& aKey, ErrorResult& aRv);
bool
Has(mozilla::dom::TestInterfaceMaplikeJSObject* self, const nsAString& aKey, ErrorResult& aRv);
void
Set(mozilla::dom::TestInterfaceMaplikeJSObject* self, const nsAString& aKey, JS::Handle<JSObject*> aValue, ErrorResult& aRv);
void
Get(mozilla::dom::TestInterfaceMaplikeJSObject* self, JSContext* cx, const nsAString& aKey, JS::MutableHandle<JSObject*> aRetVal, ErrorResult& aRv);
} // namespace MaplikeHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceMaplikeJSObject* 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
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::TestInterfaceMaplikeJSObject,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceMaplikeJSObject_Binding
namespace TestInterfaceMaplikeObject_Binding {
typedef mozilla::dom::TestInterfaceMaplikeObject NativeType;
namespace MaplikeHelpers {
void
Clear(mozilla::dom::TestInterfaceMaplikeObject* self, ErrorResult& aRv);
bool
Delete(mozilla::dom::TestInterfaceMaplikeObject* self, const nsAString& aKey, ErrorResult& aRv);
bool
Has(mozilla::dom::TestInterfaceMaplikeObject* self, const nsAString& aKey, ErrorResult& aRv);
void
Set(mozilla::dom::TestInterfaceMaplikeObject* self, const nsAString& aKey, TestInterfaceMaplike& aValue, ErrorResult& aRv);
already_AddRefed<TestInterfaceMaplike>
Get(mozilla::dom::TestInterfaceMaplikeObject* self, const nsAString& aKey, ErrorResult& aRv);
} // namespace MaplikeHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceMaplikeObject* 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
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::TestInterfaceMaplikeObject,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceMaplikeObject_Binding
namespace TestInterfaceSetlike_Binding {
typedef mozilla::dom::TestInterfaceSetlike NativeType;
namespace SetlikeHelpers {
void
Clear(mozilla::dom::TestInterfaceSetlike* self, ErrorResult& aRv);
bool
Delete(mozilla::dom::TestInterfaceSetlike* self, const nsAString& aKey, ErrorResult& aRv);
bool
Has(mozilla::dom::TestInterfaceSetlike* self, const nsAString& aKey, ErrorResult& aRv);
void
Add(mozilla::dom::TestInterfaceSetlike* self, const nsAString& aKey, ErrorResult& aRv);
} // namespace SetlikeHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceSetlike* 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
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::TestInterfaceSetlike,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceSetlike_Binding
namespace TestInterfaceSetlikeNode_Binding {
typedef mozilla::dom::TestInterfaceSetlikeNode NativeType;
namespace SetlikeHelpers {
void
Clear(mozilla::dom::TestInterfaceSetlikeNode* self, ErrorResult& aRv);
bool
Delete(mozilla::dom::TestInterfaceSetlikeNode* self, nsINode& aKey, ErrorResult& aRv);
bool
Has(mozilla::dom::TestInterfaceSetlikeNode* self, nsINode& aKey, ErrorResult& aRv);
void
Add(mozilla::dom::TestInterfaceSetlikeNode* self, nsINode& aKey, ErrorResult& aRv);
} // namespace SetlikeHelpers
bool
ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
bool
Wrap(JSContext* aCx, mozilla::dom::TestInterfaceSetlikeNode* 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
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::TestInterfaceSetlikeNode,
&CreateInterfaceObjects,
DefineInterfaceProperty::Always);
}
} // namespace TestInterfaceSetlikeNode_Binding
} // namespace mozilla::dom
#endif // DOM_TESTINTERFACEJSMAPLIKESETLIKEITERABLEBINDING_H_