From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- dom/bindings/test/Makefile.in | 21 + dom/bindings/test/TestBindingHeader.h | 1431 ++++++++++++++++++++ dom/bindings/test/TestCImplementedInterface.h | 43 + dom/bindings/test/TestCodeGen.webidl | 1264 +++++++++++++++++ dom/bindings/test/TestDictionary.webidl | 9 + dom/bindings/test/TestExampleGen.webidl | 811 +++++++++++ dom/bindings/test/TestFunctions.cpp | 94 ++ dom/bindings/test/TestFunctions.h | 52 + dom/bindings/test/TestInterfaceIterableDouble.cpp | 82 ++ dom/bindings/test/TestInterfaceIterableDouble.h | 51 + .../test/TestInterfaceIterableDoubleUnion.cpp | 83 ++ .../test/TestInterfaceIterableDoubleUnion.h | 51 + dom/bindings/test/TestInterfaceIterableSingle.cpp | 77 ++ dom/bindings/test/TestInterfaceIterableSingle.h | 51 + dom/bindings/test/TestInterfaceJS.js | 166 +++ dom/bindings/test/TestInterfaceJS.manifest | 4 + dom/bindings/test/TestInterfaceJSMaplike.js | 38 + dom/bindings/test/TestInterfaceMaplike.cpp | 84 ++ dom/bindings/test/TestInterfaceMaplike.h | 52 + dom/bindings/test/TestInterfaceMaplikeObject.cpp | 88 ++ dom/bindings/test/TestInterfaceMaplikeObject.h | 52 + dom/bindings/test/TestInterfaceSetlike.cpp | 58 + dom/bindings/test/TestInterfaceSetlike.h | 46 + dom/bindings/test/TestInterfaceSetlikeNode.cpp | 58 + dom/bindings/test/TestInterfaceSetlikeNode.h | 46 + dom/bindings/test/TestJSImplGen.webidl | 836 ++++++++++++ dom/bindings/test/TestJSImplInheritanceGen.webidl | 29 + dom/bindings/test/TestTypedef.webidl | 7 + dom/bindings/test/chrome.ini | 22 + dom/bindings/test/file_InstanceOf.html | 12 + dom/bindings/test/file_bug775543.html | 5 + .../test/file_document_location_set_via_xray.html | 5 + dom/bindings/test/file_dom_xrays.html | 24 + dom/bindings/test/file_focuser.html | 24 + .../test/file_fullScreenPropertyAccessor.html | 24 + dom/bindings/test/file_proxies_via_xray.html | 8 + dom/bindings/test/forOf_iframe.html | 13 + dom/bindings/test/mochitest.ini | 79 ++ dom/bindings/test/moz.build | 58 + dom/bindings/test/test_ByteString.html | 32 + dom/bindings/test/test_InstanceOf.html | 54 + dom/bindings/test/test_Object.prototype_props.html | 20 + dom/bindings/test/test_async_stacks.html | 108 ++ dom/bindings/test/test_barewordGetsWindow.html | 60 + .../test_blacklisted_prerendering_function.xul | 124 ++ dom/bindings/test/test_bug1036214.html | 123 ++ dom/bindings/test/test_bug1041646.html | 49 + .../test/test_bug1123516_maplikesetlike.html | 271 ++++ .../test/test_bug1123516_maplikesetlikechrome.xul | 68 + dom/bindings/test/test_bug1123875.html | 14 + dom/bindings/test/test_bug1287912.html | 37 + dom/bindings/test/test_bug560072.html | 33 + dom/bindings/test/test_bug742191.html | 36 + dom/bindings/test/test_bug759621.html | 29 + dom/bindings/test/test_bug773326.html | 11 + dom/bindings/test/test_bug775543.html | 37 + dom/bindings/test/test_bug788369.html | 30 + dom/bindings/test/test_bug852846.html | 34 + dom/bindings/test/test_bug862092.html | 37 + dom/bindings/test/test_bug963382.html | 43 + .../test/test_callback_across_document_open.html | 21 + .../test/test_callback_default_thisval.html | 36 + dom/bindings/test/test_callback_exceptions.html | 17 + dom/bindings/test/test_cloneAndImportNode.html | 48 + .../test/test_crossOriginWindowSymbolAccess.html | 23 + dom/bindings/test/test_defineProperty.html | 157 +++ .../test/test_document_location_set_via_xray.html | 49 + .../test_document_location_via_xray_cached.html | 36 + .../test/test_domProxyArrayLengthGetter.html | 28 + dom/bindings/test/test_dom_xrays.html | 231 ++++ dom/bindings/test/test_enums.html | 15 + dom/bindings/test/test_exceptionSanitization.html | 45 + dom/bindings/test/test_exceptionThrowing.html | 56 + dom/bindings/test/test_exception_messages.html | 82 ++ .../test_exception_options_from_jsimplemented.html | 166 +++ .../test/test_exceptions_from_jsimplemented.html | 56 + dom/bindings/test/test_forOf.html | 86 ++ dom/bindings/test/test_integers.html | 50 + dom/bindings/test/test_interfaceName.html | 28 + dom/bindings/test/test_interfaceToString.html | 47 + dom/bindings/test/test_iterable.html | 241 ++++ .../test/test_jsimplemented_eventhandler.html | 47 + .../test_kill_longrunning_prerendered_content.xul | 85 ++ dom/bindings/test/test_lenientThis.html | 27 + dom/bindings/test/test_lookupGetter.html | 49 + dom/bindings/test/test_namedNoIndexed.html | 36 + .../test/test_named_getter_enumerability.html | 40 + dom/bindings/test/test_oom_reporting.html | 42 + dom/bindings/test/test_primitive_this.html | 45 + ...test_promise_rejections_from_jsimplemented.html | 143 ++ dom/bindings/test/test_proxies_via_xray.html | 99 ++ dom/bindings/test/test_queryInterface.html | 41 + dom/bindings/test/test_returnUnion.html | 59 + dom/bindings/test/test_sequence_detection.html | 53 + dom/bindings/test/test_sequence_wrapping.html | 59 + .../test/test_setWithNamedGetterNoNamedSetter.html | 40 + dom/bindings/test/test_stringBindings.html | 59 + dom/bindings/test/test_throwing_method_noDCE.html | 27 + dom/bindings/test/test_traceProtos.html | 37 + .../test/test_treat_non_object_as_null.html | 39 + dom/bindings/test/test_unforgeablesonexpando.html | 18 + dom/bindings/test/test_usvstring.html | 41 + dom/bindings/test/test_worker_UnwrapArg.html | 58 + 103 files changed, 9870 insertions(+) create mode 100644 dom/bindings/test/Makefile.in create mode 100644 dom/bindings/test/TestBindingHeader.h create mode 100644 dom/bindings/test/TestCImplementedInterface.h create mode 100644 dom/bindings/test/TestCodeGen.webidl create mode 100644 dom/bindings/test/TestDictionary.webidl create mode 100644 dom/bindings/test/TestExampleGen.webidl create mode 100644 dom/bindings/test/TestFunctions.cpp create mode 100644 dom/bindings/test/TestFunctions.h create mode 100644 dom/bindings/test/TestInterfaceIterableDouble.cpp create mode 100644 dom/bindings/test/TestInterfaceIterableDouble.h create mode 100644 dom/bindings/test/TestInterfaceIterableDoubleUnion.cpp create mode 100644 dom/bindings/test/TestInterfaceIterableDoubleUnion.h create mode 100644 dom/bindings/test/TestInterfaceIterableSingle.cpp create mode 100644 dom/bindings/test/TestInterfaceIterableSingle.h create mode 100644 dom/bindings/test/TestInterfaceJS.js create mode 100644 dom/bindings/test/TestInterfaceJS.manifest create mode 100644 dom/bindings/test/TestInterfaceJSMaplike.js create mode 100644 dom/bindings/test/TestInterfaceMaplike.cpp create mode 100644 dom/bindings/test/TestInterfaceMaplike.h create mode 100644 dom/bindings/test/TestInterfaceMaplikeObject.cpp create mode 100644 dom/bindings/test/TestInterfaceMaplikeObject.h create mode 100644 dom/bindings/test/TestInterfaceSetlike.cpp create mode 100644 dom/bindings/test/TestInterfaceSetlike.h create mode 100644 dom/bindings/test/TestInterfaceSetlikeNode.cpp create mode 100644 dom/bindings/test/TestInterfaceSetlikeNode.h create mode 100644 dom/bindings/test/TestJSImplGen.webidl create mode 100644 dom/bindings/test/TestJSImplInheritanceGen.webidl create mode 100644 dom/bindings/test/TestTypedef.webidl create mode 100644 dom/bindings/test/chrome.ini create mode 100644 dom/bindings/test/file_InstanceOf.html create mode 100644 dom/bindings/test/file_bug775543.html create mode 100644 dom/bindings/test/file_document_location_set_via_xray.html create mode 100644 dom/bindings/test/file_dom_xrays.html create mode 100644 dom/bindings/test/file_focuser.html create mode 100644 dom/bindings/test/file_fullScreenPropertyAccessor.html create mode 100644 dom/bindings/test/file_proxies_via_xray.html create mode 100644 dom/bindings/test/forOf_iframe.html create mode 100644 dom/bindings/test/mochitest.ini create mode 100644 dom/bindings/test/moz.build create mode 100644 dom/bindings/test/test_ByteString.html create mode 100644 dom/bindings/test/test_InstanceOf.html create mode 100644 dom/bindings/test/test_Object.prototype_props.html create mode 100644 dom/bindings/test/test_async_stacks.html create mode 100644 dom/bindings/test/test_barewordGetsWindow.html create mode 100644 dom/bindings/test/test_blacklisted_prerendering_function.xul create mode 100644 dom/bindings/test/test_bug1036214.html create mode 100644 dom/bindings/test/test_bug1041646.html create mode 100644 dom/bindings/test/test_bug1123516_maplikesetlike.html create mode 100644 dom/bindings/test/test_bug1123516_maplikesetlikechrome.xul create mode 100644 dom/bindings/test/test_bug1123875.html create mode 100644 dom/bindings/test/test_bug1287912.html create mode 100644 dom/bindings/test/test_bug560072.html create mode 100644 dom/bindings/test/test_bug742191.html create mode 100644 dom/bindings/test/test_bug759621.html create mode 100644 dom/bindings/test/test_bug773326.html create mode 100644 dom/bindings/test/test_bug775543.html create mode 100644 dom/bindings/test/test_bug788369.html create mode 100644 dom/bindings/test/test_bug852846.html create mode 100644 dom/bindings/test/test_bug862092.html create mode 100644 dom/bindings/test/test_bug963382.html create mode 100644 dom/bindings/test/test_callback_across_document_open.html create mode 100644 dom/bindings/test/test_callback_default_thisval.html create mode 100644 dom/bindings/test/test_callback_exceptions.html create mode 100644 dom/bindings/test/test_cloneAndImportNode.html create mode 100644 dom/bindings/test/test_crossOriginWindowSymbolAccess.html create mode 100644 dom/bindings/test/test_defineProperty.html create mode 100644 dom/bindings/test/test_document_location_set_via_xray.html create mode 100644 dom/bindings/test/test_document_location_via_xray_cached.html create mode 100644 dom/bindings/test/test_domProxyArrayLengthGetter.html create mode 100644 dom/bindings/test/test_dom_xrays.html create mode 100644 dom/bindings/test/test_enums.html create mode 100644 dom/bindings/test/test_exceptionSanitization.html create mode 100644 dom/bindings/test/test_exceptionThrowing.html create mode 100644 dom/bindings/test/test_exception_messages.html create mode 100644 dom/bindings/test/test_exception_options_from_jsimplemented.html create mode 100644 dom/bindings/test/test_exceptions_from_jsimplemented.html create mode 100644 dom/bindings/test/test_forOf.html create mode 100644 dom/bindings/test/test_integers.html create mode 100644 dom/bindings/test/test_interfaceName.html create mode 100644 dom/bindings/test/test_interfaceToString.html create mode 100644 dom/bindings/test/test_iterable.html create mode 100644 dom/bindings/test/test_jsimplemented_eventhandler.html create mode 100644 dom/bindings/test/test_kill_longrunning_prerendered_content.xul create mode 100644 dom/bindings/test/test_lenientThis.html create mode 100644 dom/bindings/test/test_lookupGetter.html create mode 100644 dom/bindings/test/test_namedNoIndexed.html create mode 100644 dom/bindings/test/test_named_getter_enumerability.html create mode 100644 dom/bindings/test/test_oom_reporting.html create mode 100644 dom/bindings/test/test_primitive_this.html create mode 100644 dom/bindings/test/test_promise_rejections_from_jsimplemented.html create mode 100644 dom/bindings/test/test_proxies_via_xray.html create mode 100644 dom/bindings/test/test_queryInterface.html create mode 100644 dom/bindings/test/test_returnUnion.html create mode 100644 dom/bindings/test/test_sequence_detection.html create mode 100644 dom/bindings/test/test_sequence_wrapping.html create mode 100644 dom/bindings/test/test_setWithNamedGetterNoNamedSetter.html create mode 100644 dom/bindings/test/test_stringBindings.html create mode 100644 dom/bindings/test/test_throwing_method_noDCE.html create mode 100644 dom/bindings/test/test_traceProtos.html create mode 100644 dom/bindings/test/test_treat_non_object_as_null.html create mode 100644 dom/bindings/test/test_unforgeablesonexpando.html create mode 100644 dom/bindings/test/test_usvstring.html create mode 100644 dom/bindings/test/test_worker_UnwrapArg.html (limited to 'dom/bindings/test') diff --git a/dom/bindings/test/Makefile.in b/dom/bindings/test/Makefile.in new file mode 100644 index 000000000..844a51c27 --- /dev/null +++ b/dom/bindings/test/Makefile.in @@ -0,0 +1,21 @@ +# 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/. + +ifdef COMPILE_ENVIRONMENT + +include ../webidlsrcs.mk + +# $(test_sources) comes from webidlsrcs.mk. +# TODO Update this variable in backend.mk. +CPPSRCS += $(addprefix ../,$(test_sources)) + +# Include rules.mk before any of our targets so our first target is coming from +# rules.mk and running make with no target in this dir does the right thing. +include $(topsrcdir)/config/rules.mk + +endif + +check:: + PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \ + $(PLY_INCLUDE) $(srcdir)/../parser/runtests.py diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h new file mode 100644 index 000000000..ca5aafdc5 --- /dev/null +++ b/dom/bindings/test/TestBindingHeader.h @@ -0,0 +1,1431 @@ +/* -*- 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/Date.h" +#include "mozilla/dom/MozMap.h" +#include "mozilla/dom/TypedArray.h" +#include "mozilla/ErrorResult.h" +#include "nsCOMPtr.h" +#include "nsGenericHTMLElement.h" +#include "nsWrapperCache.h" + +// 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 TestExternalInterface; +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 IndirectlyImplementedInterface +#define NS_INDIRECTLY_IMPLEMENTED_INTERFACE_IID \ +{ 0xfed55b69, 0x7012, 0x4849, \ + { 0xaf, 0x56, 0x4b, 0xa9, 0xee, 0x41, 0x30, 0x89 } } + +class IndirectlyImplementedInterface : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECLARE_STATIC_IID_ACCESSOR(NS_INDIRECTLY_IMPLEMENTED_INTERFACE_IID) + NS_DECL_ISUPPORTS + + // We need a GetParentObject to make binding codegen happy + virtual nsISupports* GetParentObject(); + + bool IndirectlyImplementedProperty(); + void IndirectlyImplementedProperty(bool); + void IndirectlyImplementedMethod(); +}; + +NS_DEFINE_STATIC_IID_ACCESSOR(IndirectlyImplementedInterface, NS_INDIRECTLY_IMPLEMENTED_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 to make binding codegen happy + virtual nsISupports* GetParentObject(); + + // And now our actual WebIDL API + // Constructors + 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, IndirectlyImplementedInterface&, ErrorResult&); + + static + already_AddRefed + Constructor(const GlobalObject&, Date&, 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&); + */ + + 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 LongOrAnyMozMap&, + 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< Nullable >&); + void PassVariadicByte(const Sequence&); + int8_t CachedByte(); + int8_t CachedConstantByte(); + int8_t CachedWritableByte(); + void SetCachedWritableByte(int8_t); + int8_t SideEffectFreeByte(); + int8_t SetSideEffectFreeByte(int8_t); + int8_t DomDependentByte(); + int8_t 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(Nullable); + Nullable GetWritableNullableUnrestrictedFloat() const; + void SetWritableNullableUnrestrictedFloat(Nullable); + double WritableDouble() const; + void SetWritableDouble(double); + double WritableUnrestrictedDouble() const; + void SetWritableUnrestrictedDouble(double); + Nullable GetWritableNullableDouble() const; + void SetWritableNullableDouble(Nullable); + Nullable GetWritableNullableUnrestrictedDouble() const; + void SetWritableNullableUnrestrictedDouble(Nullable); + void PassFloat(float, float, Nullable, Nullable, + double, double, Nullable, Nullable, + const Sequence&, const Sequence&, + const Sequence >&, + const Sequence >&, + const Sequence&, const Sequence&, + const Sequence >&, + const Sequence >&); + void PassLenientFloat(float, float, Nullable, Nullable, + double, double, Nullable, 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 ReceiveOther(); + already_AddRefed ReceiveNullableOther(); + IndirectlyImplementedInterface* ReceiveWeakOther(); + IndirectlyImplementedInterface* ReceiveWeakNullableOther(); + void PassOther(IndirectlyImplementedInterface&); + void PassNullableOther(IndirectlyImplementedInterface*); + already_AddRefed NonNullOther(); + void SetNonNullOther(IndirectlyImplementedInterface&); + already_AddRefed GetNullableOther(); + void SetNullableOther(IndirectlyImplementedInterface*); + void PassOptionalOther(const Optional&); + void PassOptionalNonNullOther(const Optional >&); + void PassOptionalOtherWithDefault(IndirectlyImplementedInterface*); + + 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*); + + already_AddRefed ReceiveConsequentialInterface(); + void PassConsequentialInterface(IndirectlyImplementedInterface&); + + // 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< nsTArray >&); + void ReceiveSequenceOfNullableInts(nsTArray< Nullable >&); + void ReceiveNullableSequenceOfNullableInts(Nullable< nsTArray< Nullable > >&); + void PassSequence(const Sequence &); + void PassNullableSequence(const Nullable< Sequence >&); + void PassSequenceOfNullableInts(const Sequence >&); + void PassOptionalSequenceOfNullableInts(const Optional > > &); + void PassOptionalNullableSequenceOfNullableInts(const Optional > > > &); + void ReceiveCastableObjectSequence(nsTArray< RefPtr > &); + void ReceiveCallbackObjectSequence(nsTArray< RefPtr > &); + void ReceiveNullableCastableObjectSequence(nsTArray< RefPtr > &); + void ReceiveNullableCallbackObjectSequence(nsTArray< RefPtr > &); + void ReceiveCastableObjectNullableSequence(Nullable< nsTArray< RefPtr > >&); + void ReceiveNullableCastableObjectNullableSequence(Nullable< nsTArray< RefPtr > >&); + void ReceiveWeakCastableObjectSequence(nsTArray> &); + void ReceiveWeakNullableCastableObjectSequence(nsTArray> &); + void ReceiveWeakCastableObjectNullableSequence(Nullable< nsTArray> >&); + void ReceiveWeakNullableCastableObjectNullableSequence(Nullable< nsTArray> >&); + void PassCastableObjectSequence(const Sequence< OwningNonNull >&); + void PassNullableCastableObjectSequence(const Sequence< RefPtr > &); + void PassCastableObjectNullableSequence(const Nullable< Sequence< OwningNonNull > >&); + void PassNullableCastableObjectNullableSequence(const Nullable< Sequence< RefPtr > >&); + void PassOptionalSequence(const Optional >&); + void PassOptionalSequenceWithDefaultValue(const Sequence &); + void PassOptionalNullableSequence(const Optional > >&); + void PassOptionalNullableSequenceWithDefaultValue(const Nullable< Sequence >&); + void PassOptionalNullableSequenceWithDefaultValue2(const Nullable< Sequence >&); + 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 ReceiveAnySequence(JSContext*, nsTArray&); + void ReceiveNullableAnySequence(JSContext*, Nullable >&); + void ReceiveAnySequenceSequence(JSContext*, nsTArray >&); + + void ReceiveObjectSequence(JSContext*, nsTArray&); + void ReceiveNullableObjectSequence(JSContext*, nsTArray&); + + void PassSequenceOfSequences(const Sequence< Sequence >&); + void PassSequenceOfSequencesOfSequences(const Sequence>>&); + void ReceiveSequenceOfSequences(nsTArray< nsTArray >&); + void ReceiveSequenceOfSequencesOfSequences(nsTArray>>&); + + // MozMap types + void PassMozMap(const MozMap &); + void PassNullableMozMap(const Nullable< MozMap >&); + void PassMozMapOfNullableInts(const MozMap >&); + void PassOptionalMozMapOfNullableInts(const Optional > > &); + void PassOptionalNullableMozMapOfNullableInts(const Optional > > > &); + void PassCastableObjectMozMap(const MozMap< OwningNonNull >&); + void PassNullableCastableObjectMozMap(const MozMap< RefPtr > &); + void PassCastableObjectNullableMozMap(const Nullable< MozMap< OwningNonNull > >&); + void PassNullableCastableObjectNullableMozMap(const Nullable< MozMap< RefPtr > >&); + void PassOptionalMozMap(const Optional >&); + void PassOptionalNullableMozMap(const Optional > >&); + void PassOptionalNullableMozMapWithDefaultValue(const Nullable< MozMap >&); + void PassOptionalObjectMozMap(const Optional > >&); + void PassExternalInterfaceMozMap(const MozMap >&); + void PassNullableExternalInterfaceMozMap(const MozMap >&); + void PassStringMozMap(const MozMap&); + void PassByteStringMozMap(const MozMap&); + void PassMozMapOfMozMaps(const MozMap< MozMap >&); + void ReceiveMozMap(MozMap&); + void ReceiveNullableMozMap(Nullable>&); + void ReceiveMozMapOfNullableInts(MozMap>&); + void ReceiveNullableMozMapOfNullableInts(Nullable>>&); + void ReceiveMozMapOfMozMaps(MozMap>&); + void ReceiveAnyMozMap(JSContext*, MozMap&); + + // 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 PassMozMapOfArrayBuffers(const MozMap&); + void PassMozMapOfNullableArrayBuffers(const MozMap >&); + 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&); + + // 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&); + + // 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&); + + // 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 PassMozMapOfAny(JSContext*, const MozMap&); + void PassNullableMozMapOfAny(JSContext*, const Nullable >&); + void PassOptionalMozMapOfAny(JSContext*, const Optional >&); + void PassOptionalNullableMozMapOfAny(JSContext*, const Optional > >&); + void PassOptionalMozMapOfAnyWithDefaultValue(JSContext*, const Nullable >&); + void PassMozMapOfMozMapOfAny(JSContext*, const MozMap >&); + void PassMozMapOfNullableMozMapOfAny(JSContext*, const MozMap > >&); + void PassNullableMozMapOfNullableMozMapOfAny(JSContext*, const Nullable > > >&); + void PassOptionalNullableMozMapOfNullableMozMapOfAny(JSContext*, const Optional>>>>&); + void PassOptionalNullableMozMapOfNullableSequenceOfAny(JSContext*, const Optional>>>>&); + void PassOptionalNullableSequenceOfNullableMozMapOfAny(JSContext*, const Optional>>>>&); + 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 PassMozMapOfObject(JSContext*, const MozMap&); + 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 LongMozMapOrLong&); + void PassUnion22(JSContext*, const ObjectMozMapOrLong&); + 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 PassUnionWithMozMap(const StringMozMapOrString&); + void PassUnionWithMozMapAndSequence(const StringMozMapOrStringSequence&); + void PassUnionWithSequenceAndMozMap(const StringSequenceOrStringMozMap&); + 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 ArrayBufferOrLong&); + 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 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 PassSequenceOfUnions(const Sequence&); + void PassSequenceOfUnions2(JSContext*, const Sequence&); + void PassVariadicUnion(const Sequence&); + + void PassSequenceOfNullableUnions(const Sequence>&); + void PassVariadicNullableUnion(const Sequence>&); + void PassMozMapOfUnions(const MozMap&); + void PassMozMapOfUnions2(JSContext*, const MozMap&); + + void ReceiveUnion(OwningCanvasPatternOrCanvasGradient&); + void ReceiveUnion2(JSContext*, OwningObjectOrLong&); + void ReceiveUnionContainingNull(OwningCanvasPatternOrNullOrCanvasGradient&); + void ReceiveNullableUnion(Nullable&); + void ReceiveNullableUnion2(JSContext*, Nullable&); + void GetWritableUnion(OwningCanvasPatternOrCanvasGradient&); + void SetWritableUnion(const CanvasPatternOrCanvasGradient&); + void GetWritableUnionContainingNull(OwningCanvasPatternOrNullOrCanvasGradient&); + void SetWritableUnionContainingNull(const CanvasPatternOrNullOrCanvasGradient&); + void GetWritableNullableUnion(Nullable&); + void SetWritableNullableUnion(const Nullable&); + + // Date types + void PassDate(Date); + void PassNullableDate(const Nullable&); + void PassOptionalDate(const Optional&); + void PassOptionalNullableDate(const Optional >&); + void PassOptionalNullableDateWithDefaultValue(const Nullable&); + void PassDateSequence(const Sequence&); + void PassDateMozMap(const MozMap&); + void PassNullableDateSequence(const Sequence >&); + Date ReceiveDate(); + Nullable ReceiveNullableDate(); + + // Promise types + void PassPromise(Promise&); + void PassNullablePromise(Promise*); + void PassOptionalPromise(const Optional>&); + void PassOptionalNullablePromise(const Optional>&); + void PassOptionalNullablePromiseWithDefaultValue(Promise*); + void PassPromiseSequence(const Sequence>&); + void PassPromiseMozMap(const MozMap>&); + void PassNullablePromiseSequence(const Sequence> &); + Promise* ReceivePromise(); + already_AddRefed ReceiveAddrefedPromise(); + + // binaryNames tests + void MethodRenamedTo(); + void OtherMethodRenamedTo(); + void MethodRenamedTo(int8_t); + int8_t AttributeGetterRenamedTo(); + int8_t AttributeRenamedTo(); + void SetAttributeRenamedTo(int8_t); + int8_t OtherAttributeRenamedTo(); + void SetOtherAttributeRenamedTo(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 PassMozMapOfDictionaries(const MozMap&); + 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(); + int8_t 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 int8_t SetStaticDeprecatedAttribute(const GlobalObject&, int8_t); + static int8_t StaticDeprecatedMethod(const GlobalObject&); + static int8_t 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 Overload2(Date); + 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 MozMap&); + void Overload18(const MozMap&); + 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(); + + // 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 GetJsonifierShouldSkipThis(JSContext*, JS::MutableHandle); + void SetJsonifierShouldSkipThis(JSContext*, JS::Rooted&); + TestParentInterface* JsonifierShouldSkipThis2(); + void SetJsonifierShouldSkipThis2(TestParentInterface&); + TestCallbackInterface* JsonifierShouldSkipThis3(); + void SetJsonifierShouldSkipThis3(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 NeedsSubjectPrincipalMethod(nsIPrincipal&); + bool NeedsSubjectPrincipalAttr(nsIPrincipal&); + void SetNeedsSubjectPrincipalAttr(bool, nsIPrincipal&); + void NeedsCallerTypeMethod(CallerType); + bool NeedsCallerTypeAttr(CallerType); + void SetNeedsCallerTypeAttr(bool, CallerType); + 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(); + + // Methods and properties imported via "implements" + bool ImplementedProperty(); + void SetImplementedProperty(bool); + void ImplementedMethod(); + bool ImplementedParentProperty(); + void SetImplementedParentProperty(bool); + void ImplementedParentMethod(); + bool IndirectlyImplementedProperty(); + void SetIndirectlyImplementedProperty(bool); + void IndirectlyImplementedMethod(); + uint32_t DiamondImplementedProperty(); + + // Test EnforceRange/Clamp + void DontEnforceRangeOrClamp(int8_t); + void DoEnforceRange(int8_t); + void DoClamp(int8_t); + void SetEnforcedByte(int8_t); + int8_t EnforcedByte(); + void SetClampedByte(int8_t); + int8_t ClampedByte(); + +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< Sequence >&) = delete; + void PassOptionalNullableSequenceWithDefaultValue(Nullable< Sequence >&) = 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 PassOptionalOther(Optional&); + void PassOptionalNonNullOther(Optional >&); + 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; + + // 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 various date stuff is const as needed + void PassNullableDate(Nullable&) = delete; + void PassOptionalDate(Optional&) = delete; + void PassOptionalNullableDate(Optional >&) = delete; + void PassOptionalNullableDateWithDefaultValue(Nullable&) = delete; + void PassDateSequence(Sequence&) = delete; + void PassNullableDateSequence(Sequence >&) = 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 PassOther(NonNull&) = delete; + void PassOther(const NonNull&) = delete; + void PassOther(OwningNonNull&) = delete; + void PassOther(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); +}; + +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&, ErrorResult&); + + 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&, ErrorResult&); + + 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(Maybe); + bool NeedsSubjectPrincipalAttr(Maybe); + void SetNeedsSubjectPrincipalAttr(bool, Maybe); + void NeedsCallerTypeMethod(CallerType); + bool NeedsCallerTypeAttr(CallerType); + void SetNeedsCallerTypeAttr(bool, CallerType); +}; + +} // namespace dom +} // namespace mozilla + +#endif /* TestBindingHeader_h */ diff --git a/dom/bindings/test/TestCImplementedInterface.h b/dom/bindings/test/TestCImplementedInterface.h new file mode 100644 index 000000000..64b5c9954 --- /dev/null +++ b/dom/bindings/test/TestCImplementedInterface.h @@ -0,0 +1,43 @@ +/* -*- 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 TestCImplementedInterface_h +#define TestCImplementedInterface_h + +#include "../TestJSImplGenBinding.h" + +namespace mozilla { +namespace dom { + +class TestCImplementedInterface : public TestJSImplInterface +{ +public: + TestCImplementedInterface(JS::Handle aJSImpl, + nsIGlobalObject* aParent) + : TestJSImplInterface(aJSImpl, aParent) + {} +}; + +class TestCImplementedInterface2 : public nsISupports, + public nsWrapperCache +{ +public: + explicit TestCImplementedInterface2(nsIGlobalObject* aParent) + {} + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestCImplementedInterface2) + + // We need a GetParentObject to make binding codegen happy + nsISupports* GetParentObject(); +}; + + + +} // namespace dom +} // namespace mozilla + +#endif // TestCImplementedInterface_h diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl new file mode 100644 index 000000000..4fb9be270 --- /dev/null +++ b/dom/bindings/test/TestCodeGen.webidl @@ -0,0 +1,1264 @@ +/* -*- Mode: IDL; 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/. + */ + +typedef long myLong; +typedef TestInterface AnotherNameForTestInterface; +typedef TestInterface? NullableTestInterface; +typedef CustomEventInit TestDictionaryTypedef; + +interface TestExternalInterface; + +[Pref="xyz"] +interface TestRenamedInterface { +}; + +callback interface TestCallbackInterface { + readonly attribute long foo; + attribute DOMString bar; + void doSomething(); + long doSomethingElse(DOMString arg, TestInterface otherArg); + void doSequenceLongArg(sequence arg); + void doSequenceStringArg(sequence arg); + void doMozMapLongArg(MozMap arg); + sequence getSequenceOfLong(); + sequence getSequenceOfInterfaces(); + sequence? getNullableSequenceOfInterfaces(); + sequence getSequenceOfNullableInterfaces(); + sequence? getNullableSequenceOfNullableInterfaces(); + sequence getSequenceOfCallbackInterfaces(); + sequence? getNullableSequenceOfCallbackInterfaces(); + sequence getSequenceOfNullableCallbackInterfaces(); + sequence? getNullableSequenceOfNullableCallbackInterfaces(); + MozMap getMozMapOfLong(); + Dict? getDictionary(); + void passArrayBuffer(ArrayBuffer arg); + void passNullableArrayBuffer(ArrayBuffer? arg); + void passOptionalArrayBuffer(optional ArrayBuffer arg); + void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg); + void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null); + void passArrayBufferView(ArrayBufferView arg); + void passInt8Array(Int8Array arg); + void passInt16Array(Int16Array arg); + void passInt32Array(Int32Array arg); + void passUint8Array(Uint8Array arg); + void passUint16Array(Uint16Array arg); + void passUint32Array(Uint32Array arg); + void passUint8ClampedArray(Uint8ClampedArray arg); + void passFloat32Array(Float32Array arg); + void passFloat64Array(Float64Array arg); + void passSequenceOfArrayBuffers(sequence arg); + void passSequenceOfNullableArrayBuffers(sequence arg); + void passVariadicTypedArray(Float32Array... arg); + void passVariadicNullableTypedArray(Float32Array?... arg); + Uint8Array receiveUint8Array(); + attribute Uint8Array uint8ArrayAttr; + Promise receivePromise(); +}; + +callback interface TestSingleOperationCallbackInterface { + TestInterface doSomething(short arg, sequence anotherArg); +}; + +enum TestEnum { + "1", + "a", + "b" +}; + +callback TestCallback = void(); +[TreatNonCallableAsNull] callback TestTreatAsNullCallback = void(); + +// Callback return value tests +callback TestIntegerReturn = long(); +callback TestNullableIntegerReturn = long?(); +callback TestBooleanReturn = boolean(); +callback TestFloatReturn = float(); +callback TestStringReturn = DOMString(long arg); +callback TestEnumReturn = TestEnum(); +callback TestInterfaceReturn = TestInterface(); +callback TestNullableInterfaceReturn = TestInterface?(); +callback TestExternalInterfaceReturn = TestExternalInterface(); +callback TestNullableExternalInterfaceReturn = TestExternalInterface?(); +callback TestCallbackInterfaceReturn = TestCallbackInterface(); +callback TestNullableCallbackInterfaceReturn = TestCallbackInterface?(); +callback TestCallbackReturn = TestCallback(); +callback TestNullableCallbackReturn = TestCallback?(); +callback TestObjectReturn = object(); +callback TestNullableObjectReturn = object?(); +callback TestTypedArrayReturn = ArrayBuffer(); +callback TestNullableTypedArrayReturn = ArrayBuffer?(); +callback TestSequenceReturn = sequence(); +callback TestNullableSequenceReturn = sequence?(); +// Callback argument tests +callback TestIntegerArguments = sequence(long arg1, long? arg2, + sequence arg3, + sequence? arg4); +callback TestInterfaceArguments = void(TestInterface arg1, TestInterface? arg2, + TestExternalInterface arg3, + TestExternalInterface? arg4, + TestCallbackInterface arg5, + TestCallbackInterface? arg6, + sequence arg7, + sequence? arg8, + sequence arg9, + sequence? arg10, + sequence arg11, + sequence? arg12); +callback TestStringEnumArguments = void(DOMString myString, DOMString? nullString, + TestEnum myEnum); +callback TestObjectArguments = void(object anObj, object? anotherObj, + ArrayBuffer buf, ArrayBuffer? buf2); +callback TestOptionalArguments = void(optional DOMString aString, + optional object something, + optional sequence aSeq, + optional TestInterface? anInterface, + optional TestInterface anotherInterface, + optional long aLong); +// If you add a new test callback, add it to the forceCallbackGeneration +// method on TestInterface so it actually gets tested. + +TestInterface implements ImplementedInterface; + +// This interface is only for use in the constructor below +interface OnlyForUseInConstructor { +}; + +[Constructor, + Constructor(DOMString str), + Constructor(unsigned long num, boolean? boolArg), + Constructor(TestInterface? iface), + Constructor(long arg1, IndirectlyImplementedInterface iface), + Constructor(Date arg1), + Constructor(ArrayBuffer arrayBuf), + Constructor(Uint8Array typedArr), + // Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3), + NamedConstructor=Test, + NamedConstructor=Test(DOMString str), + NamedConstructor=Test2(DictForConstructor dict, any any1, object obj1, + object? obj2, sequence seq, optional any any2, + optional object obj3, optional object? obj4), + NamedConstructor=Test3((long or MozMap) arg1) + ] +interface TestInterface { + // Integer types + // XXXbz add tests for throwing versions of all the integer stuff + readonly attribute byte readonlyByte; + attribute byte writableByte; + void passByte(byte arg); + byte receiveByte(); + void passOptionalByte(optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); + void passOptionalByteWithDefault(optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); + void passNullableByte(byte? arg); + void passOptionalNullableByte(optional byte? arg); + void passVariadicByte(byte... arg); + [StoreInSlot, Pure] + readonly attribute byte cachedByte; + [StoreInSlot, Constant] + readonly attribute byte cachedConstantByte; + [StoreInSlot, Pure] + attribute byte cachedWritableByte; + [Affects=Nothing] + attribute byte sideEffectFreeByte; + [Affects=Nothing, DependsOn=DOMState] + attribute byte domDependentByte; + [Affects=Nothing, DependsOn=Nothing] + readonly attribute byte constantByte; + [DependsOn=DeviceState, Affects=Nothing] + readonly attribute byte deviceStateDependentByte; + [Affects=Nothing] + byte returnByteSideEffectFree(); + [Affects=Nothing, DependsOn=DOMState] + byte returnDOMDependentByte(); + [Affects=Nothing, DependsOn=Nothing] + byte returnConstantByte(); + [DependsOn=DeviceState, Affects=Nothing] + byte returnDeviceStateDependentByte(); + + [UnsafeInPrerendering] + void unsafePrerenderMethod(); + [UnsafeInPrerendering] + attribute long unsafePrerenderWritable; + [UnsafeInPrerendering] + readonly attribute long unsafePrerenderReadonly; + readonly attribute short readonlyShort; + attribute short writableShort; + void passShort(short arg); + short receiveShort(); + void passOptionalShort(optional short arg); + void passOptionalShortWithDefault(optional short arg = 5); + + readonly attribute long readonlyLong; + attribute long writableLong; + void passLong(long arg); + long receiveLong(); + void passOptionalLong(optional long arg); + void passOptionalLongWithDefault(optional long arg = 7); + + readonly attribute long long readonlyLongLong; + attribute long long writableLongLong; + void passLongLong(long long arg); + long long receiveLongLong(); + void passOptionalLongLong(optional long long arg); + void passOptionalLongLongWithDefault(optional long long arg = -12); + + readonly attribute octet readonlyOctet; + attribute octet writableOctet; + void passOctet(octet arg); + octet receiveOctet(); + void passOptionalOctet(optional octet arg); + void passOptionalOctetWithDefault(optional octet arg = 19); + + readonly attribute unsigned short readonlyUnsignedShort; + attribute unsigned short writableUnsignedShort; + void passUnsignedShort(unsigned short arg); + unsigned short receiveUnsignedShort(); + void passOptionalUnsignedShort(optional unsigned short arg); + void passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2); + + readonly attribute unsigned long readonlyUnsignedLong; + attribute unsigned long writableUnsignedLong; + void passUnsignedLong(unsigned long arg); + unsigned long receiveUnsignedLong(); + void passOptionalUnsignedLong(optional unsigned long arg); + void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6); + + readonly attribute unsigned long long readonlyUnsignedLongLong; + attribute unsigned long long writableUnsignedLongLong; + void passUnsignedLongLong(unsigned long long arg); + unsigned long long receiveUnsignedLongLong(); + void passOptionalUnsignedLongLong(optional unsigned long long arg); + void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17); + + attribute float writableFloat; + attribute unrestricted float writableUnrestrictedFloat; + attribute float? writableNullableFloat; + attribute unrestricted float? writableNullableUnrestrictedFloat; + attribute double writableDouble; + attribute unrestricted double writableUnrestrictedDouble; + attribute double? writableNullableDouble; + attribute unrestricted double? writableNullableUnrestrictedDouble; + void passFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, sequence arg10, + sequence arg11, sequence arg12, + sequence arg13, sequence arg14, + sequence arg15, sequence arg16); + [LenientFloat] + void passLenientFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, + sequence arg10, + sequence arg11, + sequence arg12, + sequence arg13, + sequence arg14, + sequence arg15, + sequence arg16); + [LenientFloat] + attribute float lenientFloatAttr; + [LenientFloat] + attribute double lenientDoubleAttr; + + void passUnrestricted(optional unrestricted float arg1 = 0, + optional unrestricted float arg2 = Infinity, + optional unrestricted float arg3 = -Infinity, + optional unrestricted float arg4 = NaN, + optional unrestricted double arg5 = 0, + optional unrestricted double arg6 = Infinity, + optional unrestricted double arg7 = -Infinity, + optional unrestricted double arg8 = NaN); + + // Castable interface types + // XXXbz add tests for throwing versions of all the castable interface stuff + TestInterface receiveSelf(); + TestInterface? receiveNullableSelf(); + TestInterface receiveWeakSelf(); + TestInterface? receiveWeakNullableSelf(); + void passSelf(TestInterface arg); + void passNullableSelf(TestInterface? arg); + attribute TestInterface nonNullSelf; + attribute TestInterface? nullableSelf; + [Cached, Pure] + readonly attribute TestInterface cachedSelf; + // Optional arguments + void passOptionalSelf(optional TestInterface? arg); + void passOptionalNonNullSelf(optional TestInterface arg); + void passOptionalSelfWithDefault(optional TestInterface? arg = null); + + // Non-wrapper-cache interface types + [NewObject] + TestNonWrapperCacheInterface receiveNonWrapperCacheInterface(); + [NewObject] + TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface(); + [NewObject] + sequence receiveNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence receiveNullableNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence? receiveNonWrapperCacheInterfaceNullableSequence(); + [NewObject] + sequence? receiveNullableNonWrapperCacheInterfaceNullableSequence(); + + // Non-castable interface types + IndirectlyImplementedInterface receiveOther(); + IndirectlyImplementedInterface? receiveNullableOther(); + IndirectlyImplementedInterface receiveWeakOther(); + IndirectlyImplementedInterface? receiveWeakNullableOther(); + void passOther(IndirectlyImplementedInterface arg); + void passNullableOther(IndirectlyImplementedInterface? arg); + attribute IndirectlyImplementedInterface nonNullOther; + attribute IndirectlyImplementedInterface? nullableOther; + // Optional arguments + void passOptionalOther(optional IndirectlyImplementedInterface? arg); + void passOptionalNonNullOther(optional IndirectlyImplementedInterface arg); + void passOptionalOtherWithDefault(optional IndirectlyImplementedInterface? arg = null); + + // External interface types + TestExternalInterface receiveExternal(); + TestExternalInterface? receiveNullableExternal(); + TestExternalInterface receiveWeakExternal(); + TestExternalInterface? receiveWeakNullableExternal(); + void passExternal(TestExternalInterface arg); + void passNullableExternal(TestExternalInterface? arg); + attribute TestExternalInterface nonNullExternal; + attribute TestExternalInterface? nullableExternal; + // Optional arguments + void passOptionalExternal(optional TestExternalInterface? arg); + void passOptionalNonNullExternal(optional TestExternalInterface arg); + void passOptionalExternalWithDefault(optional TestExternalInterface? arg = null); + + // Callback interface types + TestCallbackInterface receiveCallbackInterface(); + TestCallbackInterface? receiveNullableCallbackInterface(); + TestCallbackInterface receiveWeakCallbackInterface(); + TestCallbackInterface? receiveWeakNullableCallbackInterface(); + void passCallbackInterface(TestCallbackInterface arg); + void passNullableCallbackInterface(TestCallbackInterface? arg); + attribute TestCallbackInterface nonNullCallbackInterface; + attribute TestCallbackInterface? nullableCallbackInterface; + // Optional arguments + void passOptionalCallbackInterface(optional TestCallbackInterface? arg); + void passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg); + void passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null); + + // Miscellaneous interface tests + IndirectlyImplementedInterface receiveConsequentialInterface(); + void passConsequentialInterface(IndirectlyImplementedInterface arg); + + // Sequence types + [Cached, Pure] + readonly attribute sequence readonlySequence; + [Cached, Pure] + readonly attribute sequence readonlySequenceOfDictionaries; + [Cached, Pure] + readonly attribute sequence? readonlyNullableSequenceOfDictionaries; + [Cached, Pure, Frozen] + readonly attribute sequence readonlyFrozenSequence; + [Cached, Pure, Frozen] + readonly attribute sequence? readonlyFrozenNullableSequence; + sequence receiveSequence(); + sequence? receiveNullableSequence(); + sequence receiveSequenceOfNullableInts(); + sequence? receiveNullableSequenceOfNullableInts(); + void passSequence(sequence arg); + void passNullableSequence(sequence? arg); + void passSequenceOfNullableInts(sequence arg); + void passOptionalSequenceOfNullableInts(optional sequence arg); + void passOptionalNullableSequenceOfNullableInts(optional sequence? arg); + sequence receiveCastableObjectSequence(); + sequence receiveCallbackObjectSequence(); + sequence receiveNullableCastableObjectSequence(); + sequence receiveNullableCallbackObjectSequence(); + sequence? receiveCastableObjectNullableSequence(); + sequence? receiveNullableCastableObjectNullableSequence(); + sequence receiveWeakCastableObjectSequence(); + sequence receiveWeakNullableCastableObjectSequence(); + sequence? receiveWeakCastableObjectNullableSequence(); + sequence? receiveWeakNullableCastableObjectNullableSequence(); + void passCastableObjectSequence(sequence arg); + void passNullableCastableObjectSequence(sequence arg); + void passCastableObjectNullableSequence(sequence? arg); + void passNullableCastableObjectNullableSequence(sequence? arg); + void passOptionalSequence(optional sequence arg); + void passOptionalSequenceWithDefaultValue(optional sequence arg = []); + void passOptionalNullableSequence(optional sequence? arg); + void passOptionalNullableSequenceWithDefaultValue(optional sequence? arg = null); + void passOptionalNullableSequenceWithDefaultValue2(optional sequence? arg = []); + void passOptionalObjectSequence(optional sequence arg); + void passExternalInterfaceSequence(sequence arg); + void passNullableExternalInterfaceSequence(sequence arg); + + sequence receiveStringSequence(); + void passStringSequence(sequence arg); + + sequence receiveByteStringSequence(); + void passByteStringSequence(sequence arg); + + sequence receiveAnySequence(); + sequence? receiveNullableAnySequence(); + sequence> receiveAnySequenceSequence(); + + sequence receiveObjectSequence(); + sequence receiveNullableObjectSequence(); + + void passSequenceOfSequences(sequence> arg); + void passSequenceOfSequencesOfSequences(sequence>> arg); + sequence> receiveSequenceOfSequences(); + sequence>> receiveSequenceOfSequencesOfSequences(); + + // MozMap types + void passMozMap(MozMap arg); + void passNullableMozMap(MozMap? arg); + void passMozMapOfNullableInts(MozMap arg); + void passOptionalMozMapOfNullableInts(optional MozMap arg); + void passOptionalNullableMozMapOfNullableInts(optional MozMap? arg); + void passCastableObjectMozMap(MozMap arg); + void passNullableCastableObjectMozMap(MozMap arg); + void passCastableObjectNullableMozMap(MozMap? arg); + void passNullableCastableObjectNullableMozMap(MozMap? arg); + void passOptionalMozMap(optional MozMap arg); + void passOptionalNullableMozMap(optional MozMap? arg); + void passOptionalNullableMozMapWithDefaultValue(optional MozMap? arg = null); + void passOptionalObjectMozMap(optional MozMap arg); + void passExternalInterfaceMozMap(MozMap arg); + void passNullableExternalInterfaceMozMap(MozMap arg); + void passStringMozMap(MozMap arg); + void passByteStringMozMap(MozMap arg); + void passMozMapOfMozMaps(MozMap> arg); + MozMap receiveMozMap(); + MozMap? receiveNullableMozMap(); + MozMap receiveMozMapOfNullableInts(); + MozMap? receiveNullableMozMapOfNullableInts(); + MozMap> receiveMozMapOfMozMaps(); + MozMap receiveAnyMozMap(); + + // Typed array types + void passArrayBuffer(ArrayBuffer arg); + void passNullableArrayBuffer(ArrayBuffer? arg); + void passOptionalArrayBuffer(optional ArrayBuffer arg); + void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg); + void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null); + void passArrayBufferView(ArrayBufferView arg); + void passInt8Array(Int8Array arg); + void passInt16Array(Int16Array arg); + void passInt32Array(Int32Array arg); + void passUint8Array(Uint8Array arg); + void passUint16Array(Uint16Array arg); + void passUint32Array(Uint32Array arg); + void passUint8ClampedArray(Uint8ClampedArray arg); + void passFloat32Array(Float32Array arg); + void passFloat64Array(Float64Array arg); + void passSequenceOfArrayBuffers(sequence arg); + void passSequenceOfNullableArrayBuffers(sequence arg); + void passMozMapOfArrayBuffers(MozMap arg); + void passMozMapOfNullableArrayBuffers(MozMap arg); + void passVariadicTypedArray(Float32Array... arg); + void passVariadicNullableTypedArray(Float32Array?... arg); + Uint8Array receiveUint8Array(); + attribute Uint8Array uint8ArrayAttr; + + // DOMString types + void passString(DOMString arg); + void passNullableString(DOMString? arg); + void passOptionalString(optional DOMString arg); + void passOptionalStringWithDefaultValue(optional DOMString arg = "abc"); + void passOptionalNullableString(optional DOMString? arg); + void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null); + void passVariadicString(DOMString... arg); + DOMString receiveString(); + + // ByteString types + void passByteString(ByteString arg); + void passNullableByteString(ByteString? arg); + void passOptionalByteString(optional ByteString arg); + void passOptionalByteStringWithDefaultValue(optional ByteString arg = "abc"); + void passOptionalNullableByteString(optional ByteString? arg); + void passOptionalNullableByteStringWithDefaultValue(optional ByteString? arg = null); + void passVariadicByteString(ByteString... arg); + void passOptionalUnionByteString(optional (ByteString or long) arg); + void passOptionalUnionByteStringWithDefaultValue(optional (ByteString or long) arg = "abc"); + + // USVString types + void passUSVS(USVString arg); + void passNullableUSVS(USVString? arg); + void passOptionalUSVS(optional USVString arg); + void passOptionalUSVSWithDefaultValue(optional USVString arg = "abc"); + void passOptionalNullableUSVS(optional USVString? arg); + void passOptionalNullableUSVSWithDefaultValue(optional USVString? arg = null); + void passVariadicUSVS(USVString... arg); + USVString receiveUSVS(); + + // Enumerated types + void passEnum(TestEnum arg); + void passNullableEnum(TestEnum? arg); + void passOptionalEnum(optional TestEnum arg); + void passEnumWithDefault(optional TestEnum arg = "a"); + void passOptionalNullableEnum(optional TestEnum? arg); + void passOptionalNullableEnumWithDefaultValue(optional TestEnum? arg = null); + void passOptionalNullableEnumWithDefaultValue2(optional TestEnum? arg = "a"); + TestEnum receiveEnum(); + TestEnum? receiveNullableEnum(); + attribute TestEnum enumAttribute; + readonly attribute TestEnum readonlyEnumAttribute; + + // Callback types + void passCallback(TestCallback arg); + void passNullableCallback(TestCallback? arg); + void passOptionalCallback(optional TestCallback arg); + void passOptionalNullableCallback(optional TestCallback? arg); + void passOptionalNullableCallbackWithDefaultValue(optional TestCallback? arg = null); + TestCallback receiveCallback(); + TestCallback? receiveNullableCallback(); + void passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg); + void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg); + void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null); + attribute TestTreatAsNullCallback treatAsNullCallback; + attribute TestTreatAsNullCallback? nullableTreatAsNullCallback; + + // Force code generation of the various test callbacks we have. + void forceCallbackGeneration(TestIntegerReturn arg1, + TestNullableIntegerReturn arg2, + TestBooleanReturn arg3, + TestFloatReturn arg4, + TestStringReturn arg5, + TestEnumReturn arg6, + TestInterfaceReturn arg7, + TestNullableInterfaceReturn arg8, + TestExternalInterfaceReturn arg9, + TestNullableExternalInterfaceReturn arg10, + TestCallbackInterfaceReturn arg11, + TestNullableCallbackInterfaceReturn arg12, + TestCallbackReturn arg13, + TestNullableCallbackReturn arg14, + TestObjectReturn arg15, + TestNullableObjectReturn arg16, + TestTypedArrayReturn arg17, + TestNullableTypedArrayReturn arg18, + TestSequenceReturn arg19, + TestNullableSequenceReturn arg20, + TestIntegerArguments arg21, + TestInterfaceArguments arg22, + TestStringEnumArguments arg23, + TestObjectArguments arg24, + TestOptionalArguments arg25); + + // Any types + void passAny(any arg); + void passVariadicAny(any... arg); + void passOptionalAny(optional any arg); + void passAnyDefaultNull(optional any arg = null); + void passSequenceOfAny(sequence arg); + void passNullableSequenceOfAny(sequence? arg); + void passOptionalSequenceOfAny(optional sequence arg); + void passOptionalNullableSequenceOfAny(optional sequence? arg); + void passOptionalSequenceOfAnyWithDefaultValue(optional sequence? arg = null); + void passSequenceOfSequenceOfAny(sequence> arg); + void passSequenceOfNullableSequenceOfAny(sequence?> arg); + void passNullableSequenceOfNullableSequenceOfAny(sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence?>? arg); + void passMozMapOfAny(MozMap arg); + void passNullableMozMapOfAny(MozMap? arg); + void passOptionalMozMapOfAny(optional MozMap arg); + void passOptionalNullableMozMapOfAny(optional MozMap? arg); + void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap? arg = null); + void passMozMapOfMozMapOfAny(MozMap> arg); + void passMozMapOfNullableMozMapOfAny(MozMap?> arg); + void passNullableMozMapOfNullableMozMapOfAny(MozMap?>? arg); + void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap?>? arg); + void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap?>? arg); + void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence?>? arg); + any receiveAny(); + + // object types + void passObject(object arg); + void passVariadicObject(object... arg); + void passNullableObject(object? arg); + void passVariadicNullableObject(object... arg); + void passOptionalObject(optional object arg); + void passOptionalNullableObject(optional object? arg); + void passOptionalNullableObjectWithDefaultValue(optional object? arg = null); + void passSequenceOfObject(sequence arg); + void passSequenceOfNullableObject(sequence arg); + void passNullableSequenceOfObject(sequence? arg); + void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence?>? arg); + void passMozMapOfObject(MozMap arg); + object receiveObject(); + object? receiveNullableObject(); + + // Union types + void passUnion((object or long) arg); + // Some union tests are debug-only to avoid creating all those + // unused union types in opt builds. +#ifdef DEBUG + void passUnion2((long or boolean) arg); + void passUnion3((object or long or boolean) arg); + void passUnion4((Node or long or boolean) arg); + void passUnion5((object or boolean) arg); + void passUnion6((object or DOMString) arg); + void passUnion7((object or DOMString or long) arg); + void passUnion8((object or DOMString or boolean) arg); + void passUnion9((object or DOMString or long or boolean) arg); + void passUnion10(optional (EventInit or long) arg); + void passUnion11(optional (CustomEventInit or long) arg); + void passUnion12(optional (EventInit or long) arg = 5); + void passUnion13(optional (object or long?) arg = null); + void passUnion14(optional (object or long?) arg = 5); + void passUnion15((sequence or long) arg); + void passUnion16(optional (sequence or long) arg); + void passUnion17(optional (sequence? or long) arg = 5); + void passUnion18((sequence or long) arg); + void passUnion19(optional (sequence or long) arg); + void passUnion20(optional (sequence or long) arg = []); + void passUnion21((MozMap or long) arg); + void passUnion22((MozMap or long) arg); + void passUnion23((sequence or long) arg); + void passUnion24((sequence or long) arg); + void passUnion25((sequence> or long) arg); + void passUnion26((sequence> or long) arg); + void passUnion27(optional (sequence or EventInit) arg); + void passUnion28(optional (EventInit or sequence) arg); + void passUnionWithCallback((EventHandler or long) arg); + void passUnionWithByteString((ByteString or long) arg); + void passUnionWithMozMap((MozMap or DOMString) arg); + void passUnionWithMozMapAndSequence((MozMap or sequence) arg); + void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithUSVS((USVString or long) arg); +#endif + void passUnionWithNullable((object? or long) arg); + void passNullableUnion((object or long)? arg); + void passOptionalUnion(optional (object or long) arg); + void passOptionalNullableUnion(optional (object or long)? arg); + void passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null); + //void passUnionWithInterfaces((TestInterface or TestExternalInterface) arg); + //void passUnionWithInterfacesAndNullable((TestInterface? or TestExternalInterface) arg); + //void passUnionWithSequence((sequence or long) arg); + void passUnionWithArrayBuffer((ArrayBuffer or long) arg); + void passUnionWithString((DOMString or object) arg); + // Using an enum in a union. Note that we use some enum not declared in our + // binding file, because UnionTypes.h will need to include the binding header + // for this enum. Pick an enum from an interface that won't drag in too much + // stuff. + void passUnionWithEnum((SupportedType or object) arg); + + // Trying to use a callback in a union won't include the test + // headers, unfortunately, so won't compile. + //void passUnionWithCallback((TestCallback or long) arg); + void passUnionWithObject((object or long) arg); + //void passUnionWithDict((Dict or long) arg); + + void passUnionWithDefaultValue1(optional (double or DOMString) arg = ""); + void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1); + void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5); + void passUnionWithDefaultValue4(optional (float or DOMString) arg = ""); + void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1); + void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5); + void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = ""); + void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1); + void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5); + void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity); + void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = ""); + void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1); + void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity); + void passUnionWithDefaultValue14(optional (double or ByteString) arg = ""); + void passUnionWithDefaultValue15(optional (double or ByteString) arg = 1); + void passUnionWithDefaultValue16(optional (double or ByteString) arg = 1.5); + void passUnionWithDefaultValue17(optional (double or SupportedType) arg = "text/html"); + void passUnionWithDefaultValue18(optional (double or SupportedType) arg = 1); + void passUnionWithDefaultValue19(optional (double or SupportedType) arg = 1.5); + + void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue13(optional (double or ByteString)? arg = ""); + void passNullableUnionWithDefaultValue14(optional (double or ByteString)? arg = 1); + void passNullableUnionWithDefaultValue15(optional (double or ByteString)? arg = 1.5); + void passNullableUnionWithDefaultValue16(optional (double or ByteString)? arg = null); + void passNullableUnionWithDefaultValue17(optional (double or SupportedType)? arg = "text/html"); + void passNullableUnionWithDefaultValue18(optional (double or SupportedType)? arg = 1); + void passNullableUnionWithDefaultValue19(optional (double or SupportedType)? arg = 1.5); + void passNullableUnionWithDefaultValue20(optional (double or SupportedType)? arg = null); + + void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg); + void passSequenceOfUnions2(sequence<(object or long)> arg); + void passVariadicUnion((CanvasPattern or CanvasGradient)... arg); + + void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg); + void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg); + void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg); + // XXXbz no move constructor on some unions + // void passMozMapOfUnions2(MozMap<(object or long)> arg); + + (CanvasPattern or CanvasGradient) receiveUnion(); + (object or long) receiveUnion2(); + (CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + (CanvasPattern or CanvasGradient)? receiveNullableUnion(); + (object or long)? receiveNullableUnion2(); + + attribute (CanvasPattern or CanvasGradient) writableUnion; + attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + + // Date types + void passDate(Date arg); + void passNullableDate(Date? arg); + void passOptionalDate(optional Date arg); + void passOptionalNullableDate(optional Date? arg); + void passOptionalNullableDateWithDefaultValue(optional Date? arg = null); + void passDateSequence(sequence arg); + void passNullableDateSequence(sequence arg); + void passDateMozMap(MozMap arg); + Date receiveDate(); + Date? receiveNullableDate(); + + // Promise types + void passPromise(Promise arg); + void passNullablePromise(Promise? arg); + void passOptionalPromise(optional Promise arg); + void passOptionalNullablePromise(optional Promise? arg); + void passOptionalNullablePromiseWithDefaultValue(optional Promise? arg = null); + void passPromiseSequence(sequence> arg); + void passNullablePromiseSequence(sequence?> arg); + Promise receivePromise(); + Promise receiveAddrefedPromise(); + + // binaryNames tests + void methodRenamedFrom(); + [BinaryName="otherMethodRenamedTo"] + void otherMethodRenamedFrom(); + void methodRenamedFrom(byte argument); + readonly attribute byte attributeGetterRenamedFrom; + attribute byte attributeRenamedFrom; + [BinaryName="otherAttributeRenamedTo"] + attribute byte otherAttributeRenamedFrom; + + void passDictionary(optional Dict x); + void passDictionary2(Dict x); + [Cached, Pure] + readonly attribute Dict readonlyDictionary; + [Cached, Pure] + readonly attribute Dict? readonlyNullableDictionary; + [Cached, Pure] + attribute Dict writableDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict readonlyFrozenDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict? readonlyFrozenNullableDictionary; + [Cached, Pure, Frozen] + attribute Dict writableFrozenDictionary; + Dict receiveDictionary(); + Dict? receiveNullableDictionary(); + void passOtherDictionary(optional GrandparentDict x); + void passSequenceOfDictionaries(sequence x); + void passMozMapOfDictionaries(MozMap x); + // No support for nullable dictionaries inside a sequence (nor should there be) + // void passSequenceOfNullableDictionaries(sequence x); + void passDictionaryOrLong(optional Dict x); + void passDictionaryOrLong(long x); + + void passDictContainingDict(optional DictContainingDict arg); + void passDictContainingSequence(optional DictContainingSequence arg); + DictContainingSequence receiveDictContainingSequence(); + void passVariadicDictionary(Dict... arg); + + // EnforceRange/Clamp tests + void dontEnforceRangeOrClamp(byte arg); + void doEnforceRange([EnforceRange] byte arg); + void doClamp([Clamp] byte arg); + [EnforceRange] attribute byte enforcedByte; + [Clamp] attribute byte clampedByte; + + // Typedefs + const myLong myLongConstant = 5; + void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg); + AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg); + void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg); + + // Deprecated methods and attributes + [Deprecated="GetAttributeNode"] + attribute byte deprecatedAttribute; + [Deprecated="GetAttributeNode"] + byte deprecatedMethod(); + [Deprecated="GetAttributeNode"] + byte deprecatedMethodWithContext(any arg); + + // Static methods and attributes + static attribute boolean staticAttribute; + static void staticMethod(boolean arg); + static void staticMethodWithContext(any arg); + + // Testing static method with a reserved C++ keyword as the name + static void assert(boolean arg); + + // Deprecated static methods and attributes + [Deprecated="GetAttributeNode"] + static attribute byte staticDeprecatedAttribute; + [Deprecated="GetAttributeNode"] + static void staticDeprecatedMethod(); + [Deprecated="GetAttributeNode"] + static void staticDeprecatedMethodWithContext(any arg); + + // Overload resolution tests + //void overload1(DOMString... strs); + boolean overload1(TestInterface arg); + TestInterface overload1(DOMString strs, TestInterface arg); + void overload2(TestInterface arg); + void overload2(optional Dict arg); + void overload2(boolean arg); + void overload2(DOMString arg); + void overload2(Date arg); + void overload3(TestInterface arg); + void overload3(TestCallback arg); + void overload3(boolean arg); + void overload4(TestInterface arg); + void overload4(TestCallbackInterface arg); + void overload4(DOMString arg); + void overload5(long arg); + void overload5(TestEnum arg); + void overload6(long arg); + void overload6(boolean arg); + void overload7(long arg); + void overload7(boolean arg); + void overload7(ByteString arg); + void overload8(long arg); + void overload8(TestInterface arg); + void overload9(long? arg); + void overload9(DOMString arg); + void overload10(long? arg); + void overload10(object arg); + void overload11(long arg); + void overload11(DOMString? arg); + void overload12(long arg); + void overload12(boolean? arg); + void overload13(long? arg); + void overload13(boolean arg); + void overload14(optional long arg); + void overload14(TestInterface arg); + void overload15(long arg); + void overload15(optional TestInterface arg); + void overload16(long arg); + void overload16(optional TestInterface? arg); + void overload17(sequence arg); + void overload17(MozMap arg); + void overload18(MozMap arg); + void overload18(sequence arg); + void overload19(sequence arg); + void overload19(optional Dict arg); + void overload20(optional Dict arg); + void overload20(sequence arg); + + // Variadic handling + void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3); + + // Conditionally exposed methods/attributes + [Pref="abc.def"] + readonly attribute boolean prefable1; + [Pref="abc.def"] + readonly attribute boolean prefable2; + [Pref="ghi.jkl"] + readonly attribute boolean prefable3; + [Pref="ghi.jkl"] + readonly attribute boolean prefable4; + [Pref="abc.def"] + readonly attribute boolean prefable5; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable6; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable7; + [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable8; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable9; + [Pref="abc.def"] + void prefable10(); + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable11(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable12; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable13(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable14; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable15; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable16; + [Pref="abc.def", Func="TestFuncControlledMember"] + void prefable17(); + [Func="TestFuncControlledMember"] + void prefable18(); + [Func="TestFuncControlledMember"] + void prefable19(); + [Pref="abc.def", Func="TestFuncControlledMember", ChromeOnly] + void prefable20(); + + // Conditionally exposed methods/attributes involving [SecureContext] + [SecureContext] + readonly attribute boolean conditionalOnSecureContext1; + [SecureContext, Pref="abc.def"] + readonly attribute boolean conditionalOnSecureContext2; + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean conditionalOnSecureContext3; + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean conditionalOnSecureContext4; + [SecureContext] + void conditionalOnSecureContext5(); + [SecureContext, Pref="abc.def"] + void conditionalOnSecureContext6(); + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void conditionalOnSecureContext7(); + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + void conditionalOnSecureContext8(); + + // Miscellania + [LenientThis] attribute long attrWithLenientThis; + [Unforgeable] readonly attribute long unforgeableAttr; + [Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2; + [Unforgeable] long unforgeableMethod(); + [Unforgeable, ChromeOnly] long unforgeableMethod2(); + stringifier; + void passRenamedInterface(TestRenamedInterface arg); + [PutForwards=writableByte] readonly attribute TestInterface putForwardsAttr; + [PutForwards=writableByte, LenientThis] readonly attribute TestInterface putForwardsAttr2; + [PutForwards=writableByte, ChromeOnly] readonly attribute TestInterface putForwardsAttr3; + [Throws] void throwingMethod(); + [Throws] attribute boolean throwingAttr; + [GetterThrows] attribute boolean throwingGetterAttr; + [SetterThrows] attribute boolean throwingSetterAttr; + [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod(); + [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr; + [NeedsCallerType] void needsCallerTypeMethod(); + [NeedsCallerType] attribute boolean needsCallerTypeAttr; + legacycaller short(unsigned long arg1, TestInterface arg2); + void passArgsWithDefaults(optional long arg1, + optional TestInterface? arg2 = null, + optional Dict arg3, optional double arg4 = 5.0, + optional float arg5); + + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; + jsonifier; + + attribute byte dashed-attribute; + void dashed-method(); + + // If you add things here, add them to TestExampleGen and TestJSImplGen as well +}; + +interface TestParentInterface { +}; + +interface TestChildInterface : TestParentInterface { +}; + +interface TestNonWrapperCacheInterface { +}; + +[NoInterfaceObject] +interface ImplementedInterfaceParent { + void implementedParentMethod(); + attribute boolean implementedParentProperty; + + const long implementedParentConstant = 8; +}; + +ImplementedInterfaceParent implements IndirectlyImplementedInterface; + +[NoInterfaceObject] +interface IndirectlyImplementedInterface { + void indirectlyImplementedMethod(); + attribute boolean indirectlyImplementedProperty; + + const long indirectlyImplementedConstant = 9; +}; + +[NoInterfaceObject] +interface ImplementedInterface : ImplementedInterfaceParent { + void implementedMethod(); + attribute boolean implementedProperty; + + const long implementedConstant = 5; +}; + +[NoInterfaceObject] +interface DiamondImplements { + readonly attribute long diamondImplementedProperty; +}; +[NoInterfaceObject] +interface DiamondBranch1A { +}; +[NoInterfaceObject] +interface DiamondBranch1B { +}; +[NoInterfaceObject] +interface DiamondBranch2A : DiamondImplements { +}; +[NoInterfaceObject] +interface DiamondBranch2B : DiamondImplements { +}; +TestInterface implements DiamondBranch1A; +TestInterface implements DiamondBranch1B; +TestInterface implements DiamondBranch2A; +TestInterface implements DiamondBranch2B; +DiamondBranch1A implements DiamondImplements; +DiamondBranch1B implements DiamondImplements; + +dictionary Dict : ParentDict { + TestEnum someEnum; + long x; + long a; + long b = 8; + long z = 9; + [EnforceRange] unsigned long enforcedUnsignedLong; + [Clamp] unsigned long clampedUnsignedLong; + DOMString str; + DOMString empty = ""; + TestEnum otherEnum = "b"; + DOMString otherStr = "def"; + DOMString? yetAnotherStr = null; + DOMString template; + ByteString byteStr; + ByteString emptyByteStr = ""; + ByteString otherByteStr = "def"; + object someObj; + boolean prototype; + object? anotherObj = null; + TestCallback? someCallback = null; + any someAny; + any anotherAny = null; + + unrestricted float urFloat = 0; + unrestricted float urFloat2 = 1.1; + unrestricted float urFloat3 = -1.1; + unrestricted float? urFloat4 = null; + unrestricted float infUrFloat = Infinity; + unrestricted float negativeInfUrFloat = -Infinity; + unrestricted float nanUrFloat = NaN; + + unrestricted double urDouble = 0; + unrestricted double urDouble2 = 1.1; + unrestricted double urDouble3 = -1.1; + unrestricted double? urDouble4 = null; + unrestricted double infUrDouble = Infinity; + unrestricted double negativeInfUrDouble = -Infinity; + unrestricted double nanUrDouble = NaN; + + (float or DOMString) floatOrString = "str"; + (float or DOMString)? nullableFloatOrString = "str"; + (object or long) objectOrLong; +#ifdef DEBUG + (EventInit or long) eventInitOrLong; + (EventInit or long)? nullableEventInitOrLong; + (HTMLElement or long)? nullableHTMLElementOrLong; + // CustomEventInit is useful to test because it needs rooting. + (CustomEventInit or long) eventInitOrLong2; + (CustomEventInit or long)? nullableEventInitOrLong2; + (EventInit or long) eventInitOrLongWithDefaultValue = null; + (CustomEventInit or long) eventInitOrLongWithDefaultValue2 = null; + (EventInit or long) eventInitOrLongWithDefaultValue3 = 5; + (CustomEventInit or long) eventInitOrLongWithDefaultValue4 = 5; + (EventInit or long)? nullableEventInitOrLongWithDefaultValue = null; + (CustomEventInit or long)? nullableEventInitOrLongWithDefaultValue2 = null; + (EventInit or long)? nullableEventInitOrLongWithDefaultValue3 = 5; + (CustomEventInit or long)? nullableEventInitOrLongWithDefaultValue4 = 5; + (sequence or long) objectSequenceOrLong; + (sequence or long) objectSequenceOrLongWithDefaultValue1 = 1; + (sequence or long) objectSequenceOrLongWithDefaultValue2 = []; + (sequence or long)? nullableObjectSequenceOrLong; + (sequence or long)? nullableObjectSequenceOrLongWithDefaultValue1 = 1; + (sequence or long)? nullableObjectSequenceOrLongWithDefaultValue2 = []; +#endif + + ArrayBuffer arrayBuffer; + ArrayBuffer? nullableArrayBuffer; + Uint8Array uint8Array; + Float64Array? float64Array = null; + + sequence seq1; + sequence seq2 = []; + sequence? seq3; + sequence? seq4 = null; + sequence? seq5 = []; + + long dashed-name; + + required long requiredLong; + required object requiredObject; + + CustomEventInit customEventInit; + TestDictionaryTypedef dictionaryTypedef; + + Promise promise; + sequence> promiseSequence; +}; + +dictionary ParentDict : GrandparentDict { + long c = 5; + TestInterface someInterface; + TestInterface? someNullableInterface = null; + TestExternalInterface someExternalInterface; + any parentAny; +}; + +dictionary DictContainingDict { + Dict memberDict; +}; + +dictionary DictContainingSequence { + sequence ourSequence; + sequence ourSequence2; + sequence ourSequence3; + sequence ourSequence4; + sequence ourSequence5; + sequence? ourSequence6; + sequence? ourSequence7; + sequence? ourSequence8 = null; + sequence? ourSequence9 = null; + sequence<(float or DOMString)> ourSequence10; +}; + +dictionary DictForConstructor { + Dict dict; + DictContainingDict dict2; + sequence seq1; + sequence>? seq2; + sequence?> seq3; + sequence seq4; + sequence seq5; + sequence seq6; + object obj1; + object? obj2; + any any1 = null; +}; + +dictionary DictWithConditionalMembers { + [ChromeOnly] + long chromeOnlyMember; + [Func="TestFuncControlledMember"] + long funcControlledMember; + [ChromeOnly, Func="nsGenericHTMLElement::TouchEventsEnabled"] + long chromeOnlyFuncControlledMember; +}; + +interface TestIndexedGetterInterface { + getter long item(unsigned long idx); + readonly attribute unsigned long length; + legacycaller void(); +}; + +interface TestNamedGetterInterface { + getter DOMString (DOMString name); +}; + +interface TestIndexedGetterAndSetterAndNamedGetterInterface { + getter DOMString (DOMString myName); + getter long (unsigned long index); + setter creator void (unsigned long index, long arg); +}; + +interface TestIndexedAndNamedGetterInterface { + getter long (unsigned long index); + getter DOMString namedItem(DOMString name); + readonly attribute unsigned long length; +}; + +interface TestIndexedSetterInterface { + setter creator void setItem(unsigned long idx, DOMString item); + getter DOMString (unsigned long idx); +}; + +interface TestNamedSetterInterface { + setter creator void (DOMString myName, TestIndexedSetterInterface item); + getter TestIndexedSetterInterface (DOMString name); +}; + +interface TestIndexedAndNamedSetterInterface { + setter creator void (unsigned long index, TestIndexedSetterInterface item); + getter TestIndexedSetterInterface (unsigned long index); + setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item); + getter TestIndexedSetterInterface (DOMString name); +}; + +interface TestIndexedAndNamedGetterAndSetterInterface : TestIndexedSetterInterface { + getter long item(unsigned long index); + getter DOMString namedItem(DOMString name); + setter creator void (unsigned long index, long item); + setter creator void (DOMString name, DOMString item); + stringifier DOMString (); + readonly attribute unsigned long length; +}; + +interface TestNamedDeleterInterface { + deleter void (DOMString name); + getter long (DOMString name); +}; + +interface TestNamedDeleterWithRetvalInterface { + deleter boolean delNamedItem(DOMString name); + getter long (DOMString name); +}; + +interface TestCppKeywordNamedMethodsInterface { + boolean continue(); + boolean delete(); + long volatile(); +}; + +[Deprecated="GetAttributeNode", Constructor()] +interface TestDeprecatedInterface { + static void alsoDeprecated(); +}; + + +[Constructor(Promise promise)] +interface TestInterfaceWithPromiseConstructorArg { +}; + +namespace TestNamespace { + readonly attribute boolean foo; + long bar(); +}; + +partial namespace TestNamespace { + void baz(); +}; + +[ClassString="RenamedNamespaceClassName"] +namespace TestRenamedNamespace { +}; + +[ProtoObjectHack] +namespace TestProtoObjectHackedNamespace { +}; + +[SecureContext] +interface TestSecureContextInterface { + static void alsoSecureContext(); +}; + +[Exposed=(Window,Worker)] +interface TestWorkerExposedInterface { + [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod(); + [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr; + [NeedsCallerType] void needsCallerTypeMethod(); + [NeedsCallerType] attribute boolean needsCallerTypeAttr; +}; diff --git a/dom/bindings/test/TestDictionary.webidl b/dom/bindings/test/TestDictionary.webidl new file mode 100644 index 000000000..3dd91bd65 --- /dev/null +++ b/dom/bindings/test/TestDictionary.webidl @@ -0,0 +1,9 @@ +/* -*- Mode: IDL; 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/. + */ + +dictionary GrandparentDict { + double someNum; +}; \ No newline at end of file diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl new file mode 100644 index 000000000..ea6387a84 --- /dev/null +++ b/dom/bindings/test/TestExampleGen.webidl @@ -0,0 +1,811 @@ +/* -*- Mode: IDL; 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/. + */ +[Constructor, + Constructor(DOMString str), + Constructor(unsigned long num, boolean? boolArg), + Constructor(TestInterface? iface), + Constructor(long arg1, IndirectlyImplementedInterface iface), + Constructor(Date arg1), + Constructor(ArrayBuffer arrayBuf), + Constructor(Uint8Array typedArr), + // Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3), + NamedConstructor=Example, + NamedConstructor=Example(DOMString str), + NamedConstructor=Example2(DictForConstructor dict, any any1, object obj1, + object? obj2, sequence seq, optional any any2, + optional object obj3, optional object? obj4), + NamedConstructor=Example2((long or MozMap) arg1) + ] +interface TestExampleInterface { + // Integer types + // XXXbz add tests for throwing versions of all the integer stuff + readonly attribute byte readonlyByte; + attribute byte writableByte; + void passByte(byte arg); + byte receiveByte(); + void passOptionalByte(optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); + void passOptionalByteWithDefault(optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); + void passNullableByte(byte? arg); + void passOptionalNullableByte(optional byte? arg); + void passVariadicByte(byte... arg); + [Cached, Pure] + readonly attribute byte cachedByte; + [StoreInSlot, Constant] + readonly attribute byte cachedConstantByte; + [Cached, Pure] + attribute byte cachedWritableByte; + [Affects=Nothing] + attribute byte sideEffectFreeByte; + [Affects=Nothing, DependsOn=DOMState] + attribute byte domDependentByte; + [Affects=Nothing, DependsOn=Nothing] + readonly attribute byte constantByte; + [DependsOn=DeviceState, Affects=Nothing] + readonly attribute byte deviceStateDependentByte; + [Affects=Nothing] + byte returnByteSideEffectFree(); + [Affects=Nothing, DependsOn=DOMState] + byte returnDOMDependentByte(); + [Affects=Nothing, DependsOn=Nothing] + byte returnConstantByte(); + [DependsOn=DeviceState, Affects=Nothing] + byte returnDeviceStateDependentByte(); + + readonly attribute short readonlyShort; + attribute short writableShort; + void passShort(short arg); + short receiveShort(); + void passOptionalShort(optional short arg); + void passOptionalShortWithDefault(optional short arg = 5); + + readonly attribute long readonlyLong; + attribute long writableLong; + void passLong(long arg); + long receiveLong(); + void passOptionalLong(optional long arg); + void passOptionalLongWithDefault(optional long arg = 7); + + readonly attribute long long readonlyLongLong; + attribute long long writableLongLong; + void passLongLong(long long arg); + long long receiveLongLong(); + void passOptionalLongLong(optional long long arg); + void passOptionalLongLongWithDefault(optional long long arg = -12); + + readonly attribute octet readonlyOctet; + attribute octet writableOctet; + void passOctet(octet arg); + octet receiveOctet(); + void passOptionalOctet(optional octet arg); + void passOptionalOctetWithDefault(optional octet arg = 19); + + readonly attribute unsigned short readonlyUnsignedShort; + attribute unsigned short writableUnsignedShort; + void passUnsignedShort(unsigned short arg); + unsigned short receiveUnsignedShort(); + void passOptionalUnsignedShort(optional unsigned short arg); + void passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2); + + readonly attribute unsigned long readonlyUnsignedLong; + attribute unsigned long writableUnsignedLong; + void passUnsignedLong(unsigned long arg); + unsigned long receiveUnsignedLong(); + void passOptionalUnsignedLong(optional unsigned long arg); + void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6); + + readonly attribute unsigned long long readonlyUnsignedLongLong; + attribute unsigned long long writableUnsignedLongLong; + void passUnsignedLongLong(unsigned long long arg); + unsigned long long receiveUnsignedLongLong(); + void passOptionalUnsignedLongLong(optional unsigned long long arg); + void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17); + + attribute float writableFloat; + attribute unrestricted float writableUnrestrictedFloat; + attribute float? writableNullableFloat; + attribute unrestricted float? writableNullableUnrestrictedFloat; + attribute double writableDouble; + attribute unrestricted double writableUnrestrictedDouble; + attribute double? writableNullableDouble; + attribute unrestricted double? writableNullableUnrestrictedDouble; + void passFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, sequence arg10, + sequence arg11, sequence arg12, + sequence arg13, sequence arg14, + sequence arg15, sequence arg16); + [LenientFloat] + void passLenientFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, + sequence arg10, + sequence arg11, + sequence arg12, + sequence arg13, + sequence arg14, + sequence arg15, + sequence arg16); + [LenientFloat] + attribute float lenientFloatAttr; + [LenientFloat] + attribute double lenientDoubleAttr; + + // Castable interface types + // XXXbz add tests for throwing versions of all the castable interface stuff + TestInterface receiveSelf(); + TestInterface? receiveNullableSelf(); + TestInterface receiveWeakSelf(); + TestInterface? receiveWeakNullableSelf(); + void passSelf(TestInterface arg); + void passNullableSelf(TestInterface? arg); + attribute TestInterface nonNullSelf; + attribute TestInterface? nullableSelf; + [Cached, Pure] + readonly attribute TestInterface cachedSelf; + // Optional arguments + void passOptionalSelf(optional TestInterface? arg); + void passOptionalNonNullSelf(optional TestInterface arg); + void passOptionalSelfWithDefault(optional TestInterface? arg = null); + + // Non-wrapper-cache interface types + [NewObject] + TestNonWrapperCacheInterface receiveNonWrapperCacheInterface(); + [NewObject] + TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface(); + [NewObject] + sequence receiveNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence receiveNullableNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence? receiveNonWrapperCacheInterfaceNullableSequence(); + [NewObject] + sequence? receiveNullableNonWrapperCacheInterfaceNullableSequence(); + + // Non-castable interface types + IndirectlyImplementedInterface receiveOther(); + IndirectlyImplementedInterface? receiveNullableOther(); + IndirectlyImplementedInterface receiveWeakOther(); + IndirectlyImplementedInterface? receiveWeakNullableOther(); + void passOther(IndirectlyImplementedInterface arg); + void passNullableOther(IndirectlyImplementedInterface? arg); + attribute IndirectlyImplementedInterface nonNullOther; + attribute IndirectlyImplementedInterface? nullableOther; + // Optional arguments + void passOptionalOther(optional IndirectlyImplementedInterface? arg); + void passOptionalNonNullOther(optional IndirectlyImplementedInterface arg); + void passOptionalOtherWithDefault(optional IndirectlyImplementedInterface? arg = null); + + // External interface types + TestExternalInterface receiveExternal(); + TestExternalInterface? receiveNullableExternal(); + TestExternalInterface receiveWeakExternal(); + TestExternalInterface? receiveWeakNullableExternal(); + void passExternal(TestExternalInterface arg); + void passNullableExternal(TestExternalInterface? arg); + attribute TestExternalInterface nonNullExternal; + attribute TestExternalInterface? nullableExternal; + // Optional arguments + void passOptionalExternal(optional TestExternalInterface? arg); + void passOptionalNonNullExternal(optional TestExternalInterface arg); + void passOptionalExternalWithDefault(optional TestExternalInterface? arg = null); + + // Callback interface types + TestCallbackInterface receiveCallbackInterface(); + TestCallbackInterface? receiveNullableCallbackInterface(); + TestCallbackInterface receiveWeakCallbackInterface(); + TestCallbackInterface? receiveWeakNullableCallbackInterface(); + void passCallbackInterface(TestCallbackInterface arg); + void passNullableCallbackInterface(TestCallbackInterface? arg); + attribute TestCallbackInterface nonNullCallbackInterface; + attribute TestCallbackInterface? nullableCallbackInterface; + // Optional arguments + void passOptionalCallbackInterface(optional TestCallbackInterface? arg); + void passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg); + void passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null); + + // Miscellaneous interface tests + IndirectlyImplementedInterface receiveConsequentialInterface(); + void passConsequentialInterface(IndirectlyImplementedInterface arg); + + // Sequence types + [Cached, Pure] + readonly attribute sequence readonlySequence; + [Cached, Pure] + readonly attribute sequence readonlySequenceOfDictionaries; + [Cached, Pure] + readonly attribute sequence? readonlyNullableSequenceOfDictionaries; + [Cached, Pure, Frozen] + readonly attribute sequence readonlyFrozenSequence; + [Cached, Pure, Frozen] + readonly attribute sequence? readonlyFrozenNullableSequence; + sequence receiveSequence(); + sequence? receiveNullableSequence(); + sequence receiveSequenceOfNullableInts(); + sequence? receiveNullableSequenceOfNullableInts(); + void passSequence(sequence arg); + void passNullableSequence(sequence? arg); + void passSequenceOfNullableInts(sequence arg); + void passOptionalSequenceOfNullableInts(optional sequence arg); + void passOptionalNullableSequenceOfNullableInts(optional sequence? arg); + sequence receiveCastableObjectSequence(); + sequence receiveCallbackObjectSequence(); + sequence receiveNullableCastableObjectSequence(); + sequence receiveNullableCallbackObjectSequence(); + sequence? receiveCastableObjectNullableSequence(); + sequence? receiveNullableCastableObjectNullableSequence(); + sequence receiveWeakCastableObjectSequence(); + sequence receiveWeakNullableCastableObjectSequence(); + sequence? receiveWeakCastableObjectNullableSequence(); + sequence? receiveWeakNullableCastableObjectNullableSequence(); + void passCastableObjectSequence(sequence arg); + void passNullableCastableObjectSequence(sequence arg); + void passCastableObjectNullableSequence(sequence? arg); + void passNullableCastableObjectNullableSequence(sequence? arg); + void passOptionalSequence(optional sequence arg); + void passOptionalSequenceWithDefaultValue(optional sequence arg = []); + void passOptionalNullableSequence(optional sequence? arg); + void passOptionalNullableSequenceWithDefaultValue(optional sequence? arg = null); + void passOptionalNullableSequenceWithDefaultValue2(optional sequence? arg = []); + void passOptionalObjectSequence(optional sequence arg); + void passExternalInterfaceSequence(sequence arg); + void passNullableExternalInterfaceSequence(sequence arg); + + sequence receiveStringSequence(); + void passStringSequence(sequence arg); + + sequence receiveByteStringSequence(); + void passByteStringSequence(sequence arg); + + sequence receiveAnySequence(); + sequence? receiveNullableAnySequence(); + //XXXbz No support for sequence of sequence return values yet. + //sequence> receiveAnySequenceSequence(); + + sequence receiveObjectSequence(); + sequence receiveNullableObjectSequence(); + + void passSequenceOfSequences(sequence> arg); + void passSequenceOfSequencesOfSequences(sequence>> arg); + //XXXbz No support for sequence of sequence return values yet. + //sequence> receiveSequenceOfSequences(); + + // MozMap types + void passMozMap(MozMap arg); + void passNullableMozMap(MozMap? arg); + void passMozMapOfNullableInts(MozMap arg); + void passOptionalMozMapOfNullableInts(optional MozMap arg); + void passOptionalNullableMozMapOfNullableInts(optional MozMap? arg); + void passCastableObjectMozMap(MozMap arg); + void passNullableCastableObjectMozMap(MozMap arg); + void passCastableObjectNullableMozMap(MozMap? arg); + void passNullableCastableObjectNullableMozMap(MozMap? arg); + void passOptionalMozMap(optional MozMap arg); + void passOptionalNullableMozMap(optional MozMap? arg); + void passOptionalNullableMozMapWithDefaultValue(optional MozMap? arg = null); + void passOptionalObjectMozMap(optional MozMap arg); + void passExternalInterfaceMozMap(MozMap arg); + void passNullableExternalInterfaceMozMap(MozMap arg); + void passStringMozMap(MozMap arg); + void passByteStringMozMap(MozMap arg); + void passMozMapOfMozMaps(MozMap> arg); + MozMap receiveMozMap(); + MozMap? receiveNullableMozMap(); + MozMap receiveMozMapOfNullableInts(); + MozMap? receiveNullableMozMapOfNullableInts(); + //XXXbz No support for MozMap of MozMaps return values yet. + //MozMap> receiveMozMapOfMozMaps(); + MozMap receiveAnyMozMap(); + + // Typed array types + void passArrayBuffer(ArrayBuffer arg); + void passNullableArrayBuffer(ArrayBuffer? arg); + void passOptionalArrayBuffer(optional ArrayBuffer arg); + void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg); + void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null); + void passArrayBufferView(ArrayBufferView arg); + void passInt8Array(Int8Array arg); + void passInt16Array(Int16Array arg); + void passInt32Array(Int32Array arg); + void passUint8Array(Uint8Array arg); + void passUint16Array(Uint16Array arg); + void passUint32Array(Uint32Array arg); + void passUint8ClampedArray(Uint8ClampedArray arg); + void passFloat32Array(Float32Array arg); + void passFloat64Array(Float64Array arg); + void passSequenceOfArrayBuffers(sequence arg); + void passSequenceOfNullableArrayBuffers(sequence arg); + void passMozMapOfArrayBuffers(MozMap arg); + void passMozMapOfNullableArrayBuffers(MozMap arg); + void passVariadicTypedArray(Float32Array... arg); + void passVariadicNullableTypedArray(Float32Array?... arg); + Uint8Array receiveUint8Array(); + attribute Uint8Array uint8ArrayAttr; + + // DOMString types + void passString(DOMString arg); + void passNullableString(DOMString? arg); + void passOptionalString(optional DOMString arg); + void passOptionalStringWithDefaultValue(optional DOMString arg = "abc"); + void passOptionalNullableString(optional DOMString? arg); + void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null); + void passVariadicString(DOMString... arg); + + // ByteString types + void passByteString(ByteString arg); + void passNullableByteString(ByteString? arg); + void passOptionalByteString(optional ByteString arg); + void passOptionalByteStringWithDefaultValue(optional ByteString arg = "abc"); + void passOptionalNullableByteString(optional ByteString? arg); + void passOptionalNullableByteStringWithDefaultValue(optional ByteString? arg = null); + void passVariadicByteString(ByteString... arg); + void passUnionByteString((ByteString or long) arg); + void passOptionalUnionByteString(optional (ByteString or long) arg); + void passOptionalUnionByteStringWithDefaultValue(optional (ByteString or long) arg = "abc"); + + // USVString types + void passSVS(USVString arg); + void passNullableSVS(USVString? arg); + void passOptionalSVS(optional USVString arg); + void passOptionalSVSWithDefaultValue(optional USVString arg = "abc"); + void passOptionalNullableSVS(optional USVString? arg); + void passOptionalNullableSVSWithDefaultValue(optional USVString? arg = null); + void passVariadicSVS(USVString... arg); + USVString receiveSVS(); + + // Enumerated types + void passEnum(TestEnum arg); + void passNullableEnum(TestEnum? arg); + void passOptionalEnum(optional TestEnum arg); + void passEnumWithDefault(optional TestEnum arg = "a"); + void passOptionalNullableEnum(optional TestEnum? arg); + void passOptionalNullableEnumWithDefaultValue(optional TestEnum? arg = null); + void passOptionalNullableEnumWithDefaultValue2(optional TestEnum? arg = "a"); + TestEnum receiveEnum(); + TestEnum? receiveNullableEnum(); + attribute TestEnum enumAttribute; + readonly attribute TestEnum readonlyEnumAttribute; + + // Callback types + void passCallback(TestCallback arg); + void passNullableCallback(TestCallback? arg); + void passOptionalCallback(optional TestCallback arg); + void passOptionalNullableCallback(optional TestCallback? arg); + void passOptionalNullableCallbackWithDefaultValue(optional TestCallback? arg = null); + TestCallback receiveCallback(); + TestCallback? receiveNullableCallback(); + void passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg); + void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg); + void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null); + + // Any types + void passAny(any arg); + void passVariadicAny(any... arg); + void passOptionalAny(optional any arg); + void passAnyDefaultNull(optional any arg = null); + void passSequenceOfAny(sequence arg); + void passNullableSequenceOfAny(sequence? arg); + void passOptionalSequenceOfAny(optional sequence arg); + void passOptionalNullableSequenceOfAny(optional sequence? arg); + void passOptionalSequenceOfAnyWithDefaultValue(optional sequence? arg = null); + void passSequenceOfSequenceOfAny(sequence> arg); + void passSequenceOfNullableSequenceOfAny(sequence?> arg); + void passNullableSequenceOfNullableSequenceOfAny(sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence?>? arg); + void passMozMapOfAny(MozMap arg); + void passNullableMozMapOfAny(MozMap? arg); + void passOptionalMozMapOfAny(optional MozMap arg); + void passOptionalNullableMozMapOfAny(optional MozMap? arg); + void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap? arg = null); + void passMozMapOfMozMapOfAny(MozMap> arg); + void passMozMapOfNullableMozMapOfAny(MozMap?> arg); + void passNullableMozMapOfNullableMozMapOfAny(MozMap?>? arg); + void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap?>? arg); + void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap?>? arg); + void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence?>? arg); + any receiveAny(); + + // object types + void passObject(object arg); + void passVariadicObject(object... arg); + void passNullableObject(object? arg); + void passVariadicNullableObject(object... arg); + void passOptionalObject(optional object arg); + void passOptionalNullableObject(optional object? arg); + void passOptionalNullableObjectWithDefaultValue(optional object? arg = null); + void passSequenceOfObject(sequence arg); + void passSequenceOfNullableObject(sequence arg); + void passNullableSequenceOfObject(sequence? arg); + void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence?>? arg); + void passMozMapOfObject(MozMap arg); + object receiveObject(); + object? receiveNullableObject(); + + // Union types + void passUnion((object or long) arg); + // Some union tests are debug-only to avoid creating all those + // unused union types in opt builds. +#ifdef DEBUG + void passUnion2((long or boolean) arg); + void passUnion3((object or long or boolean) arg); + void passUnion4((Node or long or boolean) arg); + void passUnion5((object or boolean) arg); + void passUnion6((object or DOMString) arg); + void passUnion7((object or DOMString or long) arg); + void passUnion8((object or DOMString or boolean) arg); + void passUnion9((object or DOMString or long or boolean) arg); + void passUnion10(optional (EventInit or long) arg); + void passUnion11(optional (CustomEventInit or long) arg); + void passUnion12(optional (EventInit or long) arg = 5); + void passUnion13(optional (object or long?) arg = null); + void passUnion14(optional (object or long?) arg = 5); + void passUnion15((sequence or long) arg); + void passUnion16(optional (sequence or long) arg); + void passUnion17(optional (sequence? or long) arg = 5); + void passUnion18((sequence or long) arg); + void passUnion19(optional (sequence or long) arg); + void passUnion20(optional (sequence or long) arg = []); + void passUnion21((MozMap or long) arg); + void passUnion22((MozMap or long) arg); + void passUnion23((sequence or long) arg); + void passUnion24((sequence or long) arg); + void passUnion25((sequence> or long) arg); + void passUnion26((sequence> or long) arg); + void passUnion27(optional (sequence or EventInit) arg); + void passUnion28(optional (EventInit or sequence) arg); + void passUnionWithCallback((EventHandler or long) arg); + void passUnionWithByteString((ByteString or long) arg); + void passUnionWithMozMap((MozMap or DOMString) arg); + void passUnionWithMozMapAndSequence((MozMap or sequence) arg); + void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithSVS((USVString or long) arg); +#endif + void passUnionWithNullable((object? or long) arg); + void passNullableUnion((object or long)? arg); + void passOptionalUnion(optional (object or long) arg); + void passOptionalNullableUnion(optional (object or long)? arg); + void passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null); + //void passUnionWithInterfaces((TestInterface or TestExternalInterface) arg); + //void passUnionWithInterfacesAndNullable((TestInterface? or TestExternalInterface) arg); + //void passUnionWithSequence((sequence or long) arg); + void passUnionWithArrayBuffer((ArrayBuffer or long) arg); + void passUnionWithString((DOMString or object) arg); + // Using an enum in a union. Note that we use some enum not declared in our + // binding file, because UnionTypes.h will need to include the binding header + // for this enum. Pick an enum from an interface that won't drag in too much + // stuff. + void passUnionWithEnum((SupportedType or object) arg); + + // Trying to use a callback in a union won't include the test + // headers, unfortunately, so won't compile. + // void passUnionWithCallback((TestCallback or long) arg); + void passUnionWithObject((object or long) arg); + //void passUnionWithDict((Dict or long) arg); + + void passUnionWithDefaultValue1(optional (double or DOMString) arg = ""); + void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1); + void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5); + void passUnionWithDefaultValue4(optional (float or DOMString) arg = ""); + void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1); + void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5); + void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = ""); + void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1); + void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5); + void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity); + void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = ""); + void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1); + void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity); + void passUnionWithDefaultValue14(optional (double or ByteString) arg = ""); + void passUnionWithDefaultValue15(optional (double or ByteString) arg = 1); + void passUnionWithDefaultValue16(optional (double or ByteString) arg = 1.5); + void passUnionWithDefaultValue17(optional (double or SupportedType) arg = "text/html"); + void passUnionWithDefaultValue18(optional (double or SupportedType) arg = 1); + void passUnionWithDefaultValue19(optional (double or SupportedType) arg = 1.5); + + void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue13(optional (double or ByteString)? arg = ""); + void passNullableUnionWithDefaultValue14(optional (double or ByteString)? arg = 1); + void passNullableUnionWithDefaultValue15(optional (double or ByteString)? arg = 1.5); + void passNullableUnionWithDefaultValue16(optional (double or ByteString)? arg = null); + void passNullableUnionWithDefaultValue17(optional (double or SupportedType)? arg = "text/html"); + void passNullableUnionWithDefaultValue18(optional (double or SupportedType)? arg = 1); + void passNullableUnionWithDefaultValue19(optional (double or SupportedType)? arg = 1.5); + void passNullableUnionWithDefaultValue20(optional (double or SupportedType)? arg = null); + + void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg); + void passSequenceOfUnions2(sequence<(object or long)> arg); + void passVariadicUnion((CanvasPattern or CanvasGradient)... arg); + + void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg); + void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg); + void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg); + // XXXbz no move constructor on some unions + // void passMozMapOfUnions2(MozMap<(object or long)> arg); + + (CanvasPattern or CanvasGradient) receiveUnion(); + (object or long) receiveUnion2(); + (CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + (CanvasPattern or CanvasGradient)? receiveNullableUnion(); + (object or long)? receiveNullableUnion2(); + + attribute (CanvasPattern or CanvasGradient) writableUnion; + attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + + // Date types + void passDate(Date arg); + void passNullableDate(Date? arg); + void passOptionalDate(optional Date arg); + void passOptionalNullableDate(optional Date? arg); + void passOptionalNullableDateWithDefaultValue(optional Date? arg = null); + void passDateSequence(sequence arg); + void passNullableDateSequence(sequence arg); + void passDateMozMap(MozMap arg); + Date receiveDate(); + Date? receiveNullableDate(); + + // Promise types + void passPromise(Promise arg); + void passNullablePromise(Promise? arg); + void passOptionalPromise(optional Promise arg); + void passOptionalNullablePromise(optional Promise? arg); + void passOptionalNullablePromiseWithDefaultValue(optional Promise? arg = null); + void passPromiseSequence(sequence> arg); + void passNullablePromiseSequence(sequence?> arg); + Promise receivePromise(); + Promise receiveAddrefedPromise(); + + // binaryNames tests + void methodRenamedFrom(); + [BinaryName="otherMethodRenamedTo"] + void otherMethodRenamedFrom(); + void methodRenamedFrom(byte argument); + readonly attribute byte attributeGetterRenamedFrom; + attribute byte attributeRenamedFrom; + [BinaryName="otherAttributeRenamedTo"] + attribute byte otherAttributeRenamedFrom; + + void passDictionary(optional Dict x); + void passDictionary2(Dict x); + [Cached, Pure] + readonly attribute Dict readonlyDictionary; + [Cached, Pure] + readonly attribute Dict? readonlyNullableDictionary; + [Cached, Pure] + attribute Dict writableDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict readonlyFrozenDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict? readonlyFrozenNullableDictionary; + [Cached, Pure, Frozen] + attribute Dict writableFrozenDictionary; + Dict receiveDictionary(); + Dict? receiveNullableDictionary(); + void passOtherDictionary(optional GrandparentDict x); + void passSequenceOfDictionaries(sequence x); + void passMozMapOfDictionaries(MozMap x); + // No support for nullable dictionaries inside a sequence (nor should there be) + // void passSequenceOfNullableDictionaries(sequence x); + void passDictionaryOrLong(optional Dict x); + void passDictionaryOrLong(long x); + + void passDictContainingDict(optional DictContainingDict arg); + void passDictContainingSequence(optional DictContainingSequence arg); + DictContainingSequence receiveDictContainingSequence(); + void passVariadicDictionary(Dict... arg); + + // EnforceRange/Clamp tests + void dontEnforceRangeOrClamp(byte arg); + void doEnforceRange([EnforceRange] byte arg); + void doClamp([Clamp] byte arg); + [EnforceRange] attribute byte enforcedByte; + [Clamp] attribute byte clampedByte; + + // Typedefs + const myLong myLongConstant = 5; + void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg); + AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg); + void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg); + + // Deprecated methods and attributes + [Deprecated="GetAttributeNode"] + attribute boolean deprecatedAttribute; + [Deprecated="GetAttributeNode"] + void deprecatedMethod(boolean arg); + [Deprecated="GetAttributeNode"] + void deprecatedMethodWithContext(any arg); + + // Static methods and attributes + static attribute boolean staticAttribute; + static void staticMethod(boolean arg); + static void staticMethodWithContext(any arg); + + // Deprecated methods and attributes; + [Deprecated="GetAttributeNode"] + static attribute boolean staticDeprecatedAttribute; + [Deprecated="GetAttributeNode"] + static void staticDeprecatedMethod(boolean arg); + [Deprecated="GetAttributeNode"] + static void staticDeprecatedMethodWithContext(any arg); + + // Overload resolution tests + //void overload1(DOMString... strs); + boolean overload1(TestInterface arg); + TestInterface overload1(DOMString strs, TestInterface arg); + void overload2(TestInterface arg); + void overload2(optional Dict arg); + void overload2(boolean arg); + void overload2(DOMString arg); + void overload2(Date arg); + void overload3(TestInterface arg); + void overload3(TestCallback arg); + void overload3(boolean arg); + void overload4(TestInterface arg); + void overload4(TestCallbackInterface arg); + void overload4(DOMString arg); + void overload5(long arg); + void overload5(TestEnum arg); + void overload6(long arg); + void overload6(boolean arg); + void overload7(long arg); + void overload7(boolean arg); + void overload7(ByteString arg); + void overload8(long arg); + void overload8(TestInterface arg); + void overload9(long? arg); + void overload9(DOMString arg); + void overload10(long? arg); + void overload10(object arg); + void overload11(long arg); + void overload11(DOMString? arg); + void overload12(long arg); + void overload12(boolean? arg); + void overload13(long? arg); + void overload13(boolean arg); + void overload14(optional long arg); + void overload14(TestInterface arg); + void overload15(long arg); + void overload15(optional TestInterface arg); + void overload16(long arg); + void overload16(optional TestInterface? arg); + void overload17(sequence arg); + void overload17(MozMap arg); + void overload18(MozMap arg); + void overload18(sequence arg); + void overload19(sequence arg); + void overload19(optional Dict arg); + void overload20(optional Dict arg); + void overload20(sequence arg); + + // Variadic handling + void passVariadicThirdArg(DOMString arg1, long arg2, TestInterface... arg3); + + // Conditionally exposed methods/attributes + [Pref="abc.def"] + readonly attribute boolean prefable1; + [Pref="abc.def"] + readonly attribute boolean prefable2; + [Pref="ghi.jkl"] + readonly attribute boolean prefable3; + [Pref="ghi.jkl"] + readonly attribute boolean prefable4; + [Pref="abc.def"] + readonly attribute boolean prefable5; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable6; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable7; + [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable8; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable9; + [Pref="abc.def"] + void prefable10(); + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable11(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable12; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable13(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable14; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable15; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable16; + [Pref="abc.def", Func="TestFuncControlledMember"] + void prefable17(); + [Func="TestFuncControlledMember"] + void prefable18(); + [Func="TestFuncControlledMember"] + void prefable19(); + + // Conditionally exposed methods/attributes involving [SecureContext] + [SecureContext] + readonly attribute boolean conditionalOnSecureContext1; + [SecureContext, Pref="abc.def"] + readonly attribute boolean conditionalOnSecureContext2; + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean conditionalOnSecureContext3; + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean conditionalOnSecureContext4; + [SecureContext] + void conditionalOnSecureContext5(); + [SecureContext, Pref="abc.def"] + void conditionalOnSecureContext6(); + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void conditionalOnSecureContext7(); + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + void conditionalOnSecureContext8(); + + // Miscellania + [LenientThis] attribute long attrWithLenientThis; + [Unforgeable] readonly attribute long unforgeableAttr; + [Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2; + [Unforgeable] long unforgeableMethod(); + [Unforgeable, ChromeOnly] long unforgeableMethod2(); + stringifier; + void passRenamedInterface(TestRenamedInterface arg); + [PutForwards=writableByte] readonly attribute TestExampleInterface putForwardsAttr; + [PutForwards=writableByte, LenientThis] readonly attribute TestExampleInterface putForwardsAttr2; + [PutForwards=writableByte, ChromeOnly] readonly attribute TestExampleInterface putForwardsAttr3; + [Throws] void throwingMethod(); + [Throws] attribute boolean throwingAttr; + [GetterThrows] attribute boolean throwingGetterAttr; + [SetterThrows] attribute boolean throwingSetterAttr; + [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod(); + [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr; + [NeedsCallerType] void needsCallerTypeMethod(); + [NeedsCallerType] attribute boolean needsCallerTypeAttr; + legacycaller short(unsigned long arg1, TestInterface arg2); + void passArgsWithDefaults(optional long arg1, + optional TestInterface? arg2 = null, + optional Dict arg3, optional double arg4 = 5.0, + optional float arg5); + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; + jsonifier; + + attribute byte dashed-attribute; + void dashed-method(); + + // If you add things here, add them to TestCodeGen and TestJSImplGen as well +}; + +interface TestExampleProxyInterface { + getter long longIndexedGetter(unsigned long ix); + setter creator void longIndexedSetter(unsigned long y, long z); + stringifier DOMString myStringifier(); + getter short shortNameGetter(DOMString nom); + deleter void (DOMString nomnom); + setter creator void shortNamedSetter(DOMString me, short value); +}; + +[Exposed=(Window,Worker)] +interface TestExampleWorkerInterface { + [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod(); + [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr; + [NeedsCallerType] void needsCallerTypeMethod(); + [NeedsCallerType] attribute boolean needsCallerTypeAttr; +}; diff --git a/dom/bindings/test/TestFunctions.cpp b/dom/bindings/test/TestFunctions.cpp new file mode 100644 index 000000000..f05c92b48 --- /dev/null +++ b/dom/bindings/test/TestFunctions.cpp @@ -0,0 +1,94 @@ +/* -*- 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/. */ + +#include "mozilla/dom/TestFunctions.h" +#include "mozilla/dom/TestFunctionsBinding.h" +#include "nsStringBuffer.h" + +namespace mozilla { +namespace dom { + +/* static */ TestFunctions* +TestFunctions::Constructor(GlobalObject& aGlobal, ErrorResult& aRv) +{ + return new TestFunctions; +} + +/* static */ void +TestFunctions::ThrowUncatchableException(GlobalObject& aGlobal, + ErrorResult& aRv) +{ + aRv.ThrowUncatchableException(); +} + +/* static */ Promise* +TestFunctions::PassThroughPromise(GlobalObject& aGlobal, Promise& aPromise) +{ + return &aPromise; +} + +/* static */ already_AddRefed +TestFunctions::PassThroughCallbackPromise(GlobalObject& aGlobal, + PromiseReturner& aCallback, + ErrorResult& aRv) +{ + return aCallback.Call(aRv); +} + +void +TestFunctions::SetStringData(const nsAString& aString) +{ + mStringData = aString; +} + +void +TestFunctions::GetStringDataAsAString(nsAString& aString) +{ + aString = mStringData; +} + +void +TestFunctions::GetStringDataAsAString(uint32_t aLength, nsAString& aString) +{ + MOZ_RELEASE_ASSERT(aLength <= mStringData.Length(), + "Bogus test passing in a too-big length"); + aString.Assign(mStringData.BeginReading(), aLength); +} + +void +TestFunctions::GetStringDataAsDOMString(const Optional& aLength, + DOMString& aString) +{ + uint32_t length; + if (aLength.WasPassed()) { + length = aLength.Value(); + MOZ_RELEASE_ASSERT(length <= mStringData.Length(), + "Bogus test passing in a too-big length"); + } else { + length = mStringData.Length(); + } + + nsStringBuffer* buf = nsStringBuffer::FromString(mStringData); + if (buf) { + aString.SetStringBuffer(buf, length); + return; + } + + // We better have an empty mStringData; otherwise why did we not have a string + // buffer? + MOZ_RELEASE_ASSERT(length == 0, "Why no stringbuffer?"); + // No need to do anything here; aString is already empty. +} + +bool +TestFunctions::WrapObject(JSContext* aCx, JS::Handle aGivenProto, + JS::MutableHandle aWrapper) +{ + return TestFunctionsBinding::Wrap(aCx, this, aGivenProto, aWrapper); +} + +} +} diff --git a/dom/bindings/test/TestFunctions.h b/dom/bindings/test/TestFunctions.h new file mode 100644 index 000000000..b35464824 --- /dev/null +++ b/dom/bindings/test/TestFunctions.h @@ -0,0 +1,52 @@ +/* -*- 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 mozilla_dom_TestFunctions_h +#define mozilla_dom_TestFunctions_h + +#include "mozilla/ErrorResult.h" +#include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/NonRefcountedDOMObject.h" +#include "nsString.h" + +namespace mozilla { +namespace dom { + +class Promise; +class PromiseReturner; + +class TestFunctions : public NonRefcountedDOMObject { +public: + static TestFunctions* Constructor(GlobalObject& aGlobal, ErrorResult& aRv); + + static void + ThrowUncatchableException(GlobalObject& aGlobal, ErrorResult& aRv); + + static Promise* + PassThroughPromise(GlobalObject& aGlobal, Promise& aPromise); + + static already_AddRefed + PassThroughCallbackPromise(GlobalObject& aGlobal, + PromiseReturner& aCallback, + ErrorResult& aRv); + + void SetStringData(const nsAString& aString); + + void GetStringDataAsAString(nsAString& aString); + void GetStringDataAsAString(uint32_t aLength, nsAString& aString); + void GetStringDataAsDOMString(const Optional& aLength, + DOMString& aString); + + bool WrapObject(JSContext* aCx, JS::Handle aGivenProto, + JS::MutableHandle aWrapper); +private: + nsString mStringData; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestFunctions_h diff --git a/dom/bindings/test/TestInterfaceIterableDouble.cpp b/dom/bindings/test/TestInterfaceIterableDouble.cpp new file mode 100644 index 000000000..33a4c97d1 --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableDouble.cpp @@ -0,0 +1,82 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceIterableDouble.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceIterableDouble, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceIterableDouble) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceIterableDouble) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceIterableDouble) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceIterableDouble::TestInterfaceIterableDouble(nsPIDOMWindowInner* aParent) + : mParent(aParent) +{ + mValues.AppendElement(std::pair(NS_LITERAL_STRING("a"), + NS_LITERAL_STRING("b"))); + mValues.AppendElement(std::pair(NS_LITERAL_STRING("c"), + NS_LITERAL_STRING("d"))); + mValues.AppendElement(std::pair(NS_LITERAL_STRING("e"), + NS_LITERAL_STRING("f"))); +} + +//static +already_AddRefed +TestInterfaceIterableDouble::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceIterableDouble(window); + return r.forget(); +} + +JSObject* +TestInterfaceIterableDouble::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return TestInterfaceIterableDoubleBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceIterableDouble::GetParentObject() const +{ + return mParent; +} + +size_t +TestInterfaceIterableDouble::GetIterableLength() +{ + return mValues.Length(); +} + +nsAString& +TestInterfaceIterableDouble::GetKeyAtIndex(uint32_t aIndex) +{ + MOZ_ASSERT(aIndex < mValues.Length()); + return mValues.ElementAt(aIndex).first; +} + +nsAString& +TestInterfaceIterableDouble::GetValueAtIndex(uint32_t aIndex) +{ + MOZ_ASSERT(aIndex < mValues.Length()); + return mValues.ElementAt(aIndex).second; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceIterableDouble.h b/dom/bindings/test/TestInterfaceIterableDouble.h new file mode 100644 index 000000000..1e9ff7acd --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableDouble.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceIterableDouble_h +#define mozilla_dom_TestInterfaceIterableDouble_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl iterable interfaces, using +// primitives for value type +class TestInterfaceIterableDouble final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceIterableDouble) + + explicit TestInterfaceIterableDouble(nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); + + size_t GetIterableLength(); + nsAString& GetKeyAtIndex(uint32_t aIndex); + nsAString& GetValueAtIndex(uint32_t aIndex); +private: + virtual ~TestInterfaceIterableDouble() {} + nsCOMPtr mParent; + nsTArray> mValues; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceIterableDouble_h diff --git a/dom/bindings/test/TestInterfaceIterableDoubleUnion.cpp b/dom/bindings/test/TestInterfaceIterableDoubleUnion.cpp new file mode 100644 index 000000000..29151a4c5 --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableDoubleUnion.cpp @@ -0,0 +1,83 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceIterableDoubleUnion.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceIterableDoubleUnion, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceIterableDoubleUnion) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceIterableDoubleUnion) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceIterableDoubleUnion) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceIterableDoubleUnion::TestInterfaceIterableDoubleUnion(nsPIDOMWindowInner* aParent) + : mParent(aParent) +{ + OwningStringOrLong a; + a.SetAsLong() = 1; + mValues.AppendElement(std::pair(NS_LITERAL_STRING("long"), + a)); + a.SetAsString() = NS_LITERAL_STRING("a"); + mValues.AppendElement(std::pair(NS_LITERAL_STRING("string"), + a)); +} + +//static +already_AddRefed +TestInterfaceIterableDoubleUnion::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceIterableDoubleUnion(window); + return r.forget(); +} + +JSObject* +TestInterfaceIterableDoubleUnion::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return TestInterfaceIterableDoubleUnionBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceIterableDoubleUnion::GetParentObject() const +{ + return mParent; +} + +size_t +TestInterfaceIterableDoubleUnion::GetIterableLength() +{ + return mValues.Length(); +} + +nsAString& +TestInterfaceIterableDoubleUnion::GetKeyAtIndex(uint32_t aIndex) +{ + MOZ_ASSERT(aIndex < mValues.Length()); + return mValues.ElementAt(aIndex).first; +} + +OwningStringOrLong& +TestInterfaceIterableDoubleUnion::GetValueAtIndex(uint32_t aIndex) +{ + MOZ_ASSERT(aIndex < mValues.Length()); + return mValues.ElementAt(aIndex).second; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceIterableDoubleUnion.h b/dom/bindings/test/TestInterfaceIterableDoubleUnion.h new file mode 100644 index 000000000..ff6ea2175 --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableDoubleUnion.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceIterableDoubleUnion_h +#define mozilla_dom_TestInterfaceIterableDoubleUnion_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl iterable interfaces, using +// primitives for value type +class TestInterfaceIterableDoubleUnion final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceIterableDoubleUnion) + + explicit TestInterfaceIterableDoubleUnion(nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); + + size_t GetIterableLength(); + nsAString& GetKeyAtIndex(uint32_t aIndex); + OwningStringOrLong& GetValueAtIndex(uint32_t aIndex); +private: + virtual ~TestInterfaceIterableDoubleUnion() {} + nsCOMPtr mParent; + nsTArray> mValues; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceIterableDoubleUnion_h diff --git a/dom/bindings/test/TestInterfaceIterableSingle.cpp b/dom/bindings/test/TestInterfaceIterableSingle.cpp new file mode 100644 index 000000000..5f8d6c640 --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableSingle.cpp @@ -0,0 +1,77 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceIterableSingle.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceIterableSingle, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceIterableSingle) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceIterableSingle) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceIterableSingle) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceIterableSingle::TestInterfaceIterableSingle(nsPIDOMWindowInner* aParent) + : mParent(aParent) +{ + for (int i = 0; i < 3; ++i) { + mValues.AppendElement(i); + } +} + +//static +already_AddRefed +TestInterfaceIterableSingle::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceIterableSingle(window); + return r.forget(); +} + +JSObject* +TestInterfaceIterableSingle::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return TestInterfaceIterableSingleBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceIterableSingle::GetParentObject() const +{ + return mParent; +} + +uint32_t +TestInterfaceIterableSingle::Length() const +{ + return mValues.Length(); +} + +int32_t +TestInterfaceIterableSingle::IndexedGetter(uint32_t aIndex, bool& aFound) const +{ + if (aIndex >= mValues.Length()) { + aFound = false; + return 0; + } + + aFound = true; + return mValues[aIndex]; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceIterableSingle.h b/dom/bindings/test/TestInterfaceIterableSingle.h new file mode 100644 index 000000000..a071ada8b --- /dev/null +++ b/dom/bindings/test/TestInterfaceIterableSingle.h @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceIterableSingle_h +#define mozilla_dom_TestInterfaceIterableSingle_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl iterable interfaces, using +// primitives for value type +class TestInterfaceIterableSingle final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceIterableSingle) + + explicit TestInterfaceIterableSingle(nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); + + uint32_t Length() const; + int32_t IndexedGetter(uint32_t aIndex, bool& aFound) const; + +private: + virtual ~TestInterfaceIterableSingle() {} + nsCOMPtr mParent; + nsTArray mValues; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceIterableSingle_h diff --git a/dom/bindings/test/TestInterfaceJS.js b/dom/bindings/test/TestInterfaceJS.js new file mode 100644 index 000000000..1a5bf8e61 --- /dev/null +++ b/dom/bindings/test/TestInterfaceJS.js @@ -0,0 +1,166 @@ +/* -*- Mode: JavaScript; 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/. */ + +"use strict"; +const Cu = Components.utils; +const Ci = Components.interfaces; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +function TestInterfaceJS(anyArg, objectArg) {} + +TestInterfaceJS.prototype = { + classID: Components.ID("{2ac4e026-cf25-47d5-b067-78d553c3cad8}"), + contractID: "@mozilla.org/dom/test-interface-js;1", + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, + Ci.nsIDOMGlobalPropertyInitializer]), + + init: function(win) { this._win = win; }, + + __init: function (anyArg, objectArg, dictionaryArg) { + this._anyAttr = undefined; + this._objectAttr = null; + this._anyArg = anyArg; + this._objectArg = objectArg; + this._dictionaryArg = dictionaryArg; + this._cachedAttr = 15; + }, + + get anyArg() { return this._anyArg; }, + get objectArg() { return this._objectArg; }, + get dictionaryArg() { return this._dictionaryArg; }, + get anyAttr() { return this._anyAttr; }, + set anyAttr(val) { this._anyAttr = val; }, + get objectAttr() { return this._objectAttr; }, + set objectAttr(val) { this._objectAttr = val; }, + get dictionaryAttr() { return this._dictionaryAttr; }, + set dictionaryAttr(val) { this._dictionaryAttr = val; }, + pingPongAny: function(any) { return any; }, + pingPongObject: function(obj) { return obj; }, + pingPongObjectOrString: function(objectOrString) { return objectOrString; }, + pingPongDictionary: function(dict) { return dict; }, + pingPongDictionaryOrLong: function(dictOrLong) { return dictOrLong.anyMember || dictOrLong; }, + pingPongMap: function(map) { return JSON.stringify(map); }, + objectSequenceLength: function(seq) { return seq.length; }, + anySequenceLength: function(seq) { return seq.length; }, + + + getCallerPrincipal: function() { return Cu.getWebIDLCallerPrincipal().origin; }, + + convertSVS: function(svs) { return svs; }, + + pingPongUnion: function(x) { return x; }, + pingPongUnionContainingNull: function(x) { return x; }, + pingPongNullableUnion: function(x) { return x; }, + returnBadUnion: function(x) { return 3; }, + + get cachedAttr() { return this._cachedAttr; }, + setCachedAttr: function(n) { this._cachedAttr = n; }, + clearCachedAttrCache: function () { this.__DOM_IMPL__._clearCachedCachedAttrValue(); }, + + testSequenceOverload: function(arg) {}, + testSequenceUnion: function(arg) {}, + + testThrowError: function() { + throw new this._win.Error("We are an Error"); + }, + + testThrowDOMException: function() { + throw new this._win.DOMException("We are a DOMException", + "NotSupportedError"); + }, + + testThrowTypeError: function() { + throw new this._win.TypeError("We are a TypeError"); + }, + + testThrowCallbackError: function(callback) { + callback(); + }, + + testThrowXraySelfHosted: function() { + this._win.Array.indexOf(); + }, + + testThrowSelfHosted: function() { + Array.indexOf(); + }, + + testPromiseWithThrowingChromePromiseInit: function() { + return new this._win.Promise(function() { + noSuchMethodExistsYo1(); + }) + }, + + testPromiseWithThrowingContentPromiseInit: function(func) { + return new this._win.Promise(func); + }, + + testPromiseWithDOMExceptionThrowingPromiseInit: function() { + return new this._win.Promise(() => { + throw new this._win.DOMException("We are a second DOMException", + "NotFoundError"); + }) + }, + + testPromiseWithThrowingChromeThenFunction: function() { + return this._win.Promise.resolve(5).then(function() { + noSuchMethodExistsYo2(); + }); + }, + + testPromiseWithThrowingContentThenFunction: function(func) { + return this._win.Promise.resolve(10).then(func); + }, + + testPromiseWithDOMExceptionThrowingThenFunction: function() { + return this._win.Promise.resolve(5).then(() => { + throw new this._win.DOMException("We are a third DOMException", + "NetworkError"); + }); + }, + + testPromiseWithThrowingChromeThenable: function() { + var thenable = { + then: function() { + noSuchMethodExistsYo3() + } + }; + return new this._win.Promise(function(resolve) { + resolve(thenable) + }); + }, + + testPromiseWithThrowingContentThenable: function(thenable) { + // Waive Xrays on the thenable, because we're calling resolve() in the + // chrome compartment, so that's the compartment the "then" property get + // will happen in, and if we leave the Xray in place the function-valued + // property won't return the function. + return this._win.Promise.resolve(Cu.waiveXrays(thenable)); + }, + + testPromiseWithDOMExceptionThrowingThenable: function() { + var thenable = { + then: () => { + throw new this._win.DOMException("We are a fourth DOMException", + "TypeMismatchError"); + } + }; + return new this._win.Promise(function(resolve) { + resolve(thenable) + }); + }, + + get onsomething() { + return this.__DOM_IMPL__.getEventHandler("onsomething"); + }, + + set onsomething(val) { + this.__DOM_IMPL__.setEventHandler("onsomething", val); + } +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestInterfaceJS]) diff --git a/dom/bindings/test/TestInterfaceJS.manifest b/dom/bindings/test/TestInterfaceJS.manifest new file mode 100644 index 000000000..161a42156 --- /dev/null +++ b/dom/bindings/test/TestInterfaceJS.manifest @@ -0,0 +1,4 @@ +component {2ac4e026-cf25-47d5-b067-78d553c3cad8} TestInterfaceJS.js +contract @mozilla.org/dom/test-interface-js;1 {2ac4e026-cf25-47d5-b067-78d553c3cad8} +component {4bc6f6f3-e005-4f0a-b42d-4d1663a9013a} TestInterfaceJSMaplike.js +contract @mozilla.org/dom/test-interface-js-maplike;1 {4bc6f6f3-e005-4f0a-b42d-4d1663a9013a} diff --git a/dom/bindings/test/TestInterfaceJSMaplike.js b/dom/bindings/test/TestInterfaceJSMaplike.js new file mode 100644 index 000000000..b108ef5b6 --- /dev/null +++ b/dom/bindings/test/TestInterfaceJSMaplike.js @@ -0,0 +1,38 @@ +/* -*- Mode: JavaScript; 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/. */ + +"use strict"; +const Cu = Components.utils; +const Ci = Components.interfaces; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); + +function TestInterfaceJSMaplike() {} + +TestInterfaceJSMaplike.prototype = { + classID: Components.ID("{4bc6f6f3-e005-4f0a-b42d-4d1663a9013a}"), + contractID: "@mozilla.org/dom/test-interface-js-maplike;1", + QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, + Ci.nsIDOMGlobalPropertyInitializer]), + + init: function(win) { this._win = win; }, + + __init: function () {}, + + setInternal: function(aKey, aValue) { + return this.__DOM_IMPL__.__set(aKey, aValue); + }, + + deleteInternal: function(aKey) { + return this.__DOM_IMPL__.__delete(aKey); + }, + + clearInternal: function() { + return this.__DOM_IMPL__.__clear(); + } +}; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestInterfaceJSMaplike]) diff --git a/dom/bindings/test/TestInterfaceMaplike.cpp b/dom/bindings/test/TestInterfaceMaplike.cpp new file mode 100644 index 000000000..4abace83c --- /dev/null +++ b/dom/bindings/test/TestInterfaceMaplike.cpp @@ -0,0 +1,84 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceMaplike.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceMaplike, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceMaplike) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceMaplike) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceMaplike) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceMaplike::TestInterfaceMaplike(nsPIDOMWindowInner* aParent) +: mParent(aParent) +{ +} + +//static +already_AddRefed +TestInterfaceMaplike::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceMaplike(window); + return r.forget(); +} + +JSObject* +TestInterfaceMaplike::WrapObject(JSContext* aCx, JS::Handle aGivenProto) +{ + return TestInterfaceMaplikeBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceMaplike::GetParentObject() const +{ + return mParent; +} + +void +TestInterfaceMaplike::SetInternal(const nsAString& aKey, int32_t aValue) +{ + ErrorResult rv; + TestInterfaceMaplikeBinding::MaplikeHelpers::Set(this, aKey, aValue, rv); +} + +void +TestInterfaceMaplike::ClearInternal() +{ + ErrorResult rv; + TestInterfaceMaplikeBinding::MaplikeHelpers::Clear(this, rv); +} + +bool +TestInterfaceMaplike::DeleteInternal(const nsAString& aKey) +{ + ErrorResult rv; + return TestInterfaceMaplikeBinding::MaplikeHelpers::Delete(this, aKey, rv); +} + +bool +TestInterfaceMaplike::HasInternal(const nsAString& aKey) +{ + ErrorResult rv; + return TestInterfaceMaplikeBinding::MaplikeHelpers::Has(this, aKey, rv); +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceMaplike.h b/dom/bindings/test/TestInterfaceMaplike.h new file mode 100644 index 000000000..c012a7a21 --- /dev/null +++ b/dom/bindings/test/TestInterfaceMaplike.h @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceMaplike_h +#define mozilla_dom_TestInterfaceMaplike_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl maplike interfaces, using +// primitives for key and value types. +class TestInterfaceMaplike final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceMaplike) + + explicit TestInterfaceMaplike(nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); + + // External access for testing internal convenience functions. + void SetInternal(const nsAString& aKey, int32_t aValue); + void ClearInternal(); + bool DeleteInternal(const nsAString& aKey); + bool HasInternal(const nsAString& aKey); +private: + virtual ~TestInterfaceMaplike() {} + nsCOMPtr mParent; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceMaplike_h diff --git a/dom/bindings/test/TestInterfaceMaplikeObject.cpp b/dom/bindings/test/TestInterfaceMaplikeObject.cpp new file mode 100644 index 000000000..3dc1ffdc4 --- /dev/null +++ b/dom/bindings/test/TestInterfaceMaplikeObject.cpp @@ -0,0 +1,88 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceMaplikeObject.h" +#include "mozilla/dom/TestInterfaceMaplike.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceMaplikeObject, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceMaplikeObject) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceMaplikeObject) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceMaplikeObject) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceMaplikeObject::TestInterfaceMaplikeObject(nsPIDOMWindowInner* aParent) +: mParent(aParent) +{ +} + +//static +already_AddRefed +TestInterfaceMaplikeObject::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = + new TestInterfaceMaplikeObject(window); + return r.forget(); +} + +JSObject* +TestInterfaceMaplikeObject::WrapObject(JSContext* aCx, + JS::Handle aGivenProto) +{ + return TestInterfaceMaplikeObjectBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceMaplikeObject::GetParentObject() const +{ + return mParent; +} + +void +TestInterfaceMaplikeObject::SetInternal(const nsAString& aKey) +{ + RefPtr p(new TestInterfaceMaplike(mParent)); + ErrorResult rv; + TestInterfaceMaplikeObjectBinding::MaplikeHelpers::Set(this, aKey, *p, rv); +} + +void +TestInterfaceMaplikeObject::ClearInternal() +{ + ErrorResult rv; + TestInterfaceMaplikeObjectBinding::MaplikeHelpers::Clear(this, rv); +} + +bool +TestInterfaceMaplikeObject::DeleteInternal(const nsAString& aKey) +{ + ErrorResult rv; + return TestInterfaceMaplikeObjectBinding::MaplikeHelpers::Delete(this, aKey, rv); +} + +bool +TestInterfaceMaplikeObject::HasInternal(const nsAString& aKey) +{ + ErrorResult rv; + return TestInterfaceMaplikeObjectBinding::MaplikeHelpers::Has(this, aKey, rv); +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceMaplikeObject.h b/dom/bindings/test/TestInterfaceMaplikeObject.h new file mode 100644 index 000000000..af4660c0d --- /dev/null +++ b/dom/bindings/test/TestInterfaceMaplikeObject.h @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceMaplikeObject_h +#define mozilla_dom_TestInterfaceMaplikeObject_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl maplike interfaces, using +// primitives for key types and objects for value types. +class TestInterfaceMaplikeObject final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceMaplikeObject) + + explicit TestInterfaceMaplikeObject(nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal,ErrorResult& rv); + + // External access for testing internal convenience functions. + void SetInternal(const nsAString& aKey); + void ClearInternal(); + bool DeleteInternal(const nsAString& aKey); + bool HasInternal(const nsAString& aKey); +private: + virtual ~TestInterfaceMaplikeObject() {} + nsCOMPtr mParent; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceMaplikeObject_h diff --git a/dom/bindings/test/TestInterfaceSetlike.cpp b/dom/bindings/test/TestInterfaceSetlike.cpp new file mode 100644 index 000000000..c9f556076 --- /dev/null +++ b/dom/bindings/test/TestInterfaceSetlike.cpp @@ -0,0 +1,58 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceSetlike.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceSetlike, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceSetlike) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceSetlike) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceSetlike) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceSetlike::TestInterfaceSetlike(JSContext* aCx, + nsPIDOMWindowInner* aParent) +: mParent(aParent) +{ +} + +//static +already_AddRefed +TestInterfaceSetlike::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceSetlike(nullptr, window); + return r.forget(); +} + +JSObject* +TestInterfaceSetlike::WrapObject(JSContext* aCx, + JS::Handle aGivenProto) +{ + return TestInterfaceSetlikeBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceSetlike::GetParentObject() const +{ + return mParent; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceSetlike.h b/dom/bindings/test/TestInterfaceSetlike.h new file mode 100644 index 000000000..c9f464960 --- /dev/null +++ b/dom/bindings/test/TestInterfaceSetlike.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceSetlike_h +#define mozilla_dom_TestInterfaceSetlike_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl setlike interfaces, using +// primitives for key type. +class TestInterfaceSetlike final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceSetlike) + explicit TestInterfaceSetlike(JSContext* aCx, + nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); +private: + virtual ~TestInterfaceSetlike() {} + nsCOMPtr mParent; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceSetlike_h diff --git a/dom/bindings/test/TestInterfaceSetlikeNode.cpp b/dom/bindings/test/TestInterfaceSetlikeNode.cpp new file mode 100644 index 000000000..5499553fa --- /dev/null +++ b/dom/bindings/test/TestInterfaceSetlikeNode.cpp @@ -0,0 +1,58 @@ +/* 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/. */ + +#include "mozilla/dom/TestInterfaceSetlikeNode.h" +#include "mozilla/dom/TestInterfaceJSMaplikeSetlikeIterableBinding.h" +#include "nsPIDOMWindow.h" +#include "mozilla/dom/BindingUtils.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(TestInterfaceSetlikeNode, mParent) + +NS_IMPL_CYCLE_COLLECTING_ADDREF(TestInterfaceSetlikeNode) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TestInterfaceSetlikeNode) + +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TestInterfaceSetlikeNode) +NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY +NS_INTERFACE_MAP_ENTRY(nsISupports) +NS_INTERFACE_MAP_END + +TestInterfaceSetlikeNode::TestInterfaceSetlikeNode(JSContext* aCx, + nsPIDOMWindowInner* aParent) +: mParent(aParent) +{ +} + +//static +already_AddRefed +TestInterfaceSetlikeNode::Constructor(const GlobalObject& aGlobal, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + RefPtr r = new TestInterfaceSetlikeNode(nullptr, window); + return r.forget(); +} + +JSObject* +TestInterfaceSetlikeNode::WrapObject(JSContext* aCx, + JS::Handle aGivenProto) +{ + return TestInterfaceSetlikeNodeBinding::Wrap(aCx, this, aGivenProto); +} + +nsPIDOMWindowInner* +TestInterfaceSetlikeNode::GetParentObject() const +{ + return mParent; +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/bindings/test/TestInterfaceSetlikeNode.h b/dom/bindings/test/TestInterfaceSetlikeNode.h new file mode 100644 index 000000000..05b14190e --- /dev/null +++ b/dom/bindings/test/TestInterfaceSetlikeNode.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim:set ts=2 sw=2 sts=2 et cindent: */ +/* 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 mozilla_dom_TestInterfaceSetlikeNode_h +#define mozilla_dom_TestInterfaceSetlikeNode_h + +#include "nsWrapperCache.h" +#include "nsCOMPtr.h" + +class nsPIDOMWindowInner; + +namespace mozilla { + +class ErrorResult; + +namespace dom { + +class GlobalObject; + +// Implementation of test binding for webidl setlike interfaces, using +// primitives for key type. +class TestInterfaceSetlikeNode final : public nsISupports, + public nsWrapperCache +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TestInterfaceSetlikeNode) + explicit TestInterfaceSetlikeNode(JSContext* aCx, + nsPIDOMWindowInner* aParent); + nsPIDOMWindowInner* GetParentObject() const; + virtual JSObject* WrapObject(JSContext* aCx, + JS::Handle aGivenProto) override; + static already_AddRefed + Constructor(const GlobalObject& aGlobal, ErrorResult& rv); +private: + virtual ~TestInterfaceSetlikeNode() {} + nsCOMPtr mParent; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TestInterfaceSetlikeNode_h diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl new file mode 100644 index 000000000..a131dcdfe --- /dev/null +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -0,0 +1,836 @@ +/* -*- Mode: IDL; 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/. + */ + +typedef TestJSImplInterface AnotherNameForTestJSImplInterface; +typedef TestJSImplInterface YetAnotherNameForTestJSImplInterface; +typedef TestJSImplInterface? NullableTestJSImplInterface; + +callback MyTestCallback = void(); + +enum MyTestEnum { + "a", + "b" +}; + +// We don't support multiple constructors (bug 869268) or named constructors +// for JS-implemented WebIDL. +[Constructor(DOMString str, unsigned long num, boolean? boolArg, + TestInterface? iface, long arg1, + DictForConstructor dict, any any1, + object obj1, + object? obj2, sequence seq, optional any any2, + optional object obj3, + optional object? obj4, + Uint8Array typedArr, + ArrayBuffer arrayBuf), + JSImplementation="@mozilla.org/test-js-impl-interface;1"] +interface TestJSImplInterface { + // Integer types + // XXXbz add tests for throwing versions of all the integer stuff + readonly attribute byte readonlyByte; + attribute byte writableByte; + void passByte(byte arg); + byte receiveByte(); + void passOptionalByte(optional byte arg); + void passOptionalByteBeforeRequired(optional byte arg1, byte arg2); + void passOptionalByteWithDefault(optional byte arg = 0); + void passOptionalByteWithDefaultBeforeRequired(optional byte arg1 = 0, byte arg2); + void passNullableByte(byte? arg); + void passOptionalNullableByte(optional byte? arg); + void passVariadicByte(byte... arg); + [Cached, Pure] + readonly attribute byte cachedByte; + [Cached, Constant] + readonly attribute byte cachedConstantByte; + [Cached, Pure] + attribute byte cachedWritableByte; + [Affects=Nothing] + attribute byte sideEffectFreeByte; + [Affects=Nothing, DependsOn=DOMState] + attribute byte domDependentByte; + [Affects=Nothing, DependsOn=Nothing] + readonly attribute byte constantByte; + [DependsOn=DeviceState, Affects=Nothing] + readonly attribute byte deviceStateDependentByte; + [Affects=Nothing] + byte returnByteSideEffectFree(); + [Affects=Nothing, DependsOn=DOMState] + byte returnDOMDependentByte(); + [Affects=Nothing, DependsOn=Nothing] + byte returnConstantByte(); + [DependsOn=DeviceState, Affects=Nothing] + byte returnDeviceStateDependentByte(); + + readonly attribute short readonlyShort; + attribute short writableShort; + void passShort(short arg); + short receiveShort(); + void passOptionalShort(optional short arg); + void passOptionalShortWithDefault(optional short arg = 5); + + readonly attribute long readonlyLong; + attribute long writableLong; + void passLong(long arg); + long receiveLong(); + void passOptionalLong(optional long arg); + void passOptionalLongWithDefault(optional long arg = 7); + + readonly attribute long long readonlyLongLong; + attribute long long writableLongLong; + void passLongLong(long long arg); + long long receiveLongLong(); + void passOptionalLongLong(optional long long arg); + void passOptionalLongLongWithDefault(optional long long arg = -12); + + readonly attribute octet readonlyOctet; + attribute octet writableOctet; + void passOctet(octet arg); + octet receiveOctet(); + void passOptionalOctet(optional octet arg); + void passOptionalOctetWithDefault(optional octet arg = 19); + + readonly attribute unsigned short readonlyUnsignedShort; + attribute unsigned short writableUnsignedShort; + void passUnsignedShort(unsigned short arg); + unsigned short receiveUnsignedShort(); + void passOptionalUnsignedShort(optional unsigned short arg); + void passOptionalUnsignedShortWithDefault(optional unsigned short arg = 2); + + readonly attribute unsigned long readonlyUnsignedLong; + attribute unsigned long writableUnsignedLong; + void passUnsignedLong(unsigned long arg); + unsigned long receiveUnsignedLong(); + void passOptionalUnsignedLong(optional unsigned long arg); + void passOptionalUnsignedLongWithDefault(optional unsigned long arg = 6); + + readonly attribute unsigned long long readonlyUnsignedLongLong; + attribute unsigned long long writableUnsignedLongLong; + void passUnsignedLongLong(unsigned long long arg); + unsigned long long receiveUnsignedLongLong(); + void passOptionalUnsignedLongLong(optional unsigned long long arg); + void passOptionalUnsignedLongLongWithDefault(optional unsigned long long arg = 17); + + attribute float writableFloat; + attribute unrestricted float writableUnrestrictedFloat; + attribute float? writableNullableFloat; + attribute unrestricted float? writableNullableUnrestrictedFloat; + attribute double writableDouble; + attribute unrestricted double writableUnrestrictedDouble; + attribute double? writableNullableDouble; + attribute unrestricted double? writableNullableUnrestrictedDouble; + void passFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, sequence arg10, + sequence arg11, sequence arg12, + sequence arg13, sequence arg14, + sequence arg15, sequence arg16); + [LenientFloat] + void passLenientFloat(float arg1, unrestricted float arg2, + float? arg3, unrestricted float? arg4, + double arg5, unrestricted double arg6, + double? arg7, unrestricted double? arg8, + sequence arg9, + sequence arg10, + sequence arg11, + sequence arg12, + sequence arg13, + sequence arg14, + sequence arg15, + sequence arg16); + [LenientFloat] + attribute float lenientFloatAttr; + [LenientFloat] + attribute double lenientDoubleAttr; + + // Castable interface types + // XXXbz add tests for throwing versions of all the castable interface stuff + TestJSImplInterface receiveSelf(); + TestJSImplInterface? receiveNullableSelf(); + + TestJSImplInterface receiveWeakSelf(); + TestJSImplInterface? receiveWeakNullableSelf(); + + // A version to test for casting to TestJSImplInterface& + void passSelf(TestJSImplInterface arg); + void passNullableSelf(TestJSImplInterface? arg); + attribute TestJSImplInterface nonNullSelf; + attribute TestJSImplInterface? nullableSelf; + [Cached, Pure] + readonly attribute TestJSImplInterface cachedSelf; + // Optional arguments + void passOptionalSelf(optional TestJSImplInterface? arg); + void passOptionalNonNullSelf(optional TestJSImplInterface arg); + void passOptionalSelfWithDefault(optional TestJSImplInterface? arg = null); + + // Non-wrapper-cache interface types + [NewObject] + TestNonWrapperCacheInterface receiveNonWrapperCacheInterface(); + [NewObject] + TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface(); + + [NewObject] + sequence receiveNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence receiveNullableNonWrapperCacheInterfaceSequence(); + [NewObject] + sequence? receiveNonWrapperCacheInterfaceNullableSequence(); + [NewObject] + sequence? receiveNullableNonWrapperCacheInterfaceNullableSequence(); + + // Non-castable interface types + IndirectlyImplementedInterface receiveOther(); + IndirectlyImplementedInterface? receiveNullableOther(); + IndirectlyImplementedInterface receiveWeakOther(); + IndirectlyImplementedInterface? receiveWeakNullableOther(); + + void passOther(IndirectlyImplementedInterface arg); + void passNullableOther(IndirectlyImplementedInterface? arg); + attribute IndirectlyImplementedInterface nonNullOther; + attribute IndirectlyImplementedInterface? nullableOther; + // Optional arguments + void passOptionalOther(optional IndirectlyImplementedInterface? arg); + void passOptionalNonNullOther(optional IndirectlyImplementedInterface arg); + void passOptionalOtherWithDefault(optional IndirectlyImplementedInterface? arg = null); + + // External interface types + TestExternalInterface receiveExternal(); + TestExternalInterface? receiveNullableExternal(); + TestExternalInterface receiveWeakExternal(); + TestExternalInterface? receiveWeakNullableExternal(); + void passExternal(TestExternalInterface arg); + void passNullableExternal(TestExternalInterface? arg); + attribute TestExternalInterface nonNullExternal; + attribute TestExternalInterface? nullableExternal; + // Optional arguments + void passOptionalExternal(optional TestExternalInterface? arg); + void passOptionalNonNullExternal(optional TestExternalInterface arg); + void passOptionalExternalWithDefault(optional TestExternalInterface? arg = null); + + // Callback interface types + TestCallbackInterface receiveCallbackInterface(); + TestCallbackInterface? receiveNullableCallbackInterface(); + TestCallbackInterface receiveWeakCallbackInterface(); + TestCallbackInterface? receiveWeakNullableCallbackInterface(); + void passCallbackInterface(TestCallbackInterface arg); + void passNullableCallbackInterface(TestCallbackInterface? arg); + attribute TestCallbackInterface nonNullCallbackInterface; + attribute TestCallbackInterface? nullableCallbackInterface; + // Optional arguments + void passOptionalCallbackInterface(optional TestCallbackInterface? arg); + void passOptionalNonNullCallbackInterface(optional TestCallbackInterface arg); + void passOptionalCallbackInterfaceWithDefault(optional TestCallbackInterface? arg = null); + + // Miscellaneous interface tests + IndirectlyImplementedInterface receiveConsequentialInterface(); + void passConsequentialInterface(IndirectlyImplementedInterface arg); + + // Sequence types + [Cached, Pure] + readonly attribute sequence readonlySequence; + [Cached, Pure] + readonly attribute sequence readonlySequenceOfDictionaries; + [Cached, Pure] + readonly attribute sequence? readonlyNullableSequenceOfDictionaries; + [Cached, Pure, Frozen] + readonly attribute sequence readonlyFrozenSequence; + [Cached, Pure, Frozen] + readonly attribute sequence? readonlyFrozenNullableSequence; + sequence receiveSequence(); + sequence? receiveNullableSequence(); + sequence receiveSequenceOfNullableInts(); + sequence? receiveNullableSequenceOfNullableInts(); + void passSequence(sequence arg); + void passNullableSequence(sequence? arg); + void passSequenceOfNullableInts(sequence arg); + void passOptionalSequenceOfNullableInts(optional sequence arg); + void passOptionalNullableSequenceOfNullableInts(optional sequence? arg); + sequence receiveCastableObjectSequence(); + sequence receiveCallbackObjectSequence(); + sequence receiveNullableCastableObjectSequence(); + sequence receiveNullableCallbackObjectSequence(); + sequence? receiveCastableObjectNullableSequence(); + sequence? receiveNullableCastableObjectNullableSequence(); + sequence receiveWeakCastableObjectSequence(); + sequence receiveWeakNullableCastableObjectSequence(); + sequence? receiveWeakCastableObjectNullableSequence(); + sequence? receiveWeakNullableCastableObjectNullableSequence(); + void passCastableObjectSequence(sequence arg); + void passNullableCastableObjectSequence(sequence arg); + void passCastableObjectNullableSequence(sequence? arg); + void passNullableCastableObjectNullableSequence(sequence? arg); + void passOptionalSequence(optional sequence arg); + void passOptionalSequenceWithDefaultValue(optional sequence arg = []); + void passOptionalNullableSequence(optional sequence? arg); + void passOptionalNullableSequenceWithDefaultValue(optional sequence? arg = null); + void passOptionalNullableSequenceWithDefaultValue2(optional sequence? arg = []); + void passOptionalObjectSequence(optional sequence arg); + void passExternalInterfaceSequence(sequence arg); + void passNullableExternalInterfaceSequence(sequence arg); + + sequence receiveStringSequence(); + sequence receiveByteStringSequence(); + // Callback interface problem. See bug 843261. + //void passStringSequence(sequence arg); + sequence receiveAnySequence(); + sequence? receiveNullableAnySequence(); + //XXXbz No support for sequence of sequence return values yet. + //sequence> receiveAnySequenceSequence(); + + sequence receiveObjectSequence(); + sequence receiveNullableObjectSequence(); + + void passSequenceOfSequences(sequence> arg); + void passSequenceOfSequencesOfSequences(sequence>> arg); + //XXXbz No support for sequence of sequence return values yet. + //sequence> receiveSequenceOfSequences(); + + // MozMap types + void passMozMap(MozMap arg); + void passNullableMozMap(MozMap? arg); + void passMozMapOfNullableInts(MozMap arg); + void passOptionalMozMapOfNullableInts(optional MozMap arg); + void passOptionalNullableMozMapOfNullableInts(optional MozMap? arg); + void passCastableObjectMozMap(MozMap arg); + void passNullableCastableObjectMozMap(MozMap arg); + void passCastableObjectNullableMozMap(MozMap? arg); + void passNullableCastableObjectNullableMozMap(MozMap? arg); + void passOptionalMozMap(optional MozMap arg); + void passOptionalNullableMozMap(optional MozMap? arg); + void passOptionalNullableMozMapWithDefaultValue(optional MozMap? arg = null); + void passOptionalObjectMozMap(optional MozMap arg); + void passExternalInterfaceMozMap(MozMap arg); + void passNullableExternalInterfaceMozMap(MozMap arg); + void passStringMozMap(MozMap arg); + void passByteStringMozMap(MozMap arg); + void passMozMapOfMozMaps(MozMap> arg); + MozMap receiveMozMap(); + MozMap? receiveNullableMozMap(); + MozMap receiveMozMapOfNullableInts(); + MozMap? receiveNullableMozMapOfNullableInts(); + //XXXbz No support for MozMap of MozMaps return values yet. + //MozMap> receiveMozMapOfMozMaps(); + MozMap receiveAnyMozMap(); + + // Typed array types + void passArrayBuffer(ArrayBuffer arg); + void passNullableArrayBuffer(ArrayBuffer? arg); + void passOptionalArrayBuffer(optional ArrayBuffer arg); + void passOptionalNullableArrayBuffer(optional ArrayBuffer? arg); + void passOptionalNullableArrayBufferWithDefaultValue(optional ArrayBuffer? arg= null); + void passArrayBufferView(ArrayBufferView arg); + void passInt8Array(Int8Array arg); + void passInt16Array(Int16Array arg); + void passInt32Array(Int32Array arg); + void passUint8Array(Uint8Array arg); + void passUint16Array(Uint16Array arg); + void passUint32Array(Uint32Array arg); + void passUint8ClampedArray(Uint8ClampedArray arg); + void passFloat32Array(Float32Array arg); + void passFloat64Array(Float64Array arg); + void passSequenceOfArrayBuffers(sequence arg); + void passSequenceOfNullableArrayBuffers(sequence arg); + void passMozMapOfArrayBuffers(MozMap arg); + void passMozMapOfNullableArrayBuffers(MozMap arg); + void passVariadicTypedArray(Float32Array... arg); + void passVariadicNullableTypedArray(Float32Array?... arg); + Uint8Array receiveUint8Array(); + attribute Uint8Array uint8ArrayAttr; + + // DOMString types + void passString(DOMString arg); + void passNullableString(DOMString? arg); + void passOptionalString(optional DOMString arg); + void passOptionalStringWithDefaultValue(optional DOMString arg = "abc"); + void passOptionalNullableString(optional DOMString? arg); + void passOptionalNullableStringWithDefaultValue(optional DOMString? arg = null); + void passVariadicString(DOMString... arg); + + // ByteString types + void passByteString(ByteString arg); + void passNullableByteString(ByteString? arg); + void passOptionalByteString(optional ByteString arg); + void passOptionalByteStringWithDefaultValue(optional ByteString arg = "abc"); + void passOptionalNullableByteString(optional ByteString? arg); + void passOptionalNullableByteStringWithDefaultValue(optional ByteString? arg = null); + void passVariadicByteString(ByteString... arg); + void passUnionByteString((ByteString or long) arg); + void passOptionalUnionByteString(optional (ByteString or long) arg); + void passOptionalUnionByteStringWithDefaultValue(optional (ByteString or long) arg = "abc"); + + // USVString types + void passSVS(USVString arg); + void passNullableSVS(USVString? arg); + void passOptionalSVS(optional USVString arg); + void passOptionalSVSWithDefaultValue(optional USVString arg = "abc"); + void passOptionalNullableSVS(optional USVString? arg); + void passOptionalNullableSVSWithDefaultValue(optional USVString? arg = null); + void passVariadicSVS(USVString... arg); + USVString receiveSVS(); + + // Enumerated types + void passEnum(MyTestEnum arg); + void passNullableEnum(MyTestEnum? arg); + void passOptionalEnum(optional MyTestEnum arg); + void passEnumWithDefault(optional MyTestEnum arg = "a"); + void passOptionalNullableEnum(optional MyTestEnum? arg); + void passOptionalNullableEnumWithDefaultValue(optional MyTestEnum? arg = null); + void passOptionalNullableEnumWithDefaultValue2(optional MyTestEnum? arg = "a"); + MyTestEnum receiveEnum(); + MyTestEnum? receiveNullableEnum(); + attribute MyTestEnum enumAttribute; + readonly attribute MyTestEnum readonlyEnumAttribute; + + // Callback types + void passCallback(MyTestCallback arg); + void passNullableCallback(MyTestCallback? arg); + void passOptionalCallback(optional MyTestCallback arg); + void passOptionalNullableCallback(optional MyTestCallback? arg); + void passOptionalNullableCallbackWithDefaultValue(optional MyTestCallback? arg = null); + MyTestCallback receiveCallback(); + MyTestCallback? receiveNullableCallback(); + // Hmm. These two don't work, I think because I need a locally modified version of TestTreatAsNullCallback. + //void passNullableTreatAsNullCallback(TestTreatAsNullCallback? arg); + //void passOptionalNullableTreatAsNullCallback(optional TestTreatAsNullCallback? arg); + void passOptionalNullableTreatAsNullCallbackWithDefaultValue(optional TestTreatAsNullCallback? arg = null); + + // Any types + void passAny(any arg); + void passVariadicAny(any... arg); + void passOptionalAny(optional any arg); + void passAnyDefaultNull(optional any arg = null); + void passSequenceOfAny(sequence arg); + void passNullableSequenceOfAny(sequence? arg); + void passOptionalSequenceOfAny(optional sequence arg); + void passOptionalNullableSequenceOfAny(optional sequence? arg); + void passOptionalSequenceOfAnyWithDefaultValue(optional sequence? arg = null); + void passSequenceOfSequenceOfAny(sequence> arg); + void passSequenceOfNullableSequenceOfAny(sequence?> arg); + void passNullableSequenceOfNullableSequenceOfAny(sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence?>? arg); + void passMozMapOfAny(MozMap arg); + void passNullableMozMapOfAny(MozMap? arg); + void passOptionalMozMapOfAny(optional MozMap arg); + void passOptionalNullableMozMapOfAny(optional MozMap? arg); + void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap? arg = null); + void passMozMapOfMozMapOfAny(MozMap> arg); + void passMozMapOfNullableMozMapOfAny(MozMap?> arg); + void passNullableMozMapOfNullableMozMapOfAny(MozMap?>? arg); + void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap?>? arg); + void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap?>? arg); + void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence?>? arg); + any receiveAny(); + + // object types + void passObject(object arg); + void passVariadicObject(object... arg); + void passNullableObject(object? arg); + void passVariadicNullableObject(object... arg); + void passOptionalObject(optional object arg); + void passOptionalNullableObject(optional object? arg); + void passOptionalNullableObjectWithDefaultValue(optional object? arg = null); + void passSequenceOfObject(sequence arg); + void passSequenceOfNullableObject(sequence arg); + void passNullableSequenceOfObject(sequence? arg); + void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence?>? arg); + void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence?>? arg); + void passMozMapOfObject(MozMap arg); + object receiveObject(); + object? receiveNullableObject(); + + // Union types + void passUnion((object or long) arg); + // Some union tests are debug-only to avoid creating all those + // unused union types in opt builds. +#ifdef DEBUG + void passUnion2((long or boolean) arg); + void passUnion3((object or long or boolean) arg); + void passUnion4((Node or long or boolean) arg); + void passUnion5((object or boolean) arg); + void passUnion6((object or DOMString) arg); + void passUnion7((object or DOMString or long) arg); + void passUnion8((object or DOMString or boolean) arg); + void passUnion9((object or DOMString or long or boolean) arg); + void passUnion10(optional (EventInit or long) arg); + void passUnion11(optional (CustomEventInit or long) arg); + void passUnion12(optional (EventInit or long) arg = 5); + void passUnion13(optional (object or long?) arg = null); + void passUnion14(optional (object or long?) arg = 5); + void passUnion15((sequence or long) arg); + void passUnion16(optional (sequence or long) arg); + void passUnion17(optional (sequence? or long) arg = 5); + void passUnion18((sequence or long) arg); + void passUnion19(optional (sequence or long) arg); + void passUnion20(optional (sequence or long) arg = []); + void passUnion21((MozMap or long) arg); + void passUnion22((MozMap or long) arg); + void passUnion23((sequence or long) arg); + void passUnion24((sequence or long) arg); + void passUnion25((sequence> or long) arg); + void passUnion26((sequence> or long) arg); + void passUnion27(optional (sequence or EventInit) arg); + void passUnion28(optional (EventInit or sequence) arg); + void passUnionWithCallback((EventHandler or long) arg); + void passUnionWithByteString((ByteString or long) arg); + void passUnionWithMozMap((MozMap or DOMString) arg); + void passUnionWithMozMapAndSequence((MozMap or sequence) arg); + void passUnionWithSequenceAndMozMap((sequence or MozMap) arg); + void passUnionWithSVS((USVString or long) arg); +#endif + void passUnionWithNullable((object? or long) arg); + void passNullableUnion((object or long)? arg); + void passOptionalUnion(optional (object or long) arg); + void passOptionalNullableUnion(optional (object or long)? arg); + void passOptionalNullableUnionWithDefaultValue(optional (object or long)? arg = null); + //void passUnionWithInterfaces((TestJSImplInterface or TestExternalInterface) arg); + //void passUnionWithInterfacesAndNullable((TestJSImplInterface? or TestExternalInterface) arg); + //void passUnionWithSequence((sequence or long) arg); + void passUnionWithArrayBuffer((ArrayBuffer or long) arg); + void passUnionWithString((DOMString or object) arg); + // Using an enum in a union. Note that we use some enum not declared in our + // binding file, because UnionTypes.h will need to include the binding header + // for this enum. Pick an enum from an interface that won't drag in too much + // stuff. + void passUnionWithEnum((SupportedType or object) arg); + + // Trying to use a callback in a union won't include the test + // headers, unfortunately, so won't compile. + // void passUnionWithCallback((MyTestCallback or long) arg); + void passUnionWithObject((object or long) arg); + //void passUnionWithDict((Dict or long) arg); + + void passUnionWithDefaultValue1(optional (double or DOMString) arg = ""); + void passUnionWithDefaultValue2(optional (double or DOMString) arg = 1); + void passUnionWithDefaultValue3(optional (double or DOMString) arg = 1.5); + void passUnionWithDefaultValue4(optional (float or DOMString) arg = ""); + void passUnionWithDefaultValue5(optional (float or DOMString) arg = 1); + void passUnionWithDefaultValue6(optional (float or DOMString) arg = 1.5); + void passUnionWithDefaultValue7(optional (unrestricted double or DOMString) arg = ""); + void passUnionWithDefaultValue8(optional (unrestricted double or DOMString) arg = 1); + void passUnionWithDefaultValue9(optional (unrestricted double or DOMString) arg = 1.5); + void passUnionWithDefaultValue10(optional (unrestricted double or DOMString) arg = Infinity); + void passUnionWithDefaultValue11(optional (unrestricted float or DOMString) arg = ""); + void passUnionWithDefaultValue12(optional (unrestricted float or DOMString) arg = 1); + void passUnionWithDefaultValue13(optional (unrestricted float or DOMString) arg = Infinity); + void passUnionWithDefaultValue14(optional (double or ByteString) arg = ""); + void passUnionWithDefaultValue15(optional (double or ByteString) arg = 1); + void passUnionWithDefaultValue16(optional (double or ByteString) arg = 1.5); + void passUnionWithDefaultValue17(optional (double or SupportedType) arg = "text/html"); + void passUnionWithDefaultValue18(optional (double or SupportedType) arg = 1); + void passUnionWithDefaultValue19(optional (double or SupportedType) arg = 1.5); + + void passNullableUnionWithDefaultValue1(optional (double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue2(optional (double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue3(optional (double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue4(optional (float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue5(optional (float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue6(optional (float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue7(optional (unrestricted double or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue8(optional (unrestricted double or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue9(optional (unrestricted double or DOMString)? arg = null); + void passNullableUnionWithDefaultValue10(optional (unrestricted float or DOMString)? arg = ""); + void passNullableUnionWithDefaultValue11(optional (unrestricted float or DOMString)? arg = 1); + void passNullableUnionWithDefaultValue12(optional (unrestricted float or DOMString)? arg = null); + void passNullableUnionWithDefaultValue13(optional (double or ByteString)? arg = ""); + void passNullableUnionWithDefaultValue14(optional (double or ByteString)? arg = 1); + void passNullableUnionWithDefaultValue15(optional (double or ByteString)? arg = 1.5); + void passNullableUnionWithDefaultValue16(optional (double or ByteString)? arg = null); + void passNullableUnionWithDefaultValue17(optional (double or SupportedType)? arg = "text/html"); + void passNullableUnionWithDefaultValue18(optional (double or SupportedType)? arg = 1); + void passNullableUnionWithDefaultValue19(optional (double or SupportedType)? arg = 1.5); + void passNullableUnionWithDefaultValue20(optional (double or SupportedType)? arg = null); + + void passSequenceOfUnions(sequence<(CanvasPattern or CanvasGradient)> arg); + void passSequenceOfUnions2(sequence<(object or long)> arg); + void passVariadicUnion((CanvasPattern or CanvasGradient)... arg); + + void passSequenceOfNullableUnions(sequence<(CanvasPattern or CanvasGradient)?> arg); + void passVariadicNullableUnion((CanvasPattern or CanvasGradient)?... arg); + void passMozMapOfUnions(MozMap<(CanvasPattern or CanvasGradient)> arg); + // XXXbz no move constructor on some unions + // void passMozMapOfUnions2(MozMap<(object or long)> arg); + + (CanvasPattern or CanvasGradient) receiveUnion(); + (object or long) receiveUnion2(); + (CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + (CanvasPattern or CanvasGradient)? receiveNullableUnion(); + (object or long)? receiveNullableUnion2(); + + attribute (CanvasPattern or CanvasGradient) writableUnion; + attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + + // Date types + void passDate(Date arg); + void passNullableDate(Date? arg); + void passOptionalDate(optional Date arg); + void passOptionalNullableDate(optional Date? arg); + void passOptionalNullableDateWithDefaultValue(optional Date? arg = null); + void passDateSequence(sequence arg); + void passNullableDateSequence(sequence arg); + void passDateMozMap(MozMap arg); + Date receiveDate(); + Date? receiveNullableDate(); + + // Promise types + void passPromise(Promise arg); + void passNullablePromise(Promise? arg); + void passOptionalPromise(optional Promise arg); + void passOptionalNullablePromise(optional Promise? arg); + void passOptionalNullablePromiseWithDefaultValue(optional Promise? arg = null); + void passPromiseSequence(sequence> arg); + void passNullablePromiseSequence(sequence?> arg); + Promise receivePromise(); + Promise receiveAddrefedPromise(); + + // binaryNames tests + void methodRenamedFrom(); + [BinaryName="otherMethodRenamedTo"] + void otherMethodRenamedFrom(); + void methodRenamedFrom(byte argument); + readonly attribute byte attributeGetterRenamedFrom; + attribute byte attributeRenamedFrom; + [BinaryName="otherAttributeRenamedTo"] + attribute byte otherAttributeRenamedFrom; + + void passDictionary(optional Dict x); + void passDictionary2(Dict x); + [Cached, Pure] + readonly attribute Dict readonlyDictionary; + [Cached, Pure] + readonly attribute Dict? readonlyNullableDictionary; + [Cached, Pure] + attribute Dict writableDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict readonlyFrozenDictionary; + [Cached, Pure, Frozen] + readonly attribute Dict? readonlyFrozenNullableDictionary; + [Cached, Pure, Frozen] + attribute Dict writableFrozenDictionary; + Dict receiveDictionary(); + Dict? receiveNullableDictionary(); + void passOtherDictionary(optional GrandparentDict x); + void passSequenceOfDictionaries(sequence x); + void passMozMapOfDictionaries(MozMap x); + // No support for nullable dictionaries inside a sequence (nor should there be) + // void passSequenceOfNullableDictionaries(sequence x); + void passDictionaryOrLong(optional Dict x); + void passDictionaryOrLong(long x); + + void passDictContainingDict(optional DictContainingDict arg); + void passDictContainingSequence(optional DictContainingSequence arg); + DictContainingSequence receiveDictContainingSequence(); + void passVariadicDictionary(Dict... arg); + + // EnforceRange/Clamp tests + void dontEnforceRangeOrClamp(byte arg); + void doEnforceRange([EnforceRange] byte arg); + void doClamp([Clamp] byte arg); + [EnforceRange] attribute byte enforcedByte; + [Clamp] attribute byte clampedByte; + + // Typedefs + const myLong myLongConstant = 5; + void exerciseTypedefInterfaces1(AnotherNameForTestJSImplInterface arg); + AnotherNameForTestJSImplInterface exerciseTypedefInterfaces2(NullableTestJSImplInterface arg); + void exerciseTypedefInterfaces3(YetAnotherNameForTestJSImplInterface arg); + + // Deprecated methods and attributes + [Deprecated="GetAttributeNode"] + attribute byte deprecatedAttribute; + [Deprecated="GetAttributeNode"] + byte deprecatedMethod(); + [Deprecated="GetAttributeNode"] + void deprecatedMethodWithContext(any arg); + + // Static methods and attributes + // FIXME: Bug 863952 Static things are not supported yet + /* + static attribute boolean staticAttribute; + static void staticMethod(boolean arg); + static void staticMethodWithContext(any arg); + + // Deprecated static methods and attributes + [Deprecated="GetAttributeNode"] + static attribute byte staticDeprecatedAttribute; + [Deprecated="GetAttributeNode"] + static byte staticDeprecatedMethod(); + [Deprecated="GetAttributeNode"] + static byte staticDeprecatedMethodWithContext(); + */ + + // Overload resolution tests + //void overload1(DOMString... strs); + boolean overload1(TestJSImplInterface arg); + TestJSImplInterface overload1(DOMString strs, TestJSImplInterface arg); + void overload2(TestJSImplInterface arg); + void overload2(optional Dict arg); + void overload2(boolean arg); + void overload2(DOMString arg); + void overload2(Date arg); + void overload3(TestJSImplInterface arg); + void overload3(MyTestCallback arg); + void overload3(boolean arg); + void overload4(TestJSImplInterface arg); + void overload4(TestCallbackInterface arg); + void overload4(DOMString arg); + void overload5(long arg); + void overload5(MyTestEnum arg); + void overload6(long arg); + void overload6(boolean arg); + void overload7(long arg); + void overload7(boolean arg); + void overload7(ByteString arg); + void overload8(long arg); + void overload8(TestJSImplInterface arg); + void overload9(long? arg); + void overload9(DOMString arg); + void overload10(long? arg); + void overload10(object arg); + void overload11(long arg); + void overload11(DOMString? arg); + void overload12(long arg); + void overload12(boolean? arg); + void overload13(long? arg); + void overload13(boolean arg); + void overload14(optional long arg); + void overload14(TestInterface arg); + void overload15(long arg); + void overload15(optional TestInterface arg); + void overload16(long arg); + void overload16(optional TestInterface? arg); + void overload17(sequence arg); + void overload17(MozMap arg); + void overload18(MozMap arg); + void overload18(sequence arg); + void overload19(sequence arg); + void overload19(optional Dict arg); + void overload20(optional Dict arg); + void overload20(sequence arg); + + // Variadic handling + void passVariadicThirdArg(DOMString arg1, long arg2, TestJSImplInterface... arg3); + + // Conditionally exposed methods/attributes + [Pref="abc.def"] + readonly attribute boolean prefable1; + [Pref="abc.def"] + readonly attribute boolean prefable2; + [Pref="ghi.jkl"] + readonly attribute boolean prefable3; + [Pref="ghi.jkl"] + readonly attribute boolean prefable4; + [Pref="abc.def"] + readonly attribute boolean prefable5; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable6; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable7; + [Pref="ghi.jkl", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable8; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean prefable9; + [Pref="abc.def"] + void prefable10(); + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable11(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable12; + [Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void prefable13(); + [Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean prefable14; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable15; + [Func="TestFuncControlledMember"] + readonly attribute boolean prefable16; + [Pref="abc.def", Func="TestFuncControlledMember"] + void prefable17(); + [Func="TestFuncControlledMember"] + void prefable18(); + [Func="TestFuncControlledMember"] + void prefable19(); + [Pref="abc.def", Func="TestFuncControlledMember", ChromeOnly] + void prefable20(); + + // Conditionally exposed methods/attributes involving [SecureContext] + [SecureContext] + readonly attribute boolean conditionalOnSecureContext1; + [SecureContext, Pref="abc.def"] + readonly attribute boolean conditionalOnSecureContext2; + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + readonly attribute boolean conditionalOnSecureContext3; + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + readonly attribute boolean conditionalOnSecureContext4; + [SecureContext] + void conditionalOnSecureContext5(); + [SecureContext, Pref="abc.def"] + void conditionalOnSecureContext6(); + [SecureContext, Pref="abc.def", Func="nsGenericHTMLElement::TouchEventsEnabled"] + void conditionalOnSecureContext7(); + [SecureContext, Pref="abc.def", Func="TestFuncControlledMember"] + void conditionalOnSecureContext8(); + + // Miscellania + [LenientThis] attribute long attrWithLenientThis; + // FIXME: Bug 863954 Unforgeable things get all confused when + // non-JS-implemented interfaces inherit from JS-implemented ones or vice + // versa. + // [Unforgeable] readonly attribute long unforgeableAttr; + // [Unforgeable, ChromeOnly] readonly attribute long unforgeableAttr2; + // [Unforgeable] long unforgeableMethod(); + // [Unforgeable, ChromeOnly] long unforgeableMethod2(); + // FIXME: Bug 863955 No stringifiers yet + // stringifier; + void passRenamedInterface(TestRenamedInterface arg); + [PutForwards=writableByte] readonly attribute TestJSImplInterface putForwardsAttr; + [PutForwards=writableByte, LenientThis] readonly attribute TestJSImplInterface putForwardsAttr2; + [PutForwards=writableByte, ChromeOnly] readonly attribute TestJSImplInterface putForwardsAttr3; + [Throws] void throwingMethod(); + [Throws] attribute boolean throwingAttr; + [GetterThrows] attribute boolean throwingGetterAttr; + [SetterThrows] attribute boolean throwingSetterAttr; + // NeedsSubjectPrincipal not supported on JS-implemented things for + // now, because we always pass in the caller principal anyway. + // [NeedsSubjectPrincipal] void needsSubjectPrincipalMethod(); + // [NeedsSubjectPrincipal] attribute boolean needsSubjectPrincipalAttr; + // legacycaller short(unsigned long arg1, TestInterface arg2); + void passArgsWithDefaults(optional long arg1, + optional TestInterface? arg2 = null, + optional Dict arg3, optional double arg4 = 5.0, + optional float arg5); + attribute any jsonifierShouldSkipThis; + attribute TestParentInterface jsonifierShouldSkipThis2; + attribute TestCallbackInterface jsonifierShouldSkipThis3; + jsonifier; + + attribute byte dashed-attribute; + void dashed-method(); + + // If you add things here, add them to TestCodeGen as well +}; + +[NavigatorProperty="TestNavigator", JSImplementation="@mozilla.org/test;1"] +interface TestNavigator { +}; + +[Constructor, NavigatorProperty="TestNavigatorWithConstructor", JSImplementation="@mozilla.org/test;1"] +interface TestNavigatorWithConstructor { +}; + +interface TestCImplementedInterface : TestJSImplInterface { +}; + +interface TestCImplementedInterface2 { +}; + +[NoInterfaceObject, + JSImplementation="@mozilla.org/test-js-impl-interface;2"] +interface TestJSImplNoInterfaceObject { + [Cached, Pure] + readonly attribute byte cachedByte; +}; diff --git a/dom/bindings/test/TestJSImplInheritanceGen.webidl b/dom/bindings/test/TestJSImplInheritanceGen.webidl new file mode 100644 index 000000000..e62dbd10b --- /dev/null +++ b/dom/bindings/test/TestJSImplInheritanceGen.webidl @@ -0,0 +1,29 @@ +/* -*- Mode: IDL; 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/. + */ + +[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface2;1"] +interface TestJSImplInterface2 : TestCImplementedInterface { +}; + +[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface3;1"] +interface TestJSImplInterface3 : TestCImplementedInterface2 { +}; + +// Important: TestJSImplInterface5 needs to come before TestJSImplInterface6 in +// this file to test what it's trying to test. +[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface5;1"] +interface TestJSImplInterface5 : TestJSImplInterface6 { +}; + +// Important: TestJSImplInterface6 needs to come after TestJSImplInterface3 in +// this file to test what it's trying to test. +[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface6;1"] +interface TestJSImplInterface6 : TestJSImplInterface3 { +}; + +[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface4;1"] +interface TestJSImplInterface4 : EventTarget { +}; diff --git a/dom/bindings/test/TestTypedef.webidl b/dom/bindings/test/TestTypedef.webidl new file mode 100644 index 000000000..7f758c79e --- /dev/null +++ b/dom/bindings/test/TestTypedef.webidl @@ -0,0 +1,7 @@ +/* -*- Mode: IDL; 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/. + */ + +typedef TestInterface YetAnotherNameForTestInterface; diff --git a/dom/bindings/test/chrome.ini b/dom/bindings/test/chrome.ini new file mode 100644 index 000000000..9fdbd7fd3 --- /dev/null +++ b/dom/bindings/test/chrome.ini @@ -0,0 +1,22 @@ +[DEFAULT] +support-files = + !/dom/bindings/test/file_bug775543.html + !/dom/bindings/test/file_document_location_set_via_xray.html + !/dom/bindings/test/file_dom_xrays.html + !/dom/bindings/test/file_proxies_via_xray.html + +[test_bug775543.html] +[test_document_location_set_via_xray.html] +[test_dom_xrays.html] +[test_proxies_via_xray.html] +[test_document_location_via_xray_cached.html] +[test_blacklisted_prerendering_function.xul] +support-files = + file_focuser.html + file_fullScreenPropertyAccessor.html +skip-if = e10s # prerendering doesn't work in e10s yet +[test_kill_longrunning_prerendered_content.xul] +skip-if = e10s # prerendering doesn't work in e10s yet +[test_bug1123516_maplikesetlikechrome.xul] +skip-if = debug == false +[test_bug1287912.html] diff --git a/dom/bindings/test/file_InstanceOf.html b/dom/bindings/test/file_InstanceOf.html new file mode 100644 index 000000000..487010fa4 --- /dev/null +++ b/dom/bindings/test/file_InstanceOf.html @@ -0,0 +1,12 @@ + + + + + + diff --git a/dom/bindings/test/file_bug775543.html b/dom/bindings/test/file_bug775543.html new file mode 100644 index 000000000..ee8c14c4d --- /dev/null +++ b/dom/bindings/test/file_bug775543.html @@ -0,0 +1,5 @@ + + + diff --git a/dom/bindings/test/file_document_location_set_via_xray.html b/dom/bindings/test/file_document_location_set_via_xray.html new file mode 100644 index 000000000..323acba66 --- /dev/null +++ b/dom/bindings/test/file_document_location_set_via_xray.html @@ -0,0 +1,5 @@ + + + diff --git a/dom/bindings/test/file_dom_xrays.html b/dom/bindings/test/file_dom_xrays.html new file mode 100644 index 000000000..36b3f8a30 --- /dev/null +++ b/dom/bindings/test/file_dom_xrays.html @@ -0,0 +1,24 @@ + + + + + + + + + + + diff --git a/dom/bindings/test/file_focuser.html b/dom/bindings/test/file_focuser.html new file mode 100644 index 000000000..0d5240f95 --- /dev/null +++ b/dom/bindings/test/file_focuser.html @@ -0,0 +1,24 @@ + +
+ diff --git a/dom/bindings/test/file_fullScreenPropertyAccessor.html b/dom/bindings/test/file_fullScreenPropertyAccessor.html new file mode 100644 index 000000000..92a37e0ba --- /dev/null +++ b/dom/bindings/test/file_fullScreenPropertyAccessor.html @@ -0,0 +1,24 @@ + +
+ diff --git a/dom/bindings/test/file_proxies_via_xray.html b/dom/bindings/test/file_proxies_via_xray.html new file mode 100644 index 000000000..2e9a31830 --- /dev/null +++ b/dom/bindings/test/file_proxies_via_xray.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/dom/bindings/test/forOf_iframe.html b/dom/bindings/test/forOf_iframe.html new file mode 100644 index 000000000..91417aba0 --- /dev/null +++ b/dom/bindings/test/forOf_iframe.html @@ -0,0 +1,13 @@ + + + + iframe content for test_forOf_iframe.html + + +
+ + + +
+ + diff --git a/dom/bindings/test/mochitest.ini b/dom/bindings/test/mochitest.ini new file mode 100644 index 000000000..2cd322e74 --- /dev/null +++ b/dom/bindings/test/mochitest.ini @@ -0,0 +1,79 @@ +[DEFAULT] +support-files = + file_InstanceOf.html + file_bug775543.html + file_document_location_set_via_xray.html + file_dom_xrays.html + file_proxies_via_xray.html + forOf_iframe.html + !/js/xpconnect/tests/mochitest/file_empty.html + +[test_async_stacks.html] +[test_ByteString.html] +[test_InstanceOf.html] +[test_bug560072.html] +[test_bug742191.html] +[test_bug759621.html] +[test_bug773326.html] +[test_bug788369.html] +[test_bug852846.html] +[test_bug862092.html] +[test_bug1036214.html] +skip-if = debug == false +[test_bug963382.html] +skip-if = debug == false +[test_bug1041646.html] +[test_bug1123875.html] +[test_barewordGetsWindow.html] +[test_callback_across_document_open.html] +[test_callback_default_thisval.html] +[test_cloneAndImportNode.html] +[test_defineProperty.html] +[test_enums.html] +[test_exceptionThrowing.html] +[test_exception_messages.html] +[test_forOf.html] +[test_integers.html] +[test_interfaceName.html] +[test_interfaceToString.html] +[test_exceptions_from_jsimplemented.html] +tags = webrtc +[test_lenientThis.html] +[test_lookupGetter.html] +[test_namedNoIndexed.html] +[test_named_getter_enumerability.html] +[test_Object.prototype_props.html] +[test_queryInterface.html] +[test_returnUnion.html] +skip-if = debug == false +[test_usvstring.html] +skip-if = debug == false +[test_sequence_wrapping.html] +subsuite = gpu +[test_setWithNamedGetterNoNamedSetter.html] +[test_throwing_method_noDCE.html] +[test_treat_non_object_as_null.html] +[test_traceProtos.html] +[test_sequence_detection.html] +skip-if = debug == false +[test_exception_options_from_jsimplemented.html] +skip-if = debug == false +[test_promise_rejections_from_jsimplemented.html] +skip-if = debug == false +[test_worker_UnwrapArg.html] +[test_unforgeablesonexpando.html] +[test_crossOriginWindowSymbolAccess.html] +[test_primitive_this.html] +[test_callback_exceptions.html] +[test_bug1123516_maplikesetlike.html] +skip-if = debug == false +[test_jsimplemented_eventhandler.html] +skip-if = debug == false +[test_iterable.html] +skip-if = debug == false +[test_oom_reporting.html] +[test_domProxyArrayLengthGetter.html] +[test_exceptionSanitization.html] +skip-if = os == "android" +[test_stringBindings.html] +skip-if = debug == false diff --git a/dom/bindings/test/moz.build b/dom/bindings/test/moz.build new file mode 100644 index 000000000..7d0cb6c21 --- /dev/null +++ b/dom/bindings/test/moz.build @@ -0,0 +1,58 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +DEFINES.update({ + 'IMPL_LIBXUL': True, + 'MOZILLA_INTERNAL_API': True, +}) + +# Do NOT export this library. We don't actually want our test code +# being added to libxul or anything. + +Library('dombindings_test_s') + +EXTRA_COMPONENTS += [ + 'TestInterfaceJS.js', + 'TestInterfaceJS.manifest', + 'TestInterfaceJSMaplike.js' +] + +MOCHITEST_MANIFESTS += ['mochitest.ini'] + +MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] + +TEST_WEBIDL_FILES += [ + 'TestDictionary.webidl', + 'TestJSImplInheritanceGen.webidl', + 'TestTypedef.webidl', +] + +PREPROCESSED_TEST_WEBIDL_FILES += [ + 'TestCodeGen.webidl', + 'TestExampleGen.webidl', + 'TestJSImplGen.webidl', +] + +WEBIDL_EXAMPLE_INTERFACES += [ + 'TestExampleInterface', + 'TestExampleProxyInterface', + 'TestExampleWorkerInterface', +] + +# Bug 932082 tracks having bindings use namespaced includes. +LOCAL_INCLUDES += [ + '!/dist/include/mozilla/dom', +] + +LOCAL_INCLUDES += [ + '!..', + '/dom/bindings', + '/js/xpconnect/src', + '/js/xpconnect/wrappers', +] + +if CONFIG['GNU_CXX']: + CXXFLAGS += ['-Wno-error=shadow'] diff --git a/dom/bindings/test/test_ByteString.html b/dom/bindings/test/test_ByteString.html new file mode 100644 index 000000000..c7e632117 --- /dev/null +++ b/dom/bindings/test/test_ByteString.html @@ -0,0 +1,32 @@ + + + + + + Test for ByteString support + + + + +Mozilla Bug 796850 +

