From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- dom/bindings/test/TestBindingHeader.h | 1804 +++++++++++++++++++++++++++++++++ 1 file changed, 1804 insertions(+) create mode 100644 dom/bindings/test/TestBindingHeader.h (limited to 'dom/bindings/test/TestBindingHeader.h') diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h new file mode 100644 index 0000000000..4a7ea91ee8 --- /dev/null +++ b/dom/bindings/test/TestBindingHeader.h @@ -0,0 +1,1804 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 "mozilla/dom/BindingUtils.h" +#include "mozilla/dom/Record.h" +#include "mozilla/dom/TypedArray.h" +#include "mozilla/ErrorResult.h" +#include "nsCOMPtr.h" +#include "nsGenericHTMLElement.h" +#include "nsWrapperCache.h" +#include "js/Object.h" // JS::GetClass + +// Forward declare this before we include TestCodeGenBinding.h, because that +// header relies on including this one for it, for ParentDict. Hopefully it +// won't begin to rely on it in more fundamental ways. +namespace mozilla { +namespace dom { +class DocGroup; +class TestExternalInterface; +class TestUnionArguments; +class Promise; +} // namespace dom +} // namespace mozilla + +// We don't export TestCodeGenBinding.h, but it's right in our parent dir. +#include "../TestCodeGenBinding.h" + +extern bool TestFuncControlledMember(JSContext*, JSObject*); + +namespace mozilla { +namespace dom { + +// IID for nsRenamedInterface +#define NS_RENAMED_INTERFACE_IID \ + { \ + 0xd4b19ef3, 0xe68b, 0x4e3f, { \ + 0x94, 0xbc, 0xc9, 0xde, 0x3a, 0x69, 0xb0, 0xe8 \ + } \ + } + +class nsRenamedInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_RENAMED_INTERFACE_IID) + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(nsRenamedInterface, NS_RENAMED_INTERFACE_IID) + +// 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 +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(TestExternalInterface, + NS_TEST_EXTERNAL_INTERFACE_IID) + +class TestNonWrapperCacheInterface : public nsISupports { + public: + NS_DECL_ISUPPORTS + + bool WrapObject(JSContext* aCx, JS::Handle aGivenProto, + JS::MutableHandle aReflector); +}; + +class OnlyForUseInConstructor : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); +}; + +class TestInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject and GetDocGroup to make binding codegen happy + virtual nsISupports* GetParentObject(); + DocGroup* GetDocGroup() const; + + // And now our actual WebIDL API + // Constructors + static already_AddRefed Constructor(const GlobalObject&); + static already_AddRefed Constructor(const GlobalObject&, + const nsAString&); + static already_AddRefed Constructor(const GlobalObject&, + uint32_t, + const Nullable&); + static already_AddRefed Constructor(const GlobalObject&, + TestInterface*); + static already_AddRefed Constructor(const GlobalObject&, + uint32_t, TestInterface&); + + static already_AddRefed Constructor(const GlobalObject&, + const ArrayBuffer&); + static already_AddRefed Constructor(const GlobalObject&, + const Uint8Array&); + /* static + already_AddRefed + Constructor(const GlobalObject&, uint32_t, uint32_t, + const TestInterfaceOrOnlyForUseInConstructor&); + */ + + static already_AddRefed Test(const GlobalObject&, + ErrorResult&); + static already_AddRefed Test(const GlobalObject&, + const nsAString&, ErrorResult&); + static already_AddRefed Test(const GlobalObject&, + const nsACString&, ErrorResult&); + + static already_AddRefed Test2( + const GlobalObject&, const DictForConstructor&, JS::Handle, + JS::Handle, JS::Handle, const Sequence&, + JS::Handle, const Optional>&, + const Optional>&, ErrorResult&); + + static already_AddRefed Test3(const GlobalObject&, + const LongOrStringAnyRecord&, + ErrorResult&); + + static already_AddRefed Test4( + const GlobalObject&, const Record>&, + ErrorResult&); + + static already_AddRefed Test5( + const GlobalObject&, + const Record< + nsString, + Sequence>>>>>&, + ErrorResult&); + + static already_AddRefed Test6( + const GlobalObject&, + const Sequence>>>>>&, + ErrorResult&); + + // Integer types + int8_t ReadonlyByte(); + int8_t WritableByte(); + void SetWritableByte(int8_t); + void PassByte(int8_t); + int8_t ReceiveByte(); + void PassOptionalByte(const Optional&); + void PassOptionalByteBeforeRequired(const Optional&, int8_t); + void PassOptionalByteWithDefault(int8_t); + void PassOptionalByteWithDefaultBeforeRequired(int8_t, int8_t); + void PassNullableByte(const Nullable&); + void PassOptionalNullableByte(const Optional>&); + void PassVariadicByte(const Sequence&); + int8_t CachedByte(); + int8_t CachedConstantByte(); + int8_t CachedWritableByte(); + void SetCachedWritableByte(int8_t); + int8_t SideEffectFreeByte(); + void SetSideEffectFreeByte(int8_t); + int8_t DomDependentByte(); + void SetDomDependentByte(int8_t); + int8_t ConstantByte(); + int8_t DeviceStateDependentByte(); + int8_t ReturnByteSideEffectFree(); + int8_t ReturnDOMDependentByte(); + int8_t ReturnConstantByte(); + int8_t ReturnDeviceStateDependentByte(); + + void UnsafePrerenderMethod(); + int32_t UnsafePrerenderWritable(); + void SetUnsafePrerenderWritable(int32_t); + int32_t UnsafePrerenderReadonly(); + int16_t ReadonlyShort(); + int16_t WritableShort(); + void SetWritableShort(int16_t); + void PassShort(int16_t); + int16_t ReceiveShort(); + void PassOptionalShort(const Optional&); + void PassOptionalShortWithDefault(int16_t); + + int32_t ReadonlyLong(); + int32_t WritableLong(); + void SetWritableLong(int32_t); + void PassLong(int32_t); + int16_t ReceiveLong(); + void PassOptionalLong(const Optional&); + void PassOptionalLongWithDefault(int32_t); + + int64_t ReadonlyLongLong(); + int64_t WritableLongLong(); + void SetWritableLongLong(int64_t); + void PassLongLong(int64_t); + int64_t ReceiveLongLong(); + void PassOptionalLongLong(const Optional&); + void PassOptionalLongLongWithDefault(int64_t); + + uint8_t ReadonlyOctet(); + uint8_t WritableOctet(); + void SetWritableOctet(uint8_t); + void PassOctet(uint8_t); + uint8_t ReceiveOctet(); + void PassOptionalOctet(const Optional&); + void PassOptionalOctetWithDefault(uint8_t); + + uint16_t ReadonlyUnsignedShort(); + uint16_t WritableUnsignedShort(); + void SetWritableUnsignedShort(uint16_t); + void PassUnsignedShort(uint16_t); + uint16_t ReceiveUnsignedShort(); + void PassOptionalUnsignedShort(const Optional&); + void PassOptionalUnsignedShortWithDefault(uint16_t); + + uint32_t ReadonlyUnsignedLong(); + uint32_t WritableUnsignedLong(); + void SetWritableUnsignedLong(uint32_t); + void PassUnsignedLong(uint32_t); + uint32_t ReceiveUnsignedLong(); + void PassOptionalUnsignedLong(const Optional&); + void PassOptionalUnsignedLongWithDefault(uint32_t); + + uint64_t ReadonlyUnsignedLongLong(); + uint64_t WritableUnsignedLongLong(); + void SetWritableUnsignedLongLong(uint64_t); + void PassUnsignedLongLong(uint64_t); + uint64_t ReceiveUnsignedLongLong(); + void PassOptionalUnsignedLongLong(const Optional&); + void PassOptionalUnsignedLongLongWithDefault(uint64_t); + + float WritableFloat() const; + void SetWritableFloat(float); + float WritableUnrestrictedFloat() const; + void SetWritableUnrestrictedFloat(float); + Nullable GetWritableNullableFloat() const; + void SetWritableNullableFloat(const Nullable&); + Nullable GetWritableNullableUnrestrictedFloat() const; + void SetWritableNullableUnrestrictedFloat(const Nullable&); + double WritableDouble() const; + void SetWritableDouble(double); + double WritableUnrestrictedDouble() const; + void SetWritableUnrestrictedDouble(double); + Nullable GetWritableNullableDouble() const; + void SetWritableNullableDouble(const Nullable&); + Nullable GetWritableNullableUnrestrictedDouble() const; + void SetWritableNullableUnrestrictedDouble(const Nullable&); + void PassFloat(float, float, const Nullable&, const Nullable&, + double, double, const Nullable&, + const Nullable&, const Sequence&, + const Sequence&, const Sequence>&, + const Sequence>&, const Sequence&, + const Sequence&, const Sequence>&, + const Sequence>&); + void PassLenientFloat(float, float, const Nullable&, + const Nullable&, double, double, + const Nullable&, const Nullable&, + const Sequence&, const Sequence&, + const Sequence>&, + const Sequence>&, + const Sequence&, const Sequence&, + const Sequence>&, + const Sequence>&); + float LenientFloatAttr() const; + void SetLenientFloatAttr(float); + double LenientDoubleAttr() const; + void SetLenientDoubleAttr(double); + + void PassUnrestricted(float arg1, float arg2, float arg3, float arg4, + double arg5, double arg6, double arg7, double arg8); + + // Interface types + already_AddRefed ReceiveSelf(); + already_AddRefed ReceiveNullableSelf(); + TestInterface* ReceiveWeakSelf(); + TestInterface* ReceiveWeakNullableSelf(); + void PassSelf(TestInterface&); + void PassNullableSelf(TestInterface*); + already_AddRefed NonNullSelf(); + void SetNonNullSelf(TestInterface&); + already_AddRefed GetNullableSelf(); + already_AddRefed CachedSelf(); + void SetNullableSelf(TestInterface*); + void PassOptionalSelf(const Optional&); + void PassOptionalNonNullSelf(const Optional>&); + void PassOptionalSelfWithDefault(TestInterface*); + + already_AddRefed + ReceiveNonWrapperCacheInterface(); + already_AddRefed + ReceiveNullableNonWrapperCacheInterface(); + void ReceiveNonWrapperCacheInterfaceSequence( + nsTArray>&); + void ReceiveNullableNonWrapperCacheInterfaceSequence( + nsTArray>&); + void ReceiveNonWrapperCacheInterfaceNullableSequence( + Nullable>>&); + void ReceiveNullableNonWrapperCacheInterfaceNullableSequence( + Nullable>>&); + + already_AddRefed ReceiveExternal(); + already_AddRefed ReceiveNullableExternal(); + TestExternalInterface* ReceiveWeakExternal(); + TestExternalInterface* ReceiveWeakNullableExternal(); + void PassExternal(TestExternalInterface*); + void PassNullableExternal(TestExternalInterface*); + already_AddRefed NonNullExternal(); + void SetNonNullExternal(TestExternalInterface*); + already_AddRefed GetNullableExternal(); + void SetNullableExternal(TestExternalInterface*); + void PassOptionalExternal(const Optional&); + void PassOptionalNonNullExternal(const Optional&); + void PassOptionalExternalWithDefault(TestExternalInterface*); + + already_AddRefed ReceiveCallbackInterface(); + already_AddRefed ReceiveNullableCallbackInterface(); + TestCallbackInterface* ReceiveWeakCallbackInterface(); + TestCallbackInterface* ReceiveWeakNullableCallbackInterface(); + void PassCallbackInterface(TestCallbackInterface&); + void PassNullableCallbackInterface(TestCallbackInterface*); + already_AddRefed NonNullCallbackInterface(); + void SetNonNullCallbackInterface(TestCallbackInterface&); + already_AddRefed GetNullableCallbackInterface(); + void SetNullableCallbackInterface(TestCallbackInterface*); + void PassOptionalCallbackInterface( + const Optional>&); + void PassOptionalNonNullCallbackInterface( + const Optional>&); + void PassOptionalCallbackInterfaceWithDefault(TestCallbackInterface*); + + // Sequence types + void GetReadonlySequence(nsTArray&); + void GetReadonlySequenceOfDictionaries(JSContext*, nsTArray&); + void GetReadonlyNullableSequenceOfDictionaries(JSContext*, + Nullable>&); + void GetReadonlyFrozenSequence(JSContext*, nsTArray&); + void GetReadonlyFrozenNullableSequence(JSContext*, Nullable>&); + void ReceiveSequence(nsTArray&); + void ReceiveNullableSequence(Nullable>&); + void ReceiveSequenceOfNullableInts(nsTArray>&); + void ReceiveNullableSequenceOfNullableInts( + Nullable>>&); + void PassSequence(const Sequence&); + void PassNullableSequence(const Nullable>&); + void PassSequenceOfNullableInts(const Sequence>&); + void PassOptionalSequenceOfNullableInts( + const Optional>>&); + void PassOptionalNullableSequenceOfNullableInts( + const Optional>>>&); + void ReceiveCastableObjectSequence(nsTArray>&); + void ReceiveCallbackObjectSequence(nsTArray>&); + void ReceiveNullableCastableObjectSequence(nsTArray>&); + void ReceiveNullableCallbackObjectSequence( + nsTArray>&); + void ReceiveCastableObjectNullableSequence( + Nullable>>&); + void ReceiveNullableCastableObjectNullableSequence( + Nullable>>&); + void ReceiveWeakCastableObjectSequence(nsTArray>&); + void ReceiveWeakNullableCastableObjectSequence( + nsTArray>&); + void ReceiveWeakCastableObjectNullableSequence( + Nullable>>&); + void ReceiveWeakNullableCastableObjectNullableSequence( + Nullable>>&); + void PassCastableObjectSequence( + const Sequence>&); + void PassNullableCastableObjectSequence( + const Sequence>&); + void PassCastableObjectNullableSequence( + const Nullable>>&); + void PassNullableCastableObjectNullableSequence( + const Nullable>>&); + void PassOptionalSequence(const Optional>&); + void PassOptionalSequenceWithDefaultValue(const Sequence&); + void PassOptionalNullableSequence( + const Optional>>&); + void PassOptionalNullableSequenceWithDefaultValue( + const Nullable>&); + void PassOptionalNullableSequenceWithDefaultValue2( + const Nullable>&); + void PassOptionalObjectSequence( + const Optional>>&); + void PassExternalInterfaceSequence( + const Sequence>&); + void PassNullableExternalInterfaceSequence( + const Sequence>&); + + void ReceiveStringSequence(nsTArray&); + void PassStringSequence(const Sequence&); + + void ReceiveByteStringSequence(nsTArray&); + void PassByteStringSequence(const Sequence&); + + void ReceiveUTF8StringSequence(nsTArray&); + void PassUTF8StringSequence(const Sequence&); + + void ReceiveAnySequence(JSContext*, nsTArray&); + void ReceiveNullableAnySequence(JSContext*, Nullable>&); + void ReceiveAnySequenceSequence(JSContext*, nsTArray>&); + + void ReceiveObjectSequence(JSContext*, nsTArray&); + void ReceiveNullableObjectSequence(JSContext*, nsTArray&); + + void PassSequenceOfSequences(const Sequence>&); + void PassSequenceOfSequencesOfSequences( + const Sequence>>&); + void ReceiveSequenceOfSequences(nsTArray>&); + void ReceiveSequenceOfSequencesOfSequences( + nsTArray>>&); + + // Record types + void PassRecord(const Record&); + void PassNullableRecord(const Nullable>&); + void PassRecordOfNullableInts(const Record>&); + void PassOptionalRecordOfNullableInts( + const Optional>>&); + void PassOptionalNullableRecordOfNullableInts( + const Optional>>>&); + void PassCastableObjectRecord( + const Record>&); + void PassNullableCastableObjectRecord( + const Record>&); + void PassCastableObjectNullableRecord( + const Nullable>>&); + void PassNullableCastableObjectNullableRecord( + const Nullable>>&); + void PassOptionalRecord(const Optional>&); + void PassOptionalNullableRecord( + const Optional>>&); + void PassOptionalNullableRecordWithDefaultValue( + const Nullable>&); + void PassOptionalObjectRecord( + const Optional>>&); + void PassExternalInterfaceRecord( + const Record>&); + void PassNullableExternalInterfaceRecord( + const Record>&); + void PassStringRecord(const Record&); + void PassByteStringRecord(const Record&); + void PassUTF8StringRecord(const Record&); + void PassRecordOfRecords(const Record>&); + void ReceiveRecord(Record&); + void ReceiveNullableRecord(Nullable>&); + void ReceiveRecordOfNullableInts(Record>&); + void ReceiveNullableRecordOfNullableInts( + Nullable>>&); + void ReceiveRecordOfRecords(Record>&); + void ReceiveAnyRecord(JSContext*, Record&); + + // Typed array types + void PassArrayBuffer(const ArrayBuffer&); + void PassNullableArrayBuffer(const Nullable&); + void PassOptionalArrayBuffer(const Optional&); + void PassOptionalNullableArrayBuffer(const Optional>&); + void PassOptionalNullableArrayBufferWithDefaultValue( + const Nullable&); + void PassArrayBufferView(const ArrayBufferView&); + void PassInt8Array(const Int8Array&); + void PassInt16Array(const Int16Array&); + void PassInt32Array(const Int32Array&); + void PassUint8Array(const Uint8Array&); + void PassUint16Array(const Uint16Array&); + void PassUint32Array(const Uint32Array&); + void PassUint8ClampedArray(const Uint8ClampedArray&); + void PassFloat32Array(const Float32Array&); + void PassFloat64Array(const Float64Array&); + void PassSequenceOfArrayBuffers(const Sequence&); + void PassSequenceOfNullableArrayBuffers( + const Sequence>&); + void PassRecordOfArrayBuffers(const Record&); + void PassRecordOfNullableArrayBuffers( + const Record>&); + void PassVariadicTypedArray(const Sequence&); + void PassVariadicNullableTypedArray(const Sequence>&); + void ReceiveUint8Array(JSContext*, JS::MutableHandle); + void SetUint8ArrayAttr(const Uint8Array&); + void GetUint8ArrayAttr(JSContext*, JS::MutableHandle); + + // DOMString types + void PassString(const nsAString&); + void PassNullableString(const nsAString&); + void PassOptionalString(const Optional&); + void PassOptionalStringWithDefaultValue(const nsAString&); + void PassOptionalNullableString(const Optional&); + void PassOptionalNullableStringWithDefaultValue(const nsAString&); + void PassVariadicString(const Sequence&); + void ReceiveString(DOMString&); + + // ByteString types + void PassByteString(const nsCString&); + void PassNullableByteString(const nsCString&); + void PassOptionalByteString(const Optional&); + void PassOptionalByteStringWithDefaultValue(const nsCString&); + void PassOptionalNullableByteString(const Optional&); + void PassOptionalNullableByteStringWithDefaultValue(const nsCString&); + void PassVariadicByteString(const Sequence&); + void PassOptionalUnionByteString(const Optional&); + void PassOptionalUnionByteStringWithDefaultValue(const ByteStringOrLong&); + + // UTF8String types + void PassUTF8String(const nsACString&); + void PassNullableUTF8String(const nsACString&); + void PassOptionalUTF8String(const Optional&); + void PassOptionalUTF8StringWithDefaultValue(const nsACString&); + void PassOptionalNullableUTF8String(const Optional&); + void PassOptionalNullableUTF8StringWithDefaultValue(const nsACString&); + void PassVariadicUTF8String(const Sequence&); + void PassOptionalUnionUTF8String(const Optional&); + void PassOptionalUnionUTF8StringWithDefaultValue(const UTF8StringOrLong&); + + // USVString types + void PassUSVS(const nsAString&); + void PassNullableUSVS(const nsAString&); + void PassOptionalUSVS(const Optional&); + void PassOptionalUSVSWithDefaultValue(const nsAString&); + void PassOptionalNullableUSVS(const Optional&); + void PassOptionalNullableUSVSWithDefaultValue(const nsAString&); + void PassVariadicUSVS(const Sequence&); + void ReceiveUSVS(DOMString&); + + // JSString types + void PassJSString(JSContext*, JS::Handle); + void PassOptionalJSStringWithDefaultValue(JSContext*, JS::Handle); + void ReceiveJSString(JSContext*, JS::MutableHandle); + void GetReadonlyJSStringAttr(JSContext*, JS::MutableHandle); + void GetJsStringAttr(JSContext*, JS::MutableHandle); + void SetJsStringAttr(JSContext*, JS::Handle); + + // Enumerated types + void PassEnum(TestEnum); + void PassNullableEnum(const Nullable&); + void PassOptionalEnum(const Optional&); + void PassEnumWithDefault(TestEnum); + void PassOptionalNullableEnum(const Optional>&); + void PassOptionalNullableEnumWithDefaultValue(const Nullable&); + void PassOptionalNullableEnumWithDefaultValue2(const Nullable&); + TestEnum ReceiveEnum(); + Nullable ReceiveNullableEnum(); + TestEnum EnumAttribute(); + TestEnum ReadonlyEnumAttribute(); + void SetEnumAttribute(TestEnum); + + // Callback types + void PassCallback(TestCallback&); + void PassNullableCallback(TestCallback*); + void PassOptionalCallback(const Optional>&); + void PassOptionalNullableCallback(const Optional>&); + void PassOptionalNullableCallbackWithDefaultValue(TestCallback*); + already_AddRefed ReceiveCallback(); + already_AddRefed ReceiveNullableCallback(); + void PassNullableTreatAsNullCallback(TestTreatAsNullCallback*); + void PassOptionalNullableTreatAsNullCallback( + const Optional>&); + void PassOptionalNullableTreatAsNullCallbackWithDefaultValue( + TestTreatAsNullCallback*); + void SetTreatAsNullCallback(TestTreatAsNullCallback&); + already_AddRefed TreatAsNullCallback(); + void SetNullableTreatAsNullCallback(TestTreatAsNullCallback*); + already_AddRefed GetNullableTreatAsNullCallback(); + + void ForceCallbackGeneration( + TestIntegerReturn&, TestNullableIntegerReturn&, TestBooleanReturn&, + TestFloatReturn&, TestStringReturn&, TestEnumReturn&, + TestInterfaceReturn&, TestNullableInterfaceReturn&, + TestExternalInterfaceReturn&, TestNullableExternalInterfaceReturn&, + TestCallbackInterfaceReturn&, TestNullableCallbackInterfaceReturn&, + TestCallbackReturn&, TestNullableCallbackReturn&, TestObjectReturn&, + TestNullableObjectReturn&, TestTypedArrayReturn&, + TestNullableTypedArrayReturn&, TestSequenceReturn&, + TestNullableSequenceReturn&, TestIntegerArguments&, + TestInterfaceArguments&, TestStringEnumArguments&, TestObjectArguments&, + TestOptionalArguments&, TestUnionArguments&, TestUndefinedConstruction&, + TestIntegerConstruction&, TestBooleanConstruction&, + TestFloatConstruction&, TestStringConstruction&, TestEnumConstruction&, + TestInterfaceConstruction&, TestExternalInterfaceConstruction&, + TestCallbackInterfaceConstruction&, TestCallbackConstruction&, + TestObjectConstruction&, TestTypedArrayConstruction&, + TestSequenceConstruction&); + + // Any types + void PassAny(JSContext*, JS::Handle); + void PassVariadicAny(JSContext*, const Sequence&); + void PassOptionalAny(JSContext*, JS::Handle); + void PassAnyDefaultNull(JSContext*, JS::Handle); + void PassSequenceOfAny(JSContext*, const Sequence&); + void PassNullableSequenceOfAny(JSContext*, + const Nullable>&); + void PassOptionalSequenceOfAny(JSContext*, + const Optional>&); + void PassOptionalNullableSequenceOfAny( + JSContext*, const Optional>>&); + void PassOptionalSequenceOfAnyWithDefaultValue( + JSContext*, const Nullable>&); + void PassSequenceOfSequenceOfAny(JSContext*, + const Sequence>&); + void PassSequenceOfNullableSequenceOfAny( + JSContext*, const Sequence>>&); + void PassNullableSequenceOfNullableSequenceOfAny( + JSContext*, const Nullable>>>&); + void PassOptionalNullableSequenceOfNullableSequenceOfAny( + JSContext*, + const Optional>>>>&); + void PassRecordOfAny(JSContext*, const Record&); + void PassNullableRecordOfAny(JSContext*, + const Nullable>&); + void PassOptionalRecordOfAny(JSContext*, + const Optional>&); + void PassOptionalNullableRecordOfAny( + JSContext*, const Optional>>&); + void PassOptionalRecordOfAnyWithDefaultValue( + JSContext*, const Nullable>&); + void PassRecordOfRecordOfAny( + JSContext*, const Record>&); + void PassRecordOfNullableRecordOfAny( + JSContext*, + const Record>>&); + void PassNullableRecordOfNullableRecordOfAny( + JSContext*, + const Nullable>>>&); + void PassOptionalNullableRecordOfNullableRecordOfAny( + JSContext*, + const Optional< + Nullable>>>>&); + void PassOptionalNullableRecordOfNullableSequenceOfAny( + JSContext*, + const Optional< + Nullable>>>>&); + void PassOptionalNullableSequenceOfNullableRecordOfAny( + JSContext*, + const Optional< + Nullable>>>>&); + void ReceiveAny(JSContext*, JS::MutableHandle); + + // object types + void PassObject(JSContext*, JS::Handle); + void PassVariadicObject(JSContext*, const Sequence&); + void PassNullableObject(JSContext*, JS::Handle); + void PassVariadicNullableObject(JSContext*, const Sequence&); + void PassOptionalObject(JSContext*, const Optional>&); + void PassOptionalNullableObject(JSContext*, + const Optional>&); + void PassOptionalNullableObjectWithDefaultValue(JSContext*, + JS::Handle); + void PassSequenceOfObject(JSContext*, const Sequence&); + void PassSequenceOfNullableObject(JSContext*, const Sequence&); + void PassNullableSequenceOfObject(JSContext*, + const Nullable>&); + void PassOptionalNullableSequenceOfNullableSequenceOfObject( + JSContext*, + const Optional>>>>&); + void PassOptionalNullableSequenceOfNullableSequenceOfNullableObject( + JSContext*, + const Optional>>>>&); + void PassRecordOfObject(JSContext*, const Record&); + void ReceiveObject(JSContext*, JS::MutableHandle); + void ReceiveNullableObject(JSContext*, JS::MutableHandle); + + // Union types + void PassUnion(JSContext*, const ObjectOrLong& arg); + void PassUnionWithNullable(JSContext* cx, const ObjectOrNullOrLong& arg) { + OwningObjectOrLong returnValue; + if (arg.IsNull()) { + } else if (arg.IsObject()) { + JS::Rooted obj(cx, arg.GetAsObject()); + JS::GetClass(obj); + returnValue.SetAsObject() = obj; + } else { + int32_t i = arg.GetAsLong(); + i += 1; + returnValue.SetAsLong() = i; + } + } +#ifdef DEBUG + void PassUnion2(const LongOrBoolean& arg); + void PassUnion3(JSContext*, const ObjectOrLongOrBoolean& arg); + void PassUnion4(const NodeOrLongOrBoolean& arg); + void PassUnion5(JSContext*, const ObjectOrBoolean& arg); + void PassUnion6(JSContext*, const ObjectOrString& arg); + void PassUnion7(JSContext*, const ObjectOrStringOrLong& arg); + void PassUnion8(JSContext*, const ObjectOrStringOrBoolean& arg); + void PassUnion9(JSContext*, const ObjectOrStringOrLongOrBoolean& arg); + void PassUnion10(const EventInitOrLong& arg); + void PassUnion11(JSContext*, const CustomEventInitOrLong& arg); + void PassUnion12(const EventInitOrLong& arg); + void PassUnion13(JSContext*, const ObjectOrLongOrNull& arg); + void PassUnion14(JSContext*, const ObjectOrLongOrNull& arg); + void PassUnion15(const LongSequenceOrLong&); + void PassUnion16(const Optional&); + void PassUnion17(const LongSequenceOrNullOrLong&); + void PassUnion18(JSContext*, const ObjectSequenceOrLong&); + void PassUnion19(JSContext*, const Optional&); + void PassUnion20(JSContext*, const ObjectSequenceOrLong&); + void PassUnion21(const StringLongRecordOrLong&); + void PassUnion22(JSContext*, const StringObjectRecordOrLong&); + void PassUnion23(const ImageDataSequenceOrLong&); + void PassUnion24(const ImageDataOrNullSequenceOrLong&); + void PassUnion25(const ImageDataSequenceSequenceOrLong&); + void PassUnion26(const ImageDataOrNullSequenceSequenceOrLong&); + void PassUnion27(const StringSequenceOrEventInit&); + void PassUnion28(const EventInitOrStringSequence&); + void PassUnionWithCallback(const EventHandlerNonNullOrNullOrLong& arg); + void PassUnionWithByteString(const ByteStringOrLong&); + void PassUnionWithUTF8String(const UTF8StringOrLong&); + void PassUnionWithRecord(const StringStringRecordOrString&); + void PassUnionWithRecordAndSequence( + const StringStringRecordOrStringSequence&); + void PassUnionWithSequenceAndRecord( + const StringSequenceOrStringStringRecord&); + void PassUnionWithUSVS(const USVStringOrLong&); +#endif + void PassNullableUnion(JSContext*, const Nullable&); + void PassOptionalUnion(JSContext*, const Optional&); + void PassOptionalNullableUnion(JSContext*, + const Optional>&); + void PassOptionalNullableUnionWithDefaultValue(JSContext*, + const Nullable&); + // void PassUnionWithInterfaces(const TestInterfaceOrTestExternalInterface& + // arg); void PassUnionWithInterfacesAndNullable(const + // TestInterfaceOrNullOrTestExternalInterface& arg); + void PassUnionWithArrayBuffer(const UTF8StringOrArrayBuffer& aArg) { + auto processor = [](const Span& aData) -> int { return -1; }; + static_assert( + std::is_same_v>, + "If the union can contain non-typedarray members we need to signal " + "that with a Maybe<…> rv."); + } + void PassUnionWithArrayBufferOrNull( + const UTF8StringOrArrayBufferOrNull& aArg) { + auto processor = [](const Span& aData) -> int { return -1; }; + static_assert( + std::is_same_v>, + "If the union can contain non-typedarray members or null we need to " + "signal that with a Maybe<…> rv."); + } + void PassUnionWithTypedArrays(const ArrayBufferViewOrArrayBuffer& aArg) { + auto processor = [](const Span& aData) -> int { return -1; }; + static_assert( + std::is_same_v, + "If the union can't contain non-typedarray members or null we can just " + "return the result of calling the lambda."); + } + void PassUnionWithTypedArraysOrNull( + const ArrayBufferViewOrArrayBufferOrNull& aArg) { + auto processor = [](const Span& aData) -> int { return -1; }; + static_assert( + std::is_same_v>, + "If the union can contain non-typedarray members or null we need to " + "signal that with a Maybe<…> rv."); + } + void PassUnionWithString(JSContext*, const StringOrObject&); + void PassUnionWithEnum(JSContext*, const SupportedTypeOrObject&); + // void PassUnionWithCallback(JSContext*, const TestCallbackOrLong&); + void PassUnionWithObject(JSContext*, const ObjectOrLong&); + + void PassUnionWithDefaultValue1(const DoubleOrString& arg); + void PassUnionWithDefaultValue2(const DoubleOrString& arg); + void PassUnionWithDefaultValue3(const DoubleOrString& arg); + void PassUnionWithDefaultValue4(const FloatOrString& arg); + void PassUnionWithDefaultValue5(const FloatOrString& arg); + void PassUnionWithDefaultValue6(const FloatOrString& arg); + void PassUnionWithDefaultValue7(const UnrestrictedDoubleOrString& arg); + void PassUnionWithDefaultValue8(const UnrestrictedDoubleOrString& arg); + void PassUnionWithDefaultValue9(const UnrestrictedDoubleOrString& arg); + void PassUnionWithDefaultValue10(const UnrestrictedDoubleOrString& arg); + void PassUnionWithDefaultValue11(const UnrestrictedFloatOrString& arg); + void PassUnionWithDefaultValue12(const UnrestrictedFloatOrString& arg); + void PassUnionWithDefaultValue13(const UnrestrictedFloatOrString& arg); + void PassUnionWithDefaultValue14(const DoubleOrByteString& arg); + void PassUnionWithDefaultValue15(const DoubleOrByteString& arg); + void PassUnionWithDefaultValue16(const DoubleOrByteString& arg); + void PassUnionWithDefaultValue17(const DoubleOrSupportedType& arg); + void PassUnionWithDefaultValue18(const DoubleOrSupportedType& arg); + void PassUnionWithDefaultValue19(const DoubleOrSupportedType& arg); + void PassUnionWithDefaultValue20(const DoubleOrUSVString& arg); + void PassUnionWithDefaultValue21(const DoubleOrUSVString& arg); + void PassUnionWithDefaultValue22(const DoubleOrUSVString& arg); + void PassUnionWithDefaultValue23(const DoubleOrUTF8String& arg); + void PassUnionWithDefaultValue24(const DoubleOrUTF8String& arg); + void PassUnionWithDefaultValue25(const DoubleOrUTF8String& arg); + + void PassNullableUnionWithDefaultValue1(const Nullable& arg); + void PassNullableUnionWithDefaultValue2(const Nullable& arg); + void PassNullableUnionWithDefaultValue3(const Nullable& arg); + void PassNullableUnionWithDefaultValue4(const Nullable& arg); + void PassNullableUnionWithDefaultValue5(const Nullable& arg); + void PassNullableUnionWithDefaultValue6(const Nullable& arg); + void PassNullableUnionWithDefaultValue7( + const Nullable& arg); + void PassNullableUnionWithDefaultValue8( + const Nullable& arg); + void PassNullableUnionWithDefaultValue9( + const Nullable& arg); + void PassNullableUnionWithDefaultValue10( + const Nullable& arg); + void PassNullableUnionWithDefaultValue11( + const Nullable& arg); + void PassNullableUnionWithDefaultValue12( + const Nullable& arg); + void PassNullableUnionWithDefaultValue13( + const Nullable& arg); + void PassNullableUnionWithDefaultValue14( + const Nullable& arg); + void PassNullableUnionWithDefaultValue15( + const Nullable& arg); + void PassNullableUnionWithDefaultValue16( + const Nullable& arg); + void PassNullableUnionWithDefaultValue17( + const Nullable& arg); + void PassNullableUnionWithDefaultValue18( + const Nullable& arg); + void PassNullableUnionWithDefaultValue19( + const Nullable& arg); + void PassNullableUnionWithDefaultValue20( + const Nullable& arg); + void PassNullableUnionWithDefaultValue21( + const Nullable& arg); + void PassNullableUnionWithDefaultValue22( + const Nullable& arg); + void PassNullableUnionWithDefaultValue23( + const Nullable& arg); + void PassNullableUnionWithDefaultValue24( + const Nullable& arg); + void PassNullableUnionWithDefaultValue25( + const Nullable& arg); + void PassNullableUnionWithDefaultValue26( + const Nullable& arg); + void PassNullableUnionWithDefaultValue27( + const Nullable& arg); + void PassNullableUnionWithDefaultValue28( + const Nullable& arg); + + void PassSequenceOfUnions( + const Sequence&); + void PassSequenceOfUnions2(JSContext*, const Sequence&); + void PassVariadicUnion(const Sequence&); + + void PassSequenceOfNullableUnions( + const Sequence>&); + void PassVariadicNullableUnion( + const Sequence>&); + void PassRecordOfUnions( + const Record&); + void PassRecordOfUnions2(JSContext*, + const Record&); + + void PassUnionWithSequenceOfUnions( + const StringOrOnlyForUseInInnerUnionOrCanvasPatternSequence& arg); + void PassUnionWithRecordOfUnions( + const LongSequenceOrStringOnlyForUseInInnerUnionOrLongSequenceRecord& + arg); + + void ReceiveUnion(OwningCanvasPatternOrCanvasGradient&); + void ReceiveUnion2(JSContext*, OwningObjectOrLong&); + void ReceiveUnionContainingNull(OwningCanvasPatternOrNullOrCanvasGradient&); + void ReceiveNullableUnion(Nullable&); + void ReceiveNullableUnion2(JSContext*, Nullable&); + void ReceiveUnionWithUndefined(OwningUndefinedOrCanvasPattern&); + void ReceiveUnionWithNullableUndefined(OwningUndefinedOrNullOrCanvasPattern&); + void ReceiveUnionWithUndefinedAndNullable( + OwningUndefinedOrCanvasPatternOrNull&); + void ReceiveNullableUnionWithUndefined( + Nullable&); + + void GetWritableUnion(OwningCanvasPatternOrCanvasGradient&); + void SetWritableUnion(const CanvasPatternOrCanvasGradient&); + void GetWritableUnionContainingNull( + OwningCanvasPatternOrNullOrCanvasGradient&); + void SetWritableUnionContainingNull( + const CanvasPatternOrNullOrCanvasGradient&); + void GetWritableNullableUnion(Nullable&); + void SetWritableNullableUnion(const Nullable&); + void GetWritableUnionWithUndefined(OwningUndefinedOrCanvasPattern&); + void SetWritableUnionWithUndefined(const UndefinedOrCanvasPattern&); + void GetWritableUnionWithNullableUndefined( + OwningUndefinedOrNullOrCanvasPattern&); + void SetWritableUnionWithNullableUndefined( + const UndefinedOrNullOrCanvasPattern&); + void GetWritableUnionWithUndefinedAndNullable( + OwningUndefinedOrCanvasPatternOrNull&); + void SetWritableUnionWithUndefinedAndNullable( + const UndefinedOrCanvasPatternOrNull&); + void GetWritableNullableUnionWithUndefined( + Nullable&); + void SetWritableNullableUnionWithUndefined( + const Nullable&); + + // Promise types + void PassPromise(Promise&); + void PassOptionalPromise(const Optional>&); + void PassPromiseSequence(const Sequence>&); + void PassPromiseRecord(const Record>&); + Promise* ReceivePromise(); + already_AddRefed ReceiveAddrefedPromise(); + + // ObservableArray types + void OnDeleteBooleanObservableArray(bool, uint32_t, ErrorResult&); + void OnSetBooleanObservableArray(bool, uint32_t, ErrorResult&); + void OnDeleteObjectObservableArray(JSContext*, JS::Handle, + uint32_t, ErrorResult&); + void OnSetObjectObservableArray(JSContext*, JS::Handle, uint32_t, + ErrorResult&); + void OnDeleteAnyObservableArray(JSContext*, JS::Handle, uint32_t, + ErrorResult&); + void OnSetAnyObservableArray(JSContext*, JS::Handle, uint32_t, + ErrorResult&); + void OnDeleteInterfaceObservableArray(TestInterface*, uint32_t, ErrorResult&); + void OnSetInterfaceObservableArray(TestInterface*, uint32_t, ErrorResult&); + void OnDeleteNullableObservableArray(const Nullable&, uint32_t, + ErrorResult&); + void OnSetNullableObservableArray(const Nullable&, uint32_t, + ErrorResult&); + + // binaryNames tests + void MethodRenamedTo(); + void MethodRenamedTo(int8_t); + int8_t AttributeGetterRenamedTo(); + int8_t AttributeRenamedTo(); + void SetAttributeRenamedTo(int8_t); + + // Dictionary tests + void PassDictionary(JSContext*, const Dict&); + void PassDictionary2(JSContext*, const Dict&); + void GetReadonlyDictionary(JSContext*, Dict&); + void GetReadonlyNullableDictionary(JSContext*, Nullable&); + void GetWritableDictionary(JSContext*, Dict&); + void SetWritableDictionary(JSContext*, const Dict&); + void GetReadonlyFrozenDictionary(JSContext*, Dict&); + void GetReadonlyFrozenNullableDictionary(JSContext*, Nullable&); + void GetWritableFrozenDictionary(JSContext*, Dict&); + void SetWritableFrozenDictionary(JSContext*, const Dict&); + void ReceiveDictionary(JSContext*, Dict&); + void ReceiveNullableDictionary(JSContext*, Nullable&); + void PassOtherDictionary(const GrandparentDict&); + void PassSequenceOfDictionaries(JSContext*, const Sequence&); + void PassRecordOfDictionaries(const Record&); + void PassDictionaryOrLong(JSContext*, const Dict&); + void PassDictionaryOrLong(int32_t); + void PassDictContainingDict(JSContext*, const DictContainingDict&); + void PassDictContainingSequence(JSContext*, const DictContainingSequence&); + void ReceiveDictContainingSequence(JSContext*, DictContainingSequence&); + void PassVariadicDictionary(JSContext*, const Sequence&); + + // Typedefs + void ExerciseTypedefInterfaces1(TestInterface&); + already_AddRefed ExerciseTypedefInterfaces2(TestInterface*); + void ExerciseTypedefInterfaces3(TestInterface&); + + // Deprecated methods and attributes + int8_t DeprecatedAttribute(); + void SetDeprecatedAttribute(int8_t); + int8_t DeprecatedMethod(); + int8_t DeprecatedMethodWithContext(JSContext*, const JS::Value&); + + // Static methods and attributes + static void StaticMethod(const GlobalObject&, bool); + static void StaticMethodWithContext(const GlobalObject&, const JS::Value&); + static bool StaticAttribute(const GlobalObject&); + static void SetStaticAttribute(const GlobalObject&, bool); + static void Assert(const GlobalObject&, bool); + + // Deprecated static methods and attributes + static int8_t StaticDeprecatedAttribute(const GlobalObject&); + static void SetStaticDeprecatedAttribute(const GlobalObject&, int8_t); + static void StaticDeprecatedMethod(const GlobalObject&); + static void StaticDeprecatedMethodWithContext(const GlobalObject&, + const JS::Value&); + + // Overload resolution tests + bool Overload1(TestInterface&); + TestInterface* Overload1(const nsAString&, TestInterface&); + void Overload2(TestInterface&); + void Overload2(JSContext*, const Dict&); + void Overload2(bool); + void Overload2(const nsAString&); + void Overload3(TestInterface&); + void Overload3(const TestCallback&); + void Overload3(bool); + void Overload4(TestInterface&); + void Overload4(TestCallbackInterface&); + void Overload4(const nsAString&); + void Overload5(int32_t); + void Overload5(TestEnum); + void Overload6(int32_t); + void Overload6(bool); + void Overload7(int32_t); + void Overload7(bool); + void Overload7(const nsCString&); + void Overload8(int32_t); + void Overload8(TestInterface&); + void Overload9(const Nullable&); + void Overload9(const nsAString&); + void Overload10(const Nullable&); + void Overload10(JSContext*, JS::Handle); + void Overload11(int32_t); + void Overload11(const nsAString&); + void Overload12(int32_t); + void Overload12(const Nullable&); + void Overload13(const Nullable&); + void Overload13(bool); + void Overload14(const Optional&); + void Overload14(TestInterface&); + void Overload15(int32_t); + void Overload15(const Optional>&); + void Overload16(int32_t); + void Overload16(const Optional&); + void Overload17(const Sequence&); + void Overload17(const Record&); + void Overload18(const Record&); + void Overload18(const Sequence&); + void Overload19(const Sequence&); + void Overload19(JSContext*, const Dict&); + void Overload20(JSContext*, const Dict&); + void Overload20(const Sequence&); + + // Variadic handling + void PassVariadicThirdArg(const nsAString&, int32_t, + const Sequence>&); + + // Conditionally exposed methods/attributes + bool Prefable1(); + bool Prefable2(); + bool Prefable3(); + bool Prefable4(); + bool Prefable5(); + bool Prefable6(); + bool Prefable7(); + bool Prefable8(); + bool Prefable9(); + void Prefable10(); + void Prefable11(); + bool Prefable12(); + void Prefable13(); + bool Prefable14(); + bool Prefable15(); + bool Prefable16(); + void Prefable17(); + void Prefable18(); + void Prefable19(); + void Prefable20(); + void Prefable21(); + void Prefable22(); + void Prefable23(); + void Prefable24(); + + // Conditionally exposed methods/attributes involving [SecureContext] + bool ConditionalOnSecureContext1(); + bool ConditionalOnSecureContext2(); + bool ConditionalOnSecureContext3(); + bool ConditionalOnSecureContext4(); + void ConditionalOnSecureContext5(); + void ConditionalOnSecureContext6(); + void ConditionalOnSecureContext7(); + void ConditionalOnSecureContext8(); + + bool ConditionalOnSecureContext9(); + void ConditionalOnSecureContext10(); + + // Miscellania + int32_t AttrWithLenientThis(); + void SetAttrWithLenientThis(int32_t); + uint32_t UnforgeableAttr(); + uint32_t UnforgeableAttr2(); + uint32_t UnforgeableMethod(); + uint32_t UnforgeableMethod2(); + void Stringify(nsString&); + void PassRenamedInterface(nsRenamedInterface&); + TestInterface* PutForwardsAttr(); + TestInterface* PutForwardsAttr2(); + TestInterface* PutForwardsAttr3(); + void GetToJSONShouldSkipThis(JSContext*, JS::MutableHandle); + void SetToJSONShouldSkipThis(JSContext*, JS::Rooted&); + TestParentInterface* ToJSONShouldSkipThis2(); + void SetToJSONShouldSkipThis2(TestParentInterface&); + TestCallbackInterface* ToJSONShouldSkipThis3(); + void SetToJSONShouldSkipThis3(TestCallbackInterface&); + void ThrowingMethod(ErrorResult& aRv); + bool GetThrowingAttr(ErrorResult& aRv) const; + void SetThrowingAttr(bool arg, ErrorResult& aRv); + bool GetThrowingGetterAttr(ErrorResult& aRv) const; + void SetThrowingGetterAttr(bool arg); + bool ThrowingSetterAttr() const; + void SetThrowingSetterAttr(bool arg, ErrorResult& aRv); + void CanOOMMethod(OOMReporter& aRv); + bool GetCanOOMAttr(OOMReporter& aRv) const; + void SetCanOOMAttr(bool arg, OOMReporter& aRv); + bool GetCanOOMGetterAttr(OOMReporter& aRv) const; + void SetCanOOMGetterAttr(bool arg); + bool CanOOMSetterAttr() const; + void SetCanOOMSetterAttr(bool arg, OOMReporter& aRv); + void NeedsSubjectPrincipalMethod(nsIPrincipal&); + bool NeedsSubjectPrincipalAttr(nsIPrincipal&); + void SetNeedsSubjectPrincipalAttr(bool, nsIPrincipal&); + void NeedsCallerTypeMethod(CallerType); + bool NeedsCallerTypeAttr(CallerType); + void SetNeedsCallerTypeAttr(bool, CallerType); + void NeedsNonSystemSubjectPrincipalMethod(nsIPrincipal*); + bool NeedsNonSystemSubjectPrincipalAttr(nsIPrincipal*); + void SetNeedsNonSystemSubjectPrincipalAttr(bool, nsIPrincipal*); + void CeReactionsMethod(); + void CeReactionsMethodOverload(); + void CeReactionsMethodOverload(const nsAString&); + bool CeReactionsAttr() const; + void SetCeReactionsAttr(bool); + int16_t LegacyCall(const JS::Value&, uint32_t, TestInterface&); + void PassArgsWithDefaults(JSContext*, const Optional&, + TestInterface*, const Dict&, double, + const Optional&); + + void SetDashed_attribute(int8_t); + int8_t Dashed_attribute(); + void Dashed_method(); + + bool NonEnumerableAttr() const; + void SetNonEnumerableAttr(bool); + void NonEnumerableMethod(); + + // Methods and properties imported via "includes" + bool MixedInProperty(); + void SetMixedInProperty(bool); + void MixedInMethod(); + + // Test EnforceRange/Clamp + void DontEnforceRangeOrClamp(int8_t); + void DoEnforceRange(int8_t); + void DoEnforceRangeNullable(const Nullable&); + void DoClamp(int8_t); + void DoClampNullable(const Nullable&); + void SetEnforcedByte(int8_t); + int8_t EnforcedByte(); + void SetEnforcedNullableByte(const Nullable&); + Nullable GetEnforcedNullableByte() const; + void SetClampedNullableByte(const Nullable&); + Nullable GetClampedNullableByte() const; + void SetClampedByte(int8_t); + int8_t ClampedByte(); + + // Test AllowShared + void SetAllowSharedArrayBufferViewTypedef(const ArrayBufferView&); + void GetAllowSharedArrayBufferViewTypedef(JSContext*, + JS::MutableHandle); + void SetAllowSharedArrayBufferView(const ArrayBufferView&); + void GetAllowSharedArrayBufferView(JSContext*, JS::MutableHandle); + void SetAllowSharedNullableArrayBufferView(const Nullable&); + void GetAllowSharedNullableArrayBufferView(JSContext*, + JS::MutableHandle); + void SetAllowSharedArrayBuffer(const ArrayBuffer&); + void GetAllowSharedArrayBuffer(JSContext*, JS::MutableHandle); + void SetAllowSharedNullableArrayBuffer(const Nullable&); + void GetAllowSharedNullableArrayBuffer(JSContext*, + JS::MutableHandle); + + void PassAllowSharedArrayBufferViewTypedef(const ArrayBufferView&); + void PassAllowSharedArrayBufferView(const ArrayBufferView&); + void PassAllowSharedNullableArrayBufferView(const Nullable&); + void PassAllowSharedArrayBuffer(const ArrayBuffer&); + void PassAllowSharedNullableArrayBuffer(const Nullable&); + void PassUnionArrayBuffer(const StringOrArrayBuffer& foo); + void PassUnionAllowSharedArrayBuffer( + const StringOrMaybeSharedArrayBuffer& foo); + + 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 + // to these private deleted methods and compilation will fail. + void SetReadonlyByte(int8_t) = delete; + template + void SetWritableByte(T) = delete; + template + void PassByte(T) = delete; + void PassNullableByte(Nullable&) = delete; + template + void PassOptionalByte(const Optional&) = delete; + template + void PassOptionalByteWithDefault(T) = delete; + void PassVariadicByte(Sequence&) = delete; + + void SetReadonlyShort(int16_t) = delete; + template + void SetWritableShort(T) = delete; + template + void PassShort(T) = delete; + template + void PassOptionalShort(const Optional&) = delete; + template + void PassOptionalShortWithDefault(T) = delete; + + void SetReadonlyLong(int32_t) = delete; + template + void SetWritableLong(T) = delete; + template + void PassLong(T) = delete; + template + void PassOptionalLong(const Optional&) = delete; + template + void PassOptionalLongWithDefault(T) = delete; + + void SetReadonlyLongLong(int64_t) = delete; + template + void SetWritableLongLong(T) = delete; + template + void PassLongLong(T) = delete; + template + void PassOptionalLongLong(const Optional&) = delete; + template + void PassOptionalLongLongWithDefault(T) = delete; + + void SetReadonlyOctet(uint8_t) = delete; + template + void SetWritableOctet(T) = delete; + template + void PassOctet(T) = delete; + template + void PassOptionalOctet(const Optional&) = delete; + template + void PassOptionalOctetWithDefault(T) = delete; + + void SetReadonlyUnsignedShort(uint16_t) = delete; + template + void SetWritableUnsignedShort(T) = delete; + template + void PassUnsignedShort(T) = delete; + template + void PassOptionalUnsignedShort(const Optional&) = delete; + template + void PassOptionalUnsignedShortWithDefault(T) = delete; + + void SetReadonlyUnsignedLong(uint32_t) = delete; + template + void SetWritableUnsignedLong(T) = delete; + template + void PassUnsignedLong(T) = delete; + template + void PassOptionalUnsignedLong(const Optional&) = delete; + template + void PassOptionalUnsignedLongWithDefault(T) = delete; + + void SetReadonlyUnsignedLongLong(uint64_t) = delete; + template + void SetWritableUnsignedLongLong(T) = delete; + template + void PassUnsignedLongLong(T) = delete; + template + void PassOptionalUnsignedLongLong(const Optional&) = delete; + template + void PassOptionalUnsignedLongLongWithDefault(T) = delete; + + // Enforce that only const things are passed for sequences + void PassSequence(Sequence&) = delete; + void PassNullableSequence(Nullable>&) = delete; + void PassOptionalNullableSequenceWithDefaultValue( + Nullable>&) = delete; + void PassSequenceOfAny(JSContext*, Sequence&) = delete; + void PassNullableSequenceOfAny(JSContext*, + Nullable>&) = delete; + void PassOptionalSequenceOfAny(JSContext*, + Optional>&) = delete; + void PassOptionalNullableSequenceOfAny( + JSContext*, Optional>>&) = delete; + void PassOptionalSequenceOfAnyWithDefaultValue( + JSContext*, Nullable>&) = delete; + void PassSequenceOfSequenceOfAny(JSContext*, + Sequence>&) = delete; + void PassSequenceOfNullableSequenceOfAny( + JSContext*, Sequence>>&) = delete; + void PassNullableSequenceOfNullableSequenceOfAny( + JSContext*, Nullable>>>&) = delete; + void PassOptionalNullableSequenceOfNullableSequenceOfAny( + JSContext*, + Optional>>>>&) = delete; + void PassSequenceOfObject(JSContext*, Sequence&) = delete; + void PassSequenceOfNullableObject(JSContext*, Sequence&) = delete; + void PassOptionalNullableSequenceOfNullableSequenceOfObject( + JSContext*, + Optional>>>>&) = delete; + void PassOptionalNullableSequenceOfNullableSequenceOfNullableObject( + JSContext*, + Optional>>>>&) = delete; + + // Enforce that only const things are passed for optional + void PassOptionalByte(Optional&) = delete; + void PassOptionalNullableByte(Optional>&) = delete; + void PassOptionalShort(Optional&) = delete; + void PassOptionalLong(Optional&) = delete; + void PassOptionalLongLong(Optional&) = delete; + void PassOptionalOctet(Optional&) = delete; + void PassOptionalUnsignedShort(Optional&) = delete; + void PassOptionalUnsignedLong(Optional&) = delete; + void PassOptionalUnsignedLongLong(Optional&) = delete; + void PassOptionalSelf(Optional&) = delete; + void PassOptionalNonNullSelf(Optional>&) = delete; + void PassOptionalExternal(Optional&) = delete; + void PassOptionalNonNullExternal(Optional&) = delete; + void PassOptionalSequence(Optional>&) = delete; + void PassOptionalNullableSequence(Optional>>&) = + delete; + void PassOptionalObjectSequence( + Optional>>&) = delete; + void PassOptionalArrayBuffer(Optional&) = delete; + void PassOptionalNullableArrayBuffer(Optional&) = delete; + void PassOptionalEnum(Optional&) = delete; + void PassOptionalCallback(JSContext*, + Optional>&) = delete; + void PassOptionalNullableCallback(JSContext*, + Optional>&) = delete; + void PassOptionalAny(Optional>&) = delete; + + // And test that string stuff is always const + void PassString(nsAString&) = delete; + void PassNullableString(nsAString&) = delete; + void PassOptionalString(Optional&) = delete; + void PassOptionalStringWithDefaultValue(nsAString&) = delete; + void PassOptionalNullableString(Optional&) = delete; + void PassOptionalNullableStringWithDefaultValue(nsAString&) = delete; + void PassVariadicString(Sequence&) = delete; + + // cstrings should be const as well + void PassByteString(nsCString&) = delete; + void PassNullableByteString(nsCString&) = delete; + void PassOptionalByteString(Optional&) = delete; + void PassOptionalByteStringWithDefaultValue(nsCString&) = delete; + void PassOptionalNullableByteString(Optional&) = delete; + void PassOptionalNullableByteStringWithDefaultValue(nsCString&) = delete; + void PassVariadicByteString(Sequence&) = delete; + + // cstrings should be const as well + void PassUTF8String(nsACString&) = delete; + void PassNullableUTF8String(nsACString&) = delete; + void PassOptionalUTF8String(Optional&) = delete; + void PassOptionalUTF8StringWithDefaultValue(nsACString&) = delete; + void PassOptionalNullableUTF8String(Optional&) = delete; + void PassOptionalNullableUTF8StringWithDefaultValue(nsACString&) = delete; + void PassVariadicUTF8String(Sequence&) = delete; + + // Make sure dictionary arguments are always const + void PassDictionary(JSContext*, Dict&) = delete; + void PassOtherDictionary(GrandparentDict&) = delete; + void PassSequenceOfDictionaries(JSContext*, Sequence&) = delete; + void PassDictionaryOrLong(JSContext*, Dict&) = delete; + void PassDictContainingDict(JSContext*, DictContainingDict&) = delete; + void PassDictContainingSequence(DictContainingSequence&) = delete; + + // Make sure various nullable things are always const + void PassNullableEnum(Nullable&) = delete; + + // Make sure unions are always const + void PassUnion(JSContext*, ObjectOrLong& arg) = delete; + void PassUnionWithNullable(JSContext*, ObjectOrNullOrLong& arg) = delete; + void PassNullableUnion(JSContext*, Nullable&) = delete; + void PassOptionalUnion(JSContext*, Optional&) = delete; + void PassOptionalNullableUnion(JSContext*, + Optional>&) = delete; + void PassOptionalNullableUnionWithDefaultValue( + JSContext*, Nullable&) = delete; + + // Make sure variadics are const as needed + void PassVariadicAny(JSContext*, Sequence&) = delete; + void PassVariadicObject(JSContext*, Sequence&) = delete; + void PassVariadicNullableObject(JSContext*, Sequence&) = delete; + + // Ensure NonNull does not leak in + void PassSelf(NonNull&) = delete; + void PassSelf(OwningNonNull&) = delete; + void PassSelf(const NonNull&) = delete; + void PassSelf(const OwningNonNull&) = delete; + void PassCallbackInterface(OwningNonNull&) = delete; + void PassCallbackInterface(const OwningNonNull&) = + delete; + void PassCallbackInterface(NonNull&) = delete; + void PassCallbackInterface(const NonNull&) = delete; + void PassCallback(OwningNonNull&) = delete; + void PassCallback(const OwningNonNull&) = delete; + void PassCallback(NonNull&) = delete; + void PassCallback(const NonNull&) = delete; + void PassString(const NonNull&) = delete; + void PassString(NonNull&) = delete; + void PassString(const OwningNonNull&) = delete; + void PassString(OwningNonNull&) = delete; +}; + +class TestIndexedGetterInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + uint32_t IndexedGetter(uint32_t, bool&); + uint32_t IndexedGetter(uint32_t&) = delete; + uint32_t Item(uint32_t&); + uint32_t Item(uint32_t, bool&) = delete; + uint32_t Length(); + void LegacyCall(JS::Handle); + int32_t CachedAttr(); + int32_t StoreInSlotAttr(); +}; + +class TestNamedGetterInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void NamedGetter(const nsAString&, bool&, nsAString&); + void GetSupportedNames(nsTArray&); +}; + +class TestIndexedGetterAndSetterAndNamedGetterInterface + : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void NamedGetter(const nsAString&, bool&, nsAString&); + void GetSupportedNames(nsTArray&); + int32_t IndexedGetter(uint32_t, bool&); + void IndexedSetter(uint32_t, int32_t); + uint32_t Length(); +}; + +class TestIndexedAndNamedGetterInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + uint32_t IndexedGetter(uint32_t, bool&); + void NamedGetter(const nsAString&, bool&, nsAString&); + void NamedItem(const nsAString&, nsAString&); + uint32_t Length(); + void GetSupportedNames(nsTArray&); +}; + +class TestIndexedSetterInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void IndexedSetter(uint32_t, const nsAString&); + void IndexedGetter(uint32_t, bool&, nsString&); + uint32_t Length(); + void SetItem(uint32_t, const nsAString&); +}; + +class TestNamedSetterInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void NamedSetter(const nsAString&, TestIndexedSetterInterface&); + TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&); + void GetSupportedNames(nsTArray&); +}; + +class TestIndexedAndNamedSetterInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void IndexedSetter(uint32_t, TestIndexedSetterInterface&); + TestIndexedSetterInterface* IndexedGetter(uint32_t, bool&); + uint32_t Length(); + void NamedSetter(const nsAString&, TestIndexedSetterInterface&); + TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&); + void SetNamedItem(const nsAString&, TestIndexedSetterInterface&); + void GetSupportedNames(nsTArray&); +}; + +class TestIndexedAndNamedGetterAndSetterInterface + : public TestIndexedSetterInterface { + public: + uint32_t IndexedGetter(uint32_t, bool&); + uint32_t Item(uint32_t); + void NamedGetter(const nsAString&, bool&, nsAString&); + void NamedItem(const nsAString&, nsAString&); + void IndexedSetter(uint32_t, int32_t&); + void IndexedSetter(uint32_t, const nsAString&) = delete; + void NamedSetter(const nsAString&, const nsAString&); + void Stringify(nsAString&); + uint32_t Length(); + void GetSupportedNames(nsTArray&); +}; + +class TestCppKeywordNamedMethodsInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + bool Continue(); + bool Delete(); + int32_t Volatile(); +}; + +class TestNamedDeleterInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void NamedDeleter(const nsAString&, bool&); + long NamedGetter(const nsAString&, bool&); + void GetSupportedNames(nsTArray&); +}; + +class TestNamedDeleterWithRetvalInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + bool NamedDeleter(const nsAString&, bool&); + bool NamedDeleter(const nsAString&) = delete; + long NamedGetter(const nsAString&, bool&); + bool DelNamedItem(const nsAString&); + bool DelNamedItem(const nsAString&, bool&) = delete; + void GetSupportedNames(nsTArray&); +}; + +class TestParentInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); +}; + +class TestChildInterface : public TestParentInterface {}; + +class TestDeprecatedInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + static already_AddRefed Constructor( + const GlobalObject&); + + static void AlsoDeprecated(const GlobalObject&); + + virtual nsISupports* GetParentObject(); +}; + +class TestInterfaceWithPromiseConstructorArg : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + static already_AddRefed Constructor( + const GlobalObject&, Promise&); + + virtual nsISupports* GetParentObject(); +}; + +class TestSecureContextInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + static already_AddRefed Constructor( + const GlobalObject&, ErrorResult&); + + static void AlsoSecureContext(const GlobalObject&); + + virtual nsISupports* GetParentObject(); +}; + +class TestNamespace { + public: + static bool Foo(const GlobalObject&); + static int32_t Bar(const GlobalObject&); + static void Baz(const GlobalObject&); +}; + +class TestRenamedNamespace {}; + +class TestProtoObjectHackedNamespace {}; + +class TestWorkerExposedInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + nsISupports* GetParentObject(); + + void NeedsSubjectPrincipalMethod(nsIPrincipal&); + bool NeedsSubjectPrincipalAttr(nsIPrincipal&); + void SetNeedsSubjectPrincipalAttr(bool, nsIPrincipal&); + void NeedsCallerTypeMethod(CallerType); + bool NeedsCallerTypeAttr(CallerType); + void SetNeedsCallerTypeAttr(bool, CallerType); + void NeedsNonSystemSubjectPrincipalMethod(nsIPrincipal*); + bool NeedsNonSystemSubjectPrincipalAttr(nsIPrincipal*); + void SetNeedsNonSystemSubjectPrincipalAttr(bool, nsIPrincipal*); +}; + +class TestHTMLConstructorInterface : public nsGenericHTMLElement { + public: + virtual nsISupports* GetParentObject(); +}; + +class TestThrowingConstructorInterface : public nsISupports, + public nsWrapperCache { + public: + static already_AddRefed Constructor( + const GlobalObject&, ErrorResult&); + static already_AddRefed Constructor( + const GlobalObject&, const nsAString&, ErrorResult&); + static already_AddRefed Constructor( + const GlobalObject&, uint32_t, const Nullable&, ErrorResult&); + static already_AddRefed Constructor( + const GlobalObject&, TestInterface*, ErrorResult&); + static already_AddRefed Constructor( + const GlobalObject&, uint32_t, TestInterface&, ErrorResult&); + + static already_AddRefed Constructor( + const GlobalObject&, const ArrayBuffer&, ErrorResult&); + static already_AddRefed Constructor( + const GlobalObject&, const Uint8Array&, ErrorResult&); + /* static + already_AddRefed + Constructor(const GlobalObject&, uint32_t, uint32_t, + const TestInterfaceOrOnlyForUseInConstructor&, ErrorResult&); + */ + + virtual nsISupports* GetParentObject(); +}; + +class TestCEReactionsInterface : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject and GetDocGroup to make binding codegen happy + virtual nsISupports* GetParentObject(); + DocGroup* GetDocGroup() const; + + int32_t Item(uint32_t); + uint32_t Length() const; + int32_t IndexedGetter(uint32_t, bool&); + void IndexedSetter(uint32_t, int32_t); + void NamedDeleter(const nsAString&, bool&); + void NamedGetter(const nsAString&, bool&, nsString&); + void NamedSetter(const nsAString&, const nsAString&); + void GetSupportedNames(nsTArray&); +}; + +class TestAttributesOnTypes : public nsISupports, public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + + // We need a GetParentObject and GetDocGroup to make binding codegen happy + virtual nsISupports* GetParentObject(); + + void Foo(uint8_t arg); + void Bar(uint8_t arg); + void Baz(const nsAString& arg); + uint8_t SomeAttr(); + void SetSomeAttr(uint8_t); + void ArgWithAttr(uint8_t arg1, const Optional& arg2); +}; + +class TestPrefConstructorForInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since only the constructor is under a pref, + // the generated constructor should check for the pref. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestConstructorForPrefInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the interface itself is under a Pref, there should be no + // check for the pref in the generated constructor. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestPrefConstructorForDifferentPrefInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the constructor's pref is different than the interface pref + // there should still be a check for the pref in the generated constructor. + static already_AddRefed + Constructor(const GlobalObject&); +}; + +class TestConstructorForSCInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the interface itself is SecureContext, there should be no + // check for SecureContext in the constructor. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestSCConstructorForInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the interface context is unspecified but the constructor is + // SecureContext, the generated constructor should check for SecureContext. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestConstructorForFuncInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the interface has a Func attribute, but the constructor does not, + // the generated constructor should not check for the Func. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestFuncConstructorForInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the constructor has a Func attribute, but the interface does not, + // the generated constructor should check for the Func. + static already_AddRefed Constructor( + const GlobalObject&); +}; + +class TestFuncConstructorForDifferentFuncInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // Since the constructor has a different Func attribute from the interface, + // the generated constructor should still check for its conditional func. + static already_AddRefed + Constructor(const GlobalObject&); +}; + +class TestPrefChromeOnlySCFuncConstructorForInterface : public nsISupports, + public nsWrapperCache { + public: + NS_DECL_ISUPPORTS + virtual nsISupports* GetParentObject(); + + // There should be checks for all Pref/ChromeOnly/SecureContext/Func + // in the generated constructor. + static already_AddRefed + Constructor(const GlobalObject&); +}; + +} // namespace dom +} // namespace mozilla + +#endif /* TestBindingHeader_h */ -- cgit v1.2.3