2012-05-23 09:44:48 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TestBindingHeader_h
|
|
|
|
#define TestBindingHeader_h
|
|
|
|
|
|
|
|
#include "nsWrapperCache.h"
|
2012-05-23 09:44:48 -07:00
|
|
|
#include "mozilla/ErrorResult.h"
|
2012-05-23 09:44:48 -07:00
|
|
|
#include "mozilla/dom/BindingUtils.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-05-23 09:44:48 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2012-05-29 20:45:18 -07:00
|
|
|
// IID for the TestNonCastableInterface
|
|
|
|
#define NS_TEST_NONCASTABLE_INTERFACE_IID \
|
|
|
|
{ 0x7c9f8ee2, 0xc9bf, 0x46ca, \
|
|
|
|
{ 0xa0, 0xa9, 0x03, 0xa8, 0xd6, 0x30, 0x0e, 0xde } }
|
|
|
|
|
|
|
|
class TestNonCastableInterface : public nsISupports,
|
|
|
|
public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEST_NONCASTABLE_INTERFACE_IID)
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// We need a GetParentObject to make binding codegen happy
|
|
|
|
virtual nsISupports* GetParentObject();
|
|
|
|
};
|
|
|
|
|
|
|
|
// IID for the TestExternalInterface
|
|
|
|
#define NS_TEST_EXTERNAL_INTERFACE_IID \
|
|
|
|
{ 0xd5ba0c99, 0x9b1d, 0x4e71, \
|
|
|
|
{ 0x8a, 0x94, 0x56, 0x38, 0x6c, 0xa3, 0xda, 0x3d } }
|
|
|
|
class TestExternalInterface : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEST_EXTERNAL_INTERFACE_IID)
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
};
|
|
|
|
|
2012-05-23 09:44:48 -07:00
|
|
|
class TestInterface : public nsISupports,
|
2012-05-29 20:45:18 -07:00
|
|
|
public nsWrapperCache
|
2012-05-23 09:44:48 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2012-05-23 09:44:48 -07:00
|
|
|
// We need a GetParentObject to make binding codegen happy
|
2012-05-23 09:44:48 -07:00
|
|
|
virtual nsISupports* GetParentObject();
|
|
|
|
|
2012-05-23 09:44:48 -07:00
|
|
|
// And now our actual WebIDL API
|
|
|
|
int8_t GetReadonlyByte(ErrorResult&);
|
|
|
|
int8_t GetWritableByte(ErrorResult&);
|
|
|
|
void SetWritableByte(int8_t, ErrorResult&);
|
|
|
|
void PassByte(int8_t, ErrorResult&);
|
|
|
|
int8_t ReceiveByte(ErrorResult&);
|
|
|
|
|
|
|
|
int16_t GetReadonlyShort(ErrorResult&);
|
|
|
|
int16_t GetWritableShort(ErrorResult&);
|
|
|
|
void SetWritableShort(int16_t, ErrorResult&);
|
|
|
|
void PassShort(int16_t, ErrorResult&);
|
|
|
|
int16_t ReceiveShort(ErrorResult&);
|
|
|
|
|
|
|
|
int32_t GetReadonlyLong(ErrorResult&);
|
|
|
|
int32_t GetWritableLong(ErrorResult&);
|
|
|
|
void SetWritableLong(int32_t, ErrorResult&);
|
|
|
|
void PassLong(int32_t, ErrorResult&);
|
|
|
|
int16_t ReceiveLong(ErrorResult&);
|
|
|
|
|
|
|
|
int64_t GetReadonlyLongLong(ErrorResult&);
|
|
|
|
int64_t GetWritableLongLong(ErrorResult&);
|
|
|
|
void SetWritableLongLong(int64_t, ErrorResult&);
|
|
|
|
void PassLongLong(int64_t, ErrorResult&);
|
|
|
|
int64_t ReceiveLongLong(ErrorResult&);
|
|
|
|
|
|
|
|
uint8_t GetReadonlyOctet(ErrorResult&);
|
|
|
|
uint8_t GetWritableOctet(ErrorResult&);
|
|
|
|
void SetWritableOctet(uint8_t, ErrorResult&);
|
|
|
|
void PassOctet(uint8_t, ErrorResult&);
|
|
|
|
uint8_t ReceiveOctet(ErrorResult&);
|
|
|
|
|
|
|
|
uint16_t GetReadonlyUnsignedShort(ErrorResult&);
|
|
|
|
uint16_t GetWritableUnsignedShort(ErrorResult&);
|
|
|
|
void SetWritableUnsignedShort(uint16_t, ErrorResult&);
|
|
|
|
void PassUnsignedShort(uint16_t, ErrorResult&);
|
|
|
|
uint16_t ReceiveUnsignedShort(ErrorResult&);
|
|
|
|
|
|
|
|
uint32_t GetReadonlyUnsignedLong(ErrorResult&);
|
|
|
|
uint32_t GetWritableUnsignedLong(ErrorResult&);
|
|
|
|
void SetWritableUnsignedLong(uint32_t, ErrorResult&);
|
|
|
|
void PassUnsignedLong(uint32_t, ErrorResult&);
|
|
|
|
uint32_t ReceiveUnsignedLong(ErrorResult&);
|
|
|
|
|
|
|
|
uint64_t GetReadonlyUnsignedLongLong(ErrorResult&);
|
|
|
|
uint64_t GetWritableUnsignedLongLong(ErrorResult&);
|
|
|
|
void SetWritableUnsignedLongLong(uint64_t, ErrorResult&);
|
|
|
|
void PassUnsignedLongLong(uint64_t, ErrorResult&);
|
|
|
|
uint64_t ReceiveUnsignedLongLong(ErrorResult&);
|
2012-05-23 09:44:48 -07:00
|
|
|
|
|
|
|
already_AddRefed<TestInterface> ReceiveSelf(ErrorResult&);
|
|
|
|
already_AddRefed<TestInterface> ReceiveNullableSelf(ErrorResult&);
|
|
|
|
TestInterface* ReceiveWeakSelf(ErrorResult&);
|
|
|
|
TestInterface* ReceiveWeakNullableSelf(ErrorResult&);
|
|
|
|
void PassSelf(TestInterface&, ErrorResult&);
|
|
|
|
void PassSelf2(NonNull<TestInterface>&, ErrorResult&);
|
|
|
|
void PassNullableSelf(TestInterface*, ErrorResult&);
|
|
|
|
already_AddRefed<TestInterface> GetNonNullSelf(ErrorResult&);
|
|
|
|
void SetNonNullSelf(TestInterface&, ErrorResult&);
|
|
|
|
already_AddRefed<TestInterface> GetNullableSelf(ErrorResult&);
|
|
|
|
void SetNullableSelf(TestInterface*, ErrorResult&);
|
2012-05-24 22:08:26 -07:00
|
|
|
|
2012-05-29 20:45:18 -07:00
|
|
|
already_AddRefed<TestNonCastableInterface> ReceiveOther(ErrorResult&);
|
|
|
|
already_AddRefed<TestNonCastableInterface> ReceiveNullableOther(ErrorResult&);
|
|
|
|
TestNonCastableInterface* ReceiveWeakOther(ErrorResult&);
|
|
|
|
TestNonCastableInterface* ReceiveWeakNullableOther(ErrorResult&);
|
|
|
|
void PassOther(TestNonCastableInterface&, ErrorResult&);
|
|
|
|
void PassOther2(NonNull<TestNonCastableInterface>&, ErrorResult&);
|
|
|
|
void PassNullableOther(TestNonCastableInterface*, ErrorResult&);
|
|
|
|
already_AddRefed<TestNonCastableInterface> GetNonNullOther(ErrorResult&);
|
|
|
|
void SetNonNullOther(TestNonCastableInterface&, ErrorResult&);
|
|
|
|
already_AddRefed<TestNonCastableInterface> GetNullableOther(ErrorResult&);
|
|
|
|
void SetNullableOther(TestNonCastableInterface*, ErrorResult&);
|
|
|
|
|
|
|
|
already_AddRefed<TestExternalInterface> ReceiveExternal(ErrorResult&);
|
|
|
|
already_AddRefed<TestExternalInterface> ReceiveNullableExternal(ErrorResult&);
|
|
|
|
TestExternalInterface* ReceiveWeakExternal(ErrorResult&);
|
|
|
|
TestExternalInterface* ReceiveWeakNullableExternal(ErrorResult&);
|
|
|
|
void PassExternal(TestExternalInterface*, ErrorResult&);
|
|
|
|
void PassExternal2(TestExternalInterface*, ErrorResult&);
|
|
|
|
void PassNullableExternal(TestExternalInterface*, ErrorResult&);
|
|
|
|
already_AddRefed<TestExternalInterface> GetNonNullExternal(ErrorResult&);
|
|
|
|
void SetNonNullExternal(TestExternalInterface*, ErrorResult&);
|
|
|
|
already_AddRefed<TestExternalInterface> GetNullableExternal(ErrorResult&);
|
|
|
|
void SetNullableExternal(TestExternalInterface*, ErrorResult&);
|
|
|
|
|
2012-05-24 22:08:26 -07:00
|
|
|
void ReceiveSequence(nsTArray<int32_t>&, ErrorResult&);
|
|
|
|
void ReceiveNullableSequence(Nullable< nsTArray<int32_t> >&, ErrorResult&);
|
|
|
|
void PassSequence(const Sequence<int32_t> &, ErrorResult&);
|
|
|
|
void PassNullableSequence(const Nullable< Sequence<int32_t> >&, ErrorResult&);
|
|
|
|
// XXXbz is this the right signature???? For all the sequence
|
|
|
|
// "receive" methods here! Shouldn't we take strong refs?
|
|
|
|
void ReceiveCastableObjectSequence(nsTArray< nsRefPtr<TestInterface> > &,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveNullableCastableObjectSequence(nsTArray< nsRefPtr<TestInterface> > &,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveCastableObjectNullableSequence(Nullable< nsTArray< nsRefPtr<TestInterface> > >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveWeakNullableCastableObjectNullableSequence(Nullable< nsTArray< nsRefPtr<TestInterface> > >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveNullableCastableObjectNullableSequence(Nullable< nsTArray< nsRefPtr<TestInterface> > >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveWeakCastableObjectSequence(nsTArray<TestInterface*> &,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveWeakNullableCastableObjectSequence(nsTArray<TestInterface*> &,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveWeakCastableObjectNullableSequence(Nullable< nsTArray<TestInterface*> >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void ReceiveWeakNullableCastableObjectNullableSequence(Nullable< nsTArray<TestInterface*> >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void PassCastableObjectSequence(const Sequence< OwningNonNull<TestInterface> >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void PassNullableCastableObjectSequence(const Sequence< nsRefPtr<TestInterface> > &,
|
|
|
|
ErrorResult&);
|
|
|
|
void PassCastableObjectNullableSequence(const Nullable< Sequence< OwningNonNull<TestInterface> > >&,
|
|
|
|
ErrorResult&);
|
|
|
|
void PassNullableCastableObjectNullableSequence(const Nullable< Sequence< nsRefPtr<TestInterface> > >&,
|
|
|
|
ErrorResult&);
|
2012-05-23 09:44:48 -07:00
|
|
|
private:
|
2012-05-23 09:44:48 -07:00
|
|
|
// We add signatures here that _could_ start matching if the codegen
|
|
|
|
// got data types wrong. That way if it ever does we'll have a call
|
|
|
|
// to these private deleted methods and compilation will fail.
|
|
|
|
void SetReadonlyByte(int8_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableByte(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassByte(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyShort(int16_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableShort(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassShort(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyLong(int32_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyLongLong(int64_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableLongLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassLongLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyOctet(uint8_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableOctet(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassOctet(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyUnsignedShort(uint16_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableUnsignedShort(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassUnsignedShort(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyUnsignedLong(uint32_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableUnsignedLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassUnsignedLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
|
|
|
|
void SetReadonlyUnsignedLongLong(uint64_t, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void SetWritableUnsignedLongLong(T, ErrorResult&) MOZ_DELETE;
|
|
|
|
template<typename T>
|
|
|
|
void PassUnsignedLongLong(T, ErrorResult&) MOZ_DELETE;
|
2012-05-24 22:08:26 -07:00
|
|
|
|
|
|
|
void PassSequence(Sequence<int32_t> &, ErrorResult&) MOZ_DELETE;
|
|
|
|
void PassNullableSequence(Nullable< Sequence<int32_t> >&, ErrorResult&) MOZ_DELETE;
|
2012-05-23 09:44:48 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* TestBindingHeader_h */
|