+
+
+
+ + diff --git a/dom/bindings/test/test_InstanceOf.html b/dom/bindings/test/test_InstanceOf.html new file mode 100644 index 000000000..514ec1b2a --- /dev/null +++ b/dom/bindings/test/test_InstanceOf.html @@ -0,0 +1,54 @@ + + + + + + Test for Bug 748983 + + + + +Mozilla Bug 748983 +

+ +
+
+
+ + + diff --git a/dom/bindings/test/test_Object.prototype_props.html b/dom/bindings/test/test_Object.prototype_props.html new file mode 100644 index 000000000..03147eb03 --- /dev/null +++ b/dom/bindings/test/test_Object.prototype_props.html @@ -0,0 +1,20 @@ + + +Test for bug 987110 + + +
+ diff --git a/dom/bindings/test/test_async_stacks.html b/dom/bindings/test/test_async_stacks.html new file mode 100644 index 000000000..8b655a14d --- /dev/null +++ b/dom/bindings/test/test_async_stacks.html @@ -0,0 +1,108 @@ + + + + + + Test for Bug 1148593 + + + + + +Mozilla Bug 1148593 +

+ +
+
+ + diff --git a/dom/bindings/test/test_barewordGetsWindow.html b/dom/bindings/test/test_barewordGetsWindow.html new file mode 100644 index 000000000..e098eea53 --- /dev/null +++ b/dom/bindings/test/test_barewordGetsWindow.html @@ -0,0 +1,60 @@ + + + + + + Test for Bug 936056 + + + + + +Mozilla Bug 936056 +

