Bug 755080 part 3. Exercise castable interface types a bit. r=peterv

This commit is contained in:
Boris Zbarsky 2012-05-23 12:44:48 -04:00
parent b711131bec
commit e55db2b828
3 changed files with 32 additions and 4 deletions

View File

@ -245,6 +245,7 @@ DOMInterfaces = {
'TestInterface' : {
'nativeType': 'mozilla::dom::TestInterface',
'headerFile': 'TestBindingHeader.h',
'register': False
'register': False,
'resultNotAddRefed': [ 'receiveWeakSelf', 'receiveWeakNullableSelf' ]
}
}

View File

@ -9,6 +9,8 @@
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingUtils.h"
#include "nsCOMPtr.h"
namespace mozilla {
namespace dom {
@ -71,6 +73,18 @@ public:
void PassUnsignedLongLong(uint64_t, ErrorResult&);
uint64_t ReceiveUnsignedLongLong(ErrorResult&);
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&);
private:
// 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

View File

@ -6,6 +6,7 @@
interface TestInterface {
// Integer types
// XXXbz add tests for infallible versions of all the integer stuff
readonly attribute byte readonlyByte;
attribute byte writableByte;
void passByte(byte arg);
@ -46,6 +47,18 @@ interface TestInterface {
void passUnsignedLongLong(unsigned long long arg);
unsigned long long receiveUnsignedLongLong();
// Castable interface type
// Castable interface types
// XXXbz add tests for infallible versions of all the castable interface stuff
TestInterface receiveSelf();
TestInterface? receiveNullableSelf();
TestInterface receiveWeakSelf();
TestInterface? receiveWeakNullableSelf();
// A verstion to test for casting to TestInterface&
void passSelf(TestInterface arg);
// A version we can use to test for the exact type passed in
void passSelf2(TestInterface arg);
void passNullableSelf(TestInterface? arg);
attribute TestInterface nonNullSelf;
attribute TestInterface? nullableSelf;
};