+ +
+
+ + diff --git a/dom/bindings/test/test_blacklisted_prerendering_function.xul b/dom/bindings/test/test_blacklisted_prerendering_function.xul new file mode 100644 index 000000000..02a76d88d --- /dev/null +++ b/dom/bindings/test/test_blacklisted_prerendering_function.xul @@ -0,0 +1,124 @@ + + + + + + + + + + +Mozilla Bug 1069719 +

+ +
+
+ + + +
diff --git a/dom/bindings/test/test_bug1036214.html b/dom/bindings/test/test_bug1036214.html new file mode 100644 index 000000000..dd98eb482 --- /dev/null +++ b/dom/bindings/test/test_bug1036214.html @@ -0,0 +1,123 @@ + + + + + + Test for Bug 1036214 + + + + + +Mozilla Bug 1036214 +

+ +
+
+ + + diff --git a/dom/bindings/test/test_bug1041646.html b/dom/bindings/test/test_bug1041646.html new file mode 100644 index 000000000..22baed454 --- /dev/null +++ b/dom/bindings/test/test_bug1041646.html @@ -0,0 +1,49 @@ + + + + + + Test for Bug 1041646 + + + + + +Mozilla Bug 1041646 +

+ +
+
+ + diff --git a/dom/bindings/test/test_bug1123516_maplikesetlike.html b/dom/bindings/test/test_bug1123516_maplikesetlike.html new file mode 100644 index 000000000..18ede38ac --- /dev/null +++ b/dom/bindings/test/test_bug1123516_maplikesetlike.html @@ -0,0 +1,271 @@ + + + + + Test Maplike Interface + + + + + + + diff --git a/dom/bindings/test/test_bug1123516_maplikesetlikechrome.xul b/dom/bindings/test/test_bug1123516_maplikesetlikechrome.xul new file mode 100644 index 000000000..4bc45cddd --- /dev/null +++ b/dom/bindings/test/test_bug1123516_maplikesetlikechrome.xul @@ -0,0 +1,68 @@ + + + + + + + + + + + Mozilla Bug 1123516 + + + + + diff --git a/dom/bindings/test/test_bug1123875.html b/dom/bindings/test/test_bug1123875.html new file mode 100644 index 000000000..5658091c4 --- /dev/null +++ b/dom/bindings/test/test_bug1123875.html @@ -0,0 +1,14 @@ + + +Test for Bug 1123875 + + +
+ diff --git a/dom/bindings/test/test_bug1287912.html b/dom/bindings/test/test_bug1287912.html new file mode 100644 index 000000000..ae72b2316 --- /dev/null +++ b/dom/bindings/test/test_bug1287912.html @@ -0,0 +1,37 @@ + + + + + + Test for Bug 1287912 + + + + +Mozilla Bug 1287912 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_bug560072.html b/dom/bindings/test/test_bug560072.html new file mode 100644 index 000000000..82bb1c2c6 --- /dev/null +++ b/dom/bindings/test/test_bug560072.html @@ -0,0 +1,33 @@ + + + + + + Test for Bug 560072 + + + + +Mozilla Bug 560072 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_bug742191.html b/dom/bindings/test/test_bug742191.html new file mode 100644 index 000000000..b4b3151d7 --- /dev/null +++ b/dom/bindings/test/test_bug742191.html @@ -0,0 +1,36 @@ + + + + + + Test for invalid argument object + + + + +Mozilla Bug 742191 +

+
+
+
+ + diff --git a/dom/bindings/test/test_bug759621.html b/dom/bindings/test/test_bug759621.html new file mode 100644 index 000000000..602a0cd7c --- /dev/null +++ b/dom/bindings/test/test_bug759621.html @@ -0,0 +1,29 @@ + + + + + + Test for Bug 759621 + + + + +Mozilla Bug 759621 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_bug773326.html b/dom/bindings/test/test_bug773326.html new file mode 100644 index 000000000..2e3b1ea30 --- /dev/null +++ b/dom/bindings/test/test_bug773326.html @@ -0,0 +1,11 @@ + + +Test for Bug 773326 + + +
+ diff --git a/dom/bindings/test/test_bug775543.html b/dom/bindings/test/test_bug775543.html new file mode 100644 index 000000000..d8df05f63 --- /dev/null +++ b/dom/bindings/test/test_bug775543.html @@ -0,0 +1,37 @@ + + + + + + Test for Bug 775543 + + + + +Mozilla Bug 775543 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_bug788369.html b/dom/bindings/test/test_bug788369.html new file mode 100644 index 000000000..787bd28fe --- /dev/null +++ b/dom/bindings/test/test_bug788369.html @@ -0,0 +1,30 @@ + + + + + + Test for Bug 788369 + + + + +Mozilla Bug 788369 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_bug852846.html b/dom/bindings/test/test_bug852846.html new file mode 100644 index 000000000..0ca2c7dad --- /dev/null +++ b/dom/bindings/test/test_bug852846.html @@ -0,0 +1,34 @@ + + + + + + Test for Bug 852846 + + + + + +Mozilla Bug 852846 +

+ +
+
+ + diff --git a/dom/bindings/test/test_bug862092.html b/dom/bindings/test/test_bug862092.html new file mode 100644 index 000000000..4b0633328 --- /dev/null +++ b/dom/bindings/test/test_bug862092.html @@ -0,0 +1,37 @@ + + + + + + Test for Bug 862092 + + + + + +Mozilla Bug 862092 +

+ +
+
+ + diff --git a/dom/bindings/test/test_bug963382.html b/dom/bindings/test/test_bug963382.html new file mode 100644 index 000000000..f48d2e8b0 --- /dev/null +++ b/dom/bindings/test/test_bug963382.html @@ -0,0 +1,43 @@ + + + + + + Test for Bug 963382 + + + + + +Mozilla Bug 963382 +

+ +
+
+ + diff --git a/dom/bindings/test/test_callback_across_document_open.html b/dom/bindings/test/test_callback_across_document_open.html new file mode 100644 index 000000000..2a505cefa --- /dev/null +++ b/dom/bindings/test/test_callback_across_document_open.html @@ -0,0 +1,21 @@ + + +Test for callback invocation for a callback that comes from a + no-longer-current window that still has an active document. + + +
+ + diff --git a/dom/bindings/test/test_callback_default_thisval.html b/dom/bindings/test/test_callback_default_thisval.html new file mode 100644 index 000000000..d98ed87b2 --- /dev/null +++ b/dom/bindings/test/test_callback_default_thisval.html @@ -0,0 +1,36 @@ + + + + + + Test for Bug 957929 + + + + + +Mozilla Bug 957929 +

+ +
+
+ + diff --git a/dom/bindings/test/test_callback_exceptions.html b/dom/bindings/test/test_callback_exceptions.html new file mode 100644 index 000000000..a40b0b94f --- /dev/null +++ b/dom/bindings/test/test_callback_exceptions.html @@ -0,0 +1,17 @@ + + +Test for ... + + +
+ diff --git a/dom/bindings/test/test_cloneAndImportNode.html b/dom/bindings/test/test_cloneAndImportNode.html new file mode 100644 index 000000000..fc53c8747 --- /dev/null +++ b/dom/bindings/test/test_cloneAndImportNode.html @@ -0,0 +1,48 @@ + + + + + + Test for Bug 882541 + + + + + +Mozilla Bug 882541 +

+ +
+
+ + diff --git a/dom/bindings/test/test_crossOriginWindowSymbolAccess.html b/dom/bindings/test/test_crossOriginWindowSymbolAccess.html new file mode 100644 index 000000000..7808631b6 --- /dev/null +++ b/dom/bindings/test/test_crossOriginWindowSymbolAccess.html @@ -0,0 +1,23 @@ + + +Test for accessing symbols on a cross-origin window + + +
+ + diff --git a/dom/bindings/test/test_defineProperty.html b/dom/bindings/test/test_defineProperty.html new file mode 100644 index 000000000..f8f5f6283 --- /dev/null +++ b/dom/bindings/test/test_defineProperty.html @@ -0,0 +1,157 @@ + + + + + + Test for Bug 910220 + + + + +Mozilla Bug 910220 +

+ +
+
+ + + diff --git a/dom/bindings/test/test_document_location_set_via_xray.html b/dom/bindings/test/test_document_location_set_via_xray.html new file mode 100644 index 000000000..cdadc5063 --- /dev/null +++ b/dom/bindings/test/test_document_location_set_via_xray.html @@ -0,0 +1,49 @@ + + + + + + Test for Bug 905493 + + + + +Mozilla Bug 905493 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_document_location_via_xray_cached.html b/dom/bindings/test/test_document_location_via_xray_cached.html new file mode 100644 index 000000000..20eef10fb --- /dev/null +++ b/dom/bindings/test/test_document_location_via_xray_cached.html @@ -0,0 +1,36 @@ + + + + + + Test for Bug 1041731 + + + + +Mozilla Bug 1041731 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_domProxyArrayLengthGetter.html b/dom/bindings/test/test_domProxyArrayLengthGetter.html new file mode 100644 index 000000000..a62adff2e --- /dev/null +++ b/dom/bindings/test/test_domProxyArrayLengthGetter.html @@ -0,0 +1,28 @@ + + + + + + Test for Bug 1221421 + + + + + + + Mozilla Bug 1221421 + + diff --git a/dom/bindings/test/test_dom_xrays.html b/dom/bindings/test/test_dom_xrays.html new file mode 100644 index 000000000..0700db2f8 --- /dev/null +++ b/dom/bindings/test/test_dom_xrays.html @@ -0,0 +1,231 @@ + + + + + + Test for Bug 787070 + + + + +Mozilla Bug 787070 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_enums.html b/dom/bindings/test/test_enums.html new file mode 100644 index 000000000..e5dc519a0 --- /dev/null +++ b/dom/bindings/test/test_enums.html @@ -0,0 +1,15 @@ + + +Enums + + +
+ diff --git a/dom/bindings/test/test_exceptionSanitization.html b/dom/bindings/test/test_exceptionSanitization.html new file mode 100644 index 000000000..9a6ab6088 --- /dev/null +++ b/dom/bindings/test/test_exceptionSanitization.html @@ -0,0 +1,45 @@ + + + + + + Test for Bug 1295322 + + + + +Mozilla Bug 1295322 +

+ +
+
+ + + diff --git a/dom/bindings/test/test_exceptionThrowing.html b/dom/bindings/test/test_exceptionThrowing.html new file mode 100644 index 000000000..376c2bc57 --- /dev/null +++ b/dom/bindings/test/test_exceptionThrowing.html @@ -0,0 +1,56 @@ + + + + + + Test for Bug 847119 + + + + + +Mozilla Bug 847119 +

+ +
+
+ + diff --git a/dom/bindings/test/test_exception_messages.html b/dom/bindings/test/test_exception_messages.html new file mode 100644 index 000000000..a0f0cabe6 --- /dev/null +++ b/dom/bindings/test/test_exception_messages.html @@ -0,0 +1,82 @@ + + + + + + Test for Bug 882653 + + + + + +Mozilla Bug 882653 +

+ +
+
+ + diff --git a/dom/bindings/test/test_exception_options_from_jsimplemented.html b/dom/bindings/test/test_exception_options_from_jsimplemented.html new file mode 100644 index 000000000..8a98a8fb6 --- /dev/null +++ b/dom/bindings/test/test_exception_options_from_jsimplemented.html @@ -0,0 +1,166 @@ + + + + + + Test for Bug 1107592 + + + + + +Mozilla Bug 1107592 +

+ +
+
+ + diff --git a/dom/bindings/test/test_exceptions_from_jsimplemented.html b/dom/bindings/test/test_exceptions_from_jsimplemented.html new file mode 100644 index 000000000..d0f599353 --- /dev/null +++ b/dom/bindings/test/test_exceptions_from_jsimplemented.html @@ -0,0 +1,56 @@ + + + + + + Test for Bug 923010 + + + + + +Mozilla Bug 923010 +

+ +
+
+ + diff --git a/dom/bindings/test/test_forOf.html b/dom/bindings/test/test_forOf.html new file mode 100644 index 000000000..53969a23e --- /dev/null +++ b/dom/bindings/test/test_forOf.html @@ -0,0 +1,86 @@ + + + + + + Test for Bug 725907 + + + + +Mozilla Bug 725907 +

+ +
+ + + +
+
+
+
+
+
+
+ + diff --git a/dom/bindings/test/test_integers.html b/dom/bindings/test/test_integers.html new file mode 100644 index 000000000..c74b68216 --- /dev/null +++ b/dom/bindings/test/test_integers.html @@ -0,0 +1,50 @@ + + + + + + + + +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_interfaceName.html b/dom/bindings/test/test_interfaceName.html new file mode 100644 index 000000000..59828a2cf --- /dev/null +++ b/dom/bindings/test/test_interfaceName.html @@ -0,0 +1,28 @@ + + + + + + Test for Bug 1084001 + + + + + +Mozilla Bug 1084001 +

+ +
+
+ + diff --git a/dom/bindings/test/test_interfaceToString.html b/dom/bindings/test/test_interfaceToString.html new file mode 100644 index 000000000..c97b2f63b --- /dev/null +++ b/dom/bindings/test/test_interfaceToString.html @@ -0,0 +1,47 @@ + + + + + + Test for Bug 742156 + + + + +Mozilla Bug 742156 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_iterable.html b/dom/bindings/test/test_iterable.html new file mode 100644 index 000000000..8ce818e76 --- /dev/null +++ b/dom/bindings/test/test_iterable.html @@ -0,0 +1,241 @@ + + + + + Test Iterable Interface + + + + + + + diff --git a/dom/bindings/test/test_jsimplemented_eventhandler.html b/dom/bindings/test/test_jsimplemented_eventhandler.html new file mode 100644 index 000000000..2854a3112 --- /dev/null +++ b/dom/bindings/test/test_jsimplemented_eventhandler.html @@ -0,0 +1,47 @@ + + + + + + Test for Bug 1186696 + + + + + +Mozilla Bug 1186696 +

+ +
+
+ + diff --git a/dom/bindings/test/test_kill_longrunning_prerendered_content.xul b/dom/bindings/test/test_kill_longrunning_prerendered_content.xul new file mode 100644 index 000000000..d86b15ad9 --- /dev/null +++ b/dom/bindings/test/test_kill_longrunning_prerendered_content.xul @@ -0,0 +1,85 @@ + + + + + + + + + + +Mozilla Bug 1050456 +

+ +
+
+ + +
diff --git a/dom/bindings/test/test_lenientThis.html b/dom/bindings/test/test_lenientThis.html new file mode 100644 index 000000000..cfbdcebcd --- /dev/null +++ b/dom/bindings/test/test_lenientThis.html @@ -0,0 +1,27 @@ + + +[LenientThis] + + +
+ diff --git a/dom/bindings/test/test_lookupGetter.html b/dom/bindings/test/test_lookupGetter.html new file mode 100644 index 000000000..306ee4f64 --- /dev/null +++ b/dom/bindings/test/test_lookupGetter.html @@ -0,0 +1,49 @@ + + + + + Test for Bug 462428 + + + + +Mozilla Bug 462428 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_namedNoIndexed.html b/dom/bindings/test/test_namedNoIndexed.html new file mode 100644 index 000000000..205ec89f9 --- /dev/null +++ b/dom/bindings/test/test_namedNoIndexed.html @@ -0,0 +1,36 @@ + + + + + + Test for Bug 808991 + + + + +Mozilla Bug 808991 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_named_getter_enumerability.html b/dom/bindings/test/test_named_getter_enumerability.html new file mode 100644 index 000000000..641f78ab2 --- /dev/null +++ b/dom/bindings/test/test_named_getter_enumerability.html @@ -0,0 +1,40 @@ + + +Test for named getter enumerability + + +
+ diff --git a/dom/bindings/test/test_oom_reporting.html b/dom/bindings/test/test_oom_reporting.html new file mode 100644 index 000000000..7323736e5 --- /dev/null +++ b/dom/bindings/test/test_oom_reporting.html @@ -0,0 +1,42 @@ + + + + + + Test for Bug + + + + + +Mozilla Bug +

+ +
+
+ + diff --git a/dom/bindings/test/test_primitive_this.html b/dom/bindings/test/test_primitive_this.html new file mode 100644 index 000000000..d2b733dff --- /dev/null +++ b/dom/bindings/test/test_primitive_this.html @@ -0,0 +1,45 @@ + + + + + + Test for Bug 603201 + + + + + +
Test
+ + diff --git a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html new file mode 100644 index 000000000..5428030c5 --- /dev/null +++ b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html @@ -0,0 +1,143 @@ + + + + + + Test for Bug 1107592 + + + + + +Mozilla Bug 1107592 +

+ +
+
+ + diff --git a/dom/bindings/test/test_proxies_via_xray.html b/dom/bindings/test/test_proxies_via_xray.html new file mode 100644 index 000000000..59affe6c0 --- /dev/null +++ b/dom/bindings/test/test_proxies_via_xray.html @@ -0,0 +1,99 @@ + + + + + + Test for Bug 1021066 + + + + +Mozilla Bug 1021066 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_queryInterface.html b/dom/bindings/test/test_queryInterface.html new file mode 100644 index 000000000..076bf9e7d --- /dev/null +++ b/dom/bindings/test/test_queryInterface.html @@ -0,0 +1,41 @@ + + + + + + Test for Bug 827546 + + + + + +Mozilla Bug 827546 +

+ +
+
+ + diff --git a/dom/bindings/test/test_returnUnion.html b/dom/bindings/test/test_returnUnion.html new file mode 100644 index 000000000..5be10ba3c --- /dev/null +++ b/dom/bindings/test/test_returnUnion.html @@ -0,0 +1,59 @@ + + + + + + Test for Bug 1048659 + + + + + +Mozilla Bug 1048659 +

+ +
+
+ + diff --git a/dom/bindings/test/test_sequence_detection.html b/dom/bindings/test/test_sequence_detection.html new file mode 100644 index 000000000..80dfac4db --- /dev/null +++ b/dom/bindings/test/test_sequence_detection.html @@ -0,0 +1,53 @@ + + + + + + Test for Bug 1066432 + + + + + +Mozilla Bug 1066432 +

+ +
+
+ + diff --git a/dom/bindings/test/test_sequence_wrapping.html b/dom/bindings/test/test_sequence_wrapping.html new file mode 100644 index 000000000..7132e5601 --- /dev/null +++ b/dom/bindings/test/test_sequence_wrapping.html @@ -0,0 +1,59 @@ + + + + + + Test for Bug 775852 + + + + +Mozilla Bug 775852 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_setWithNamedGetterNoNamedSetter.html b/dom/bindings/test/test_setWithNamedGetterNoNamedSetter.html new file mode 100644 index 000000000..52f56151d --- /dev/null +++ b/dom/bindings/test/test_setWithNamedGetterNoNamedSetter.html @@ -0,0 +1,40 @@ + + + + + + Test for Bug 1043690 + + + + +Mozilla Bug 1043690 +

+ + +
+
+ + diff --git a/dom/bindings/test/test_stringBindings.html b/dom/bindings/test/test_stringBindings.html new file mode 100644 index 000000000..1895b0342 --- /dev/null +++ b/dom/bindings/test/test_stringBindings.html @@ -0,0 +1,59 @@ + + + + + + Test for Bug 1334537 + + + + + +Mozilla Bug 1334537 +

+ +
+
+ + diff --git a/dom/bindings/test/test_throwing_method_noDCE.html b/dom/bindings/test/test_throwing_method_noDCE.html new file mode 100644 index 000000000..e952819a8 --- /dev/null +++ b/dom/bindings/test/test_throwing_method_noDCE.html @@ -0,0 +1,27 @@ + + +Test that we don't DCE functions that can throw + + +
+ diff --git a/dom/bindings/test/test_traceProtos.html b/dom/bindings/test/test_traceProtos.html new file mode 100644 index 000000000..17a5cb96d --- /dev/null +++ b/dom/bindings/test/test_traceProtos.html @@ -0,0 +1,37 @@ + + + + + + Test for Bug 744772 + + + + +Mozilla Bug 744772 +

+ +
+
+
+ + diff --git a/dom/bindings/test/test_treat_non_object_as_null.html b/dom/bindings/test/test_treat_non_object_as_null.html new file mode 100644 index 000000000..fbb6ceb66 --- /dev/null +++ b/dom/bindings/test/test_treat_non_object_as_null.html @@ -0,0 +1,39 @@ + + + + + + Test for Bug 952365 + + + + + +Mozilla Bug 952365 +

+ +
+
+ + diff --git a/dom/bindings/test/test_unforgeablesonexpando.html b/dom/bindings/test/test_unforgeablesonexpando.html new file mode 100644 index 000000000..419e6ac7d --- /dev/null +++ b/dom/bindings/test/test_unforgeablesonexpando.html @@ -0,0 +1,18 @@ + + +Test for making sure named getters don't override the unforgeable location on HTMLDocument + + +
+ + diff --git a/dom/bindings/test/test_usvstring.html b/dom/bindings/test/test_usvstring.html new file mode 100644 index 000000000..cbb1e7971 --- /dev/null +++ b/dom/bindings/test/test_usvstring.html @@ -0,0 +1,41 @@ + + + + + Test USVString + + + + + + + diff --git a/dom/bindings/test/test_worker_UnwrapArg.html b/dom/bindings/test/test_worker_UnwrapArg.html new file mode 100644 index 000000000..1331a83f4 --- /dev/null +++ b/dom/bindings/test/test_worker_UnwrapArg.html @@ -0,0 +1,58 @@ + + + + + + Test for Bug 1127206 + + + + + +Mozilla Bug 1127206 +

+ +
+
+ + -- cgit v1.2.3