mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Cargoify servo
This commit is contained in:
parent
db2f642c32
commit
c6ab60dbfc
1761 changed files with 8423 additions and 2294 deletions
87
components/script/dom/bindings/codegen/test/Makefile.in
Normal file
87
components/script/dom/bindings/codegen/test/Makefile.in
Normal file
|
@ -0,0 +1,87 @@
|
|||
# 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/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = @relativesrcdir@
|
||||
|
||||
MODULE = dom
|
||||
LIBRARY_NAME = dombindings_test_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
# Do NOT export this library. We don't actually want our test code
|
||||
# being added to libxul or anything.
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
# Need this to find all our DOM source files.
|
||||
include $(topsrcdir)/dom/dom-config.mk
|
||||
|
||||
# And need this for $(test_webidl_files)
|
||||
include $(topsrcdir)/dom/webidl/WebIDL.mk
|
||||
|
||||
# But the webidl actually lives in our parent dir
|
||||
test_webidl_files := $(addprefix ../,$(test_webidl_files))
|
||||
|
||||
CPPSRCS := $(subst .webidl,Binding.cpp,$(test_webidl_files))
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/js/xpconnect/src \
|
||||
-I$(topsrcdir)/js/xpconnect/wrappers \
|
||||
-I$(topsrcdir)/dom/bindings \
|
||||
$(NULL)
|
||||
|
||||
|
||||
# If you change bindinggen_dependencies here, change it in
|
||||
# dom/bindings/Makefile.in too. But note that we include ../Makefile
|
||||
# here manually, since $(GLOBAL_DEPS) won't cover it.
|
||||
bindinggen_dependencies := \
|
||||
../BindingGen.py \
|
||||
../Bindings.conf \
|
||||
../Configuration.py \
|
||||
../Codegen.py \
|
||||
../parser/WebIDL.py \
|
||||
../ParserResults.pkl \
|
||||
../Makefile \
|
||||
$(GLOBAL_DEPS) \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_FILES := \
|
||||
test_bug773326.html \
|
||||
test_enums.html \
|
||||
test_integers.html \
|
||||
test_interfaceToString.html \
|
||||
test_lookupGetter.html \
|
||||
test_InstanceOf.html \
|
||||
test_traceProtos.html \
|
||||
test_forOf.html \
|
||||
forOf_iframe.html \
|
||||
test_sequence_wrapping.html \
|
||||
file_bug775543.html \
|
||||
test_bug788369.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_CHROME_FILES = \
|
||||
test_bug775543.html \
|
||||
$(NULL)
|
||||
|
||||
# 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
|
||||
|
||||
$(CPPSRCS): ../%Binding.cpp: $(bindinggen_dependencies) \
|
||||
../%.webidl \
|
||||
$(NULL)
|
||||
$(MAKE) -C .. $*Binding.h
|
||||
$(MAKE) -C .. $*Binding.cpp
|
||||
|
||||
check::
|
||||
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
|
||||
$(PLY_INCLUDE) $(srcdir)/../parser/runtests.py
|
||||
|
||||
check-interactive:
|
||||
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
|
||||
$(PLY_INCLUDE) $(srcdir)/../parser/runtests.py -q
|
653
components/script/dom/bindings/codegen/test/TestBindingHeader.h
Normal file
653
components/script/dom/bindings/codegen/test/TestBindingHeader.h
Normal file
|
@ -0,0 +1,653 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef TestBindingHeader_h
|
||||
#define TestBindingHeader_h
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
// We don't export TestCodeGenBinding.h, but it's right in our parent dir.
|
||||
#include "../TestCodeGenBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// IID for the TestNonCastableInterface
|
||||
#define NS_TEST_NONCASTABLE_INTERFACE_IID \
|
||||
{ 0x7c9f8ee2, 0xc9bf, 0x46ca, \
|
||||
{ 0xa0, 0xa9, 0x03, 0xa8, 0xd6, 0x30, 0x0e, 0xde } }
|
||||
|
||||
class TestNonCastableInterface : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEST_NONCASTABLE_INTERFACE_IID)
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// We need a GetParentObject to make binding codegen happy
|
||||
virtual nsISupports* GetParentObject();
|
||||
};
|
||||
|
||||
// IID for the 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();
|
||||
};
|
||||
|
||||
// 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
|
||||
};
|
||||
|
||||
// IID for the TestCallbackInterface
|
||||
#define NS_TEST_CALLBACK_INTERFACE_IID \
|
||||
{ 0xbf711ba4, 0xc8f6, 0x46cf, \
|
||||
{ 0xba, 0x5b, 0xaa, 0xe2, 0x78, 0x18, 0xe6, 0x4a } }
|
||||
class TestCallbackInterface : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TEST_CALLBACK_INTERFACE_IID)
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
|
||||
class TestNonWrapperCacheInterface : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* cx, JSObject* scope);
|
||||
};
|
||||
|
||||
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<TestInterface> Constructor(nsISupports*, ErrorResult&);
|
||||
static
|
||||
already_AddRefed<TestInterface> Constructor(nsISupports*, const nsAString&,
|
||||
ErrorResult&);
|
||||
static
|
||||
already_AddRefed<TestInterface> Constructor(nsISupports*, uint32_t,
|
||||
Nullable<bool>&, ErrorResult&);
|
||||
static
|
||||
already_AddRefed<TestInterface> Constructor(nsISupports*, TestInterface*,
|
||||
ErrorResult&);
|
||||
static
|
||||
already_AddRefed<TestInterface> Constructor(nsISupports*,
|
||||
TestNonCastableInterface&,
|
||||
ErrorResult&);
|
||||
/* static
|
||||
already_AddRefed<TestInterface> Constructor(nsISupports*,
|
||||
uint32_t, uint32_t,
|
||||
const TestInterfaceOrOnlyForUseInConstructor&,
|
||||
ErrorResult&);
|
||||
*/
|
||||
|
||||
// Integer types
|
||||
int8_t ReadonlyByte();
|
||||
int8_t WritableByte();
|
||||
void SetWritableByte(int8_t);
|
||||
void PassByte(int8_t);
|
||||
int8_t ReceiveByte();
|
||||
void PassOptionalByte(const Optional<int8_t>&);
|
||||
void PassOptionalByteWithDefault(int8_t);
|
||||
void PassNullableByte(Nullable<int8_t>&);
|
||||
void PassOptionalNullableByte(const Optional< Nullable<int8_t> >&);
|
||||
|
||||
int16_t ReadonlyShort();
|
||||
int16_t WritableShort();
|
||||
void SetWritableShort(int16_t);
|
||||
void PassShort(int16_t);
|
||||
int16_t ReceiveShort();
|
||||
void PassOptionalShort(const Optional<int16_t>&);
|
||||
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<int32_t>&);
|
||||
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<int64_t>&);
|
||||
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<uint8_t>&);
|
||||
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<uint16_t>&);
|
||||
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<uint32_t>&);
|
||||
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<uint64_t>&);
|
||||
void PassOptionalUnsignedLongLongWithDefault(uint64_t);
|
||||
|
||||
// Interface types
|
||||
already_AddRefed<TestInterface> ReceiveSelf();
|
||||
already_AddRefed<TestInterface> ReceiveNullableSelf();
|
||||
TestInterface* ReceiveWeakSelf();
|
||||
TestInterface* ReceiveWeakNullableSelf();
|
||||
void PassSelf(TestInterface&);
|
||||
void PassSelf2(NonNull<TestInterface>&);
|
||||
void PassNullableSelf(TestInterface*);
|
||||
already_AddRefed<TestInterface> NonNullSelf();
|
||||
void SetNonNullSelf(TestInterface&);
|
||||
already_AddRefed<TestInterface> GetNullableSelf();
|
||||
void SetNullableSelf(TestInterface*);
|
||||
void PassOptionalSelf(const Optional<TestInterface*> &);
|
||||
void PassOptionalNonNullSelf(const Optional<NonNull<TestInterface> >&);
|
||||
void PassOptionalSelfWithDefault(TestInterface*);
|
||||
|
||||
already_AddRefed<TestNonWrapperCacheInterface> ReceiveNonWrapperCacheInterface();
|
||||
already_AddRefed<TestNonWrapperCacheInterface> ReceiveNullableNonWrapperCacheInterface();
|
||||
void ReceiveNonWrapperCacheInterfaceSequence(nsTArray<nsRefPtr<TestNonWrapperCacheInterface> >&);
|
||||
void ReceiveNullableNonWrapperCacheInterfaceSequence(nsTArray<nsRefPtr<TestNonWrapperCacheInterface> >&);
|
||||
void ReceiveNonWrapperCacheInterfaceNullableSequence(Nullable<nsTArray<nsRefPtr<TestNonWrapperCacheInterface> > >&);
|
||||
void ReceiveNullableNonWrapperCacheInterfaceNullableSequence(Nullable<nsTArray<nsRefPtr<TestNonWrapperCacheInterface> > >&);
|
||||
|
||||
already_AddRefed<TestNonCastableInterface> ReceiveOther();
|
||||
already_AddRefed<TestNonCastableInterface> ReceiveNullableOther();
|
||||
TestNonCastableInterface* ReceiveWeakOther();
|
||||
TestNonCastableInterface* ReceiveWeakNullableOther();
|
||||
void PassOther(TestNonCastableInterface&);
|
||||
void PassOther2(NonNull<TestNonCastableInterface>&);
|
||||
void PassNullableOther(TestNonCastableInterface*);
|
||||
already_AddRefed<TestNonCastableInterface> NonNullOther();
|
||||
void SetNonNullOther(TestNonCastableInterface&);
|
||||
already_AddRefed<TestNonCastableInterface> GetNullableOther();
|
||||
void SetNullableOther(TestNonCastableInterface*);
|
||||
void PassOptionalOther(const Optional<TestNonCastableInterface*>&);
|
||||
void PassOptionalNonNullOther(const Optional<NonNull<TestNonCastableInterface> >&);
|
||||
void PassOptionalOtherWithDefault(TestNonCastableInterface*);
|
||||
|
||||
already_AddRefed<TestExternalInterface> ReceiveExternal();
|
||||
already_AddRefed<TestExternalInterface> ReceiveNullableExternal();
|
||||
TestExternalInterface* ReceiveWeakExternal();
|
||||
TestExternalInterface* ReceiveWeakNullableExternal();
|
||||
void PassExternal(TestExternalInterface*);
|
||||
void PassExternal2(TestExternalInterface*);
|
||||
void PassNullableExternal(TestExternalInterface*);
|
||||
already_AddRefed<TestExternalInterface> NonNullExternal();
|
||||
void SetNonNullExternal(TestExternalInterface*);
|
||||
already_AddRefed<TestExternalInterface> GetNullableExternal();
|
||||
void SetNullableExternal(TestExternalInterface*);
|
||||
void PassOptionalExternal(const Optional<TestExternalInterface*>&);
|
||||
void PassOptionalNonNullExternal(const Optional<TestExternalInterface*>&);
|
||||
void PassOptionalExternalWithDefault(TestExternalInterface*);
|
||||
|
||||
already_AddRefed<TestCallbackInterface> ReceiveCallbackInterface();
|
||||
already_AddRefed<TestCallbackInterface> ReceiveNullableCallbackInterface();
|
||||
TestCallbackInterface* ReceiveWeakCallbackInterface();
|
||||
TestCallbackInterface* ReceiveWeakNullableCallbackInterface();
|
||||
void PassCallbackInterface(TestCallbackInterface&);
|
||||
void PassCallbackInterface2(OwningNonNull<TestCallbackInterface>);
|
||||
void PassNullableCallbackInterface(TestCallbackInterface*);
|
||||
already_AddRefed<TestCallbackInterface> NonNullCallbackInterface();
|
||||
void SetNonNullCallbackInterface(TestCallbackInterface&);
|
||||
already_AddRefed<TestCallbackInterface> GetNullableCallbackInterface();
|
||||
void SetNullableCallbackInterface(TestCallbackInterface*);
|
||||
void PassOptionalCallbackInterface(const Optional<nsRefPtr<TestCallbackInterface> >&);
|
||||
void PassOptionalNonNullCallbackInterface(const Optional<OwningNonNull<TestCallbackInterface> >&);
|
||||
void PassOptionalCallbackInterfaceWithDefault(TestCallbackInterface*);
|
||||
|
||||
already_AddRefed<IndirectlyImplementedInterface> ReceiveConsequentialInterface();
|
||||
void PassConsequentialInterface(IndirectlyImplementedInterface&);
|
||||
|
||||
// Sequence types
|
||||
void ReceiveSequence(nsTArray<int32_t>&);
|
||||
void ReceiveNullableSequence(Nullable< nsTArray<int32_t> >&);
|
||||
void ReceiveSequenceOfNullableInts(nsTArray< Nullable<int32_t> >&);
|
||||
void ReceiveNullableSequenceOfNullableInts(Nullable< nsTArray< Nullable<int32_t> > >&);
|
||||
void PassSequence(const Sequence<int32_t> &);
|
||||
void PassNullableSequence(const Nullable< Sequence<int32_t> >&);
|
||||
void PassSequenceOfNullableInts(const Sequence<Nullable<int32_t> >&);
|
||||
void PassOptionalSequenceOfNullableInts(const Optional<Sequence<Nullable<int32_t> > > &);
|
||||
void PassOptionalNullableSequenceOfNullableInts(const Optional<Nullable<Sequence<Nullable<int32_t> > > > &);
|
||||
void ReceiveCastableObjectSequence(nsTArray< nsRefPtr<TestInterface> > &);
|
||||
void ReceiveNullableCastableObjectSequence(nsTArray< nsRefPtr<TestInterface> > &);
|
||||
void ReceiveCastableObjectNullableSequence(Nullable< nsTArray< nsRefPtr<TestInterface> > >&);
|
||||
void ReceiveNullableCastableObjectNullableSequence(Nullable< nsTArray< nsRefPtr<TestInterface> > >&);
|
||||
void ReceiveWeakCastableObjectSequence(nsTArray<TestInterface*> &);
|
||||
void ReceiveWeakNullableCastableObjectSequence(nsTArray<TestInterface*> &);
|
||||
void ReceiveWeakCastableObjectNullableSequence(Nullable< nsTArray<TestInterface*> >&);
|
||||
void ReceiveWeakNullableCastableObjectNullableSequence(Nullable< nsTArray<TestInterface*> >&);
|
||||
void PassCastableObjectSequence(const Sequence< OwningNonNull<TestInterface> >&);
|
||||
void PassNullableCastableObjectSequence(const Sequence< nsRefPtr<TestInterface> > &);
|
||||
void PassCastableObjectNullableSequence(const Nullable< Sequence< OwningNonNull<TestInterface> > >&);
|
||||
void PassNullableCastableObjectNullableSequence(const Nullable< Sequence< nsRefPtr<TestInterface> > >&);
|
||||
void PassOptionalSequence(const Optional<Sequence<int32_t> >&);
|
||||
void PassOptionalNullableSequence(const Optional<Nullable<Sequence<int32_t> > >&);
|
||||
void PassOptionalNullableSequenceWithDefaultValue(const Nullable< Sequence<int32_t> >&);
|
||||
void PassOptionalObjectSequence(const Optional<Sequence<OwningNonNull<TestInterface> > >&);
|
||||
|
||||
void ReceiveStringSequence(nsTArray<nsString>&);
|
||||
void PassStringSequence(const Sequence<nsString>&);
|
||||
|
||||
void ReceiveAnySequence(JSContext*, nsTArray<JS::Value>&);
|
||||
void ReceiveNullableAnySequence(JSContext*, Nullable<nsTArray<JS::Value> >);
|
||||
|
||||
// Typed array types
|
||||
void PassArrayBuffer(ArrayBuffer&);
|
||||
void PassNullableArrayBuffer(ArrayBuffer*);
|
||||
void PassOptionalArrayBuffer(const Optional<ArrayBuffer>&);
|
||||
void PassOptionalNullableArrayBuffer(const Optional<ArrayBuffer*>&);
|
||||
void PassOptionalNullableArrayBufferWithDefaultValue(ArrayBuffer*);
|
||||
void PassArrayBufferView(ArrayBufferView&);
|
||||
void PassInt8Array(Int8Array&);
|
||||
void PassInt16Array(Int16Array&);
|
||||
void PassInt32Array(Int32Array&);
|
||||
void PassUint8Array(Uint8Array&);
|
||||
void PassUint16Array(Uint16Array&);
|
||||
void PassUint32Array(Uint32Array&);
|
||||
void PassUint8ClampedArray(Uint8ClampedArray&);
|
||||
void PassFloat32Array(Float32Array&);
|
||||
void PassFloat64Array(Float64Array&);
|
||||
JSObject* ReceiveUint8Array(JSContext*);
|
||||
|
||||
// String types
|
||||
void PassString(const nsAString&);
|
||||
void PassNullableString(const nsAString&);
|
||||
void PassOptionalString(const Optional<nsAString>&);
|
||||
void PassOptionalStringWithDefaultValue(const nsAString&);
|
||||
void PassOptionalNullableString(const Optional<nsAString>&);
|
||||
void PassOptionalNullableStringWithDefaultValue(const nsAString&);
|
||||
|
||||
// Enumarated types
|
||||
void PassEnum(TestEnum);
|
||||
void PassOptionalEnum(const Optional<TestEnum>&);
|
||||
void PassEnumWithDefault(TestEnum);
|
||||
TestEnum ReceiveEnum();
|
||||
TestEnum EnumAttribute();
|
||||
TestEnum ReadonlyEnumAttribute();
|
||||
void SetEnumAttribute(TestEnum);
|
||||
|
||||
// Callback types
|
||||
void PassCallback(JSContext*, JSObject*);
|
||||
void PassNullableCallback(JSContext*, JSObject*);
|
||||
void PassOptionalCallback(JSContext*, const Optional<JSObject*>&);
|
||||
void PassOptionalNullableCallback(JSContext*, const Optional<JSObject*>&);
|
||||
void PassOptionalNullableCallbackWithDefaultValue(JSContext*, JSObject*);
|
||||
JSObject* ReceiveCallback(JSContext*);
|
||||
JSObject* ReceiveNullableCallback(JSContext*);
|
||||
|
||||
// Any types
|
||||
void PassAny(JSContext*, JS::Value);
|
||||
void PassOptionalAny(JSContext*, const Optional<JS::Value>&);
|
||||
void PassAnyDefaultNull(JSContext*, JS::Value);
|
||||
JS::Value ReceiveAny(JSContext*);
|
||||
|
||||
// object types
|
||||
void PassObject(JSContext*, JSObject&);
|
||||
void PassNullableObject(JSContext*, JSObject*);
|
||||
void PassOptionalObject(JSContext*, const Optional<NonNull<JSObject> >&);
|
||||
void PassOptionalNullableObject(JSContext*, const Optional<JSObject*>&);
|
||||
void PassOptionalNullableObjectWithDefaultValue(JSContext*, JSObject*);
|
||||
JSObject* ReceiveObject(JSContext*);
|
||||
JSObject* ReceiveNullableObject(JSContext*);
|
||||
|
||||
// Union types
|
||||
void PassUnion(JSContext*, const ObjectOrLong& arg);
|
||||
void PassUnionWithNullable(JSContext*, const ObjectOrNullOrLong& arg)
|
||||
{
|
||||
ObjectOrLong returnValue;
|
||||
if (arg.IsNull()) {
|
||||
} else if (arg.IsObject()) {
|
||||
JSObject& obj = (JSObject&)arg.GetAsObject();
|
||||
JS_GetClass(&obj);
|
||||
//returnValue.SetAsObject(&obj);
|
||||
} else {
|
||||
int32_t i = arg.GetAsLong();
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
void PassNullableUnion(JSContext*, const Nullable<ObjectOrLong>&);
|
||||
void PassOptionalUnion(JSContext*, const Optional<ObjectOrLong>&);
|
||||
void PassOptionalNullableUnion(JSContext*, const Optional<Nullable<ObjectOrLong> >&);
|
||||
void PassOptionalNullableUnionWithDefaultValue(JSContext*, const Nullable<ObjectOrLong>&);
|
||||
//void PassUnionWithInterfaces(const TestInterfaceOrTestExternalInterface& arg);
|
||||
//void PassUnionWithInterfacesAndNullable(const TestInterfaceOrNullOrTestExternalInterface& arg);
|
||||
void PassUnionWithArrayBuffer(const ArrayBufferOrLong&);
|
||||
void PassUnionWithString(JSContext*, const StringOrObject&);
|
||||
//void PassUnionWithEnum(JSContext*, const TestEnumOrObject&);
|
||||
void PassUnionWithCallback(JSContext*, const TestCallbackOrLong&);
|
||||
void PassUnionWithObject(JSContext*, const ObjectOrLong&);
|
||||
|
||||
// binaryNames tests
|
||||
void MethodRenamedTo();
|
||||
void MethodRenamedTo(int8_t);
|
||||
int8_t AttributeGetterRenamedTo();
|
||||
int8_t AttributeRenamedTo();
|
||||
void SetAttributeRenamedTo(int8_t);
|
||||
|
||||
// Dictionary tests
|
||||
void PassDictionary(const Dict&);
|
||||
void PassOtherDictionary(const GrandparentDict&);
|
||||
void PassSequenceOfDictionaries(const Sequence<Dict>&);
|
||||
void PassDictionaryOrLong(const Dict&);
|
||||
void PassDictionaryOrLong(int32_t);
|
||||
void PassDictContainingDict(const DictContainingDict&);
|
||||
void PassDictContainingSequence(const DictContainingSequence&);
|
||||
|
||||
// Typedefs
|
||||
void ExerciseTypedefInterfaces1(TestInterface&);
|
||||
already_AddRefed<TestInterface> ExerciseTypedefInterfaces2(TestInterface*);
|
||||
void ExerciseTypedefInterfaces3(TestInterface&);
|
||||
|
||||
// Miscellania
|
||||
int32_t AttrWithLenientThis();
|
||||
void SetAttrWithLenientThis(int32_t);
|
||||
|
||||
// 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);
|
||||
|
||||
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) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableByte(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassByte(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalByte(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalByteWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyShort(int16_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableShort(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassShort(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalShort(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalShortWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyLong(int32_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalLong(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalLongWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyLongLong(int64_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableLongLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassLongLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalLongLong(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalLongLongWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyOctet(uint8_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableOctet(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOctet(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalOctet(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalOctetWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyUnsignedShort(uint16_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableUnsignedShort(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassUnsignedShort(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedShort(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedShortWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyUnsignedLong(uint32_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableUnsignedLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassUnsignedLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedLong(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedLongWithDefault(T) MOZ_DELETE;
|
||||
|
||||
void SetReadonlyUnsignedLongLong(uint64_t) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void SetWritableUnsignedLongLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassUnsignedLongLong(T) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedLongLong(const Optional<T>&) MOZ_DELETE;
|
||||
template<typename T>
|
||||
void PassOptionalUnsignedLongLongWithDefault(T) MOZ_DELETE;
|
||||
|
||||
// Enforce that only const things are passed for sequences
|
||||
void PassSequence(Sequence<int32_t> &) MOZ_DELETE;
|
||||
void PassNullableSequence(Nullable< Sequence<int32_t> >&) MOZ_DELETE;
|
||||
void PassOptionalNullableSequenceWithDefaultValue(Nullable< Sequence<int32_t> >&) MOZ_DELETE;
|
||||
|
||||
// Enforce that only const things are passed for optional
|
||||
void PassOptionalByte(Optional<int8_t>&) MOZ_DELETE;
|
||||
void PassOptionalNullableByte(Optional<Nullable<int8_t> >&) MOZ_DELETE;
|
||||
void PassOptionalShort(Optional<int16_t>&) MOZ_DELETE;
|
||||
void PassOptionalLong(Optional<int32_t>&) MOZ_DELETE;
|
||||
void PassOptionalLongLong(Optional<int64_t>&) MOZ_DELETE;
|
||||
void PassOptionalOctet(Optional<uint8_t>&) MOZ_DELETE;
|
||||
void PassOptionalUnsignedShort(Optional<uint16_t>&) MOZ_DELETE;
|
||||
void PassOptionalUnsignedLong(Optional<uint32_t>&) MOZ_DELETE;
|
||||
void PassOptionalUnsignedLongLong(Optional<uint64_t>&) MOZ_DELETE;
|
||||
void PassOptionalSelf(Optional<TestInterface*> &) MOZ_DELETE;
|
||||
void PassOptionalNonNullSelf(Optional<NonNull<TestInterface> >&) MOZ_DELETE;
|
||||
void PassOptionalOther(Optional<TestNonCastableInterface*>&);
|
||||
void PassOptionalNonNullOther(Optional<NonNull<TestNonCastableInterface> >&);
|
||||
void PassOptionalExternal(Optional<TestExternalInterface*>&) MOZ_DELETE;
|
||||
void PassOptionalNonNullExternal(Optional<TestExternalInterface*>&) MOZ_DELETE;
|
||||
void PassOptionalSequence(Optional<Sequence<int32_t> >&) MOZ_DELETE;
|
||||
void PassOptionalNullableSequence(Optional<Nullable<Sequence<int32_t> > >&) MOZ_DELETE;
|
||||
void PassOptionalObjectSequence(Optional<Sequence<OwningNonNull<TestInterface> > >&) MOZ_DELETE;
|
||||
void PassOptionalArrayBuffer(Optional<ArrayBuffer>&) MOZ_DELETE;
|
||||
void PassOptionalNullableArrayBuffer(Optional<ArrayBuffer*>&) MOZ_DELETE;
|
||||
void PassOptionalEnum(Optional<TestEnum>&) MOZ_DELETE;
|
||||
void PassOptionalCallback(JSContext*, Optional<JSObject*>&) MOZ_DELETE;
|
||||
void PassOptionalNullableCallback(JSContext*, Optional<JSObject*>&) MOZ_DELETE;
|
||||
void PassOptionalAny(Optional<JS::Value>&) MOZ_DELETE;
|
||||
|
||||
// And test that string stuff is always const
|
||||
void PassString(nsAString&) MOZ_DELETE;
|
||||
void PassNullableString(nsAString&) MOZ_DELETE;
|
||||
void PassOptionalString(Optional<nsAString>&) MOZ_DELETE;
|
||||
void PassOptionalStringWithDefaultValue(nsAString&) MOZ_DELETE;
|
||||
void PassOptionalNullableString(Optional<nsAString>&) MOZ_DELETE;
|
||||
void PassOptionalNullableStringWithDefaultValue(nsAString&) MOZ_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&) MOZ_DELETE;
|
||||
uint32_t Item(uint32_t&);
|
||||
uint32_t Item(uint32_t, bool&) MOZ_DELETE;
|
||||
uint32_t Length();
|
||||
};
|
||||
|
||||
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&);
|
||||
};
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
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 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&);
|
||||
};
|
||||
|
||||
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&);
|
||||
void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
|
||||
void SetNamedItem(const nsAString&, TestIndexedSetterInterface&);
|
||||
};
|
||||
|
||||
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&) MOZ_DELETE;
|
||||
void NamedSetter(const nsAString&, const nsAString&);
|
||||
void Stringify(nsAString&);
|
||||
uint32_t Length();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* TestBindingHeader_h */
|
442
components/script/dom/bindings/codegen/test/TestCodeGen.webidl
Normal file
442
components/script/dom/bindings/codegen/test/TestCodeGen.webidl
Normal file
|
@ -0,0 +1,442 @@
|
|||
/* -*- 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;
|
||||
|
||||
interface TestExternalInterface;
|
||||
|
||||
interface TestNonCastableInterface {
|
||||
};
|
||||
|
||||
callback interface TestCallbackInterface {
|
||||
readonly attribute long foo;
|
||||
void doSomething();
|
||||
};
|
||||
|
||||
enum TestEnum {
|
||||
"a",
|
||||
"b"
|
||||
};
|
||||
|
||||
callback TestCallback = void();
|
||||
|
||||
TestInterface implements ImplementedInterface;
|
||||
|
||||
// This interface is only for use in the constructor below
|
||||
interface OnlyForUseInConstructor {
|
||||
};
|
||||
|
||||
[Constructor,
|
||||
Constructor(DOMString str),
|
||||
Constructor(unsigned long num, boolean? bool),
|
||||
Constructor(TestInterface? iface),
|
||||
Constructor(TestNonCastableInterface iface)
|
||||
// , Constructor(long arg1, long arg2, (TestInterface or OnlyForUseInConstructor) arg3)
|
||||
]
|
||||
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 passOptionalByteWithDefault(optional byte arg = 0);
|
||||
void passNullableByte(byte? arg);
|
||||
void passOptionalNullableByte(optional byte? arg);
|
||||
|
||||
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);
|
||||
|
||||
// Castable interface types
|
||||
// XXXbz add tests for throwing versions of all the castable interface stuff
|
||||
TestInterface receiveSelf();
|
||||
TestInterface? receiveNullableSelf();
|
||||
TestInterface receiveWeakSelf();
|
||||
TestInterface? receiveWeakNullableSelf();
|
||||
// A verstion to test for casting to TestInterface&
|
||||
void passSelf(TestInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passSelf2(TestInterface arg);
|
||||
void passNullableSelf(TestInterface? arg);
|
||||
attribute TestInterface nonNullSelf;
|
||||
attribute TestInterface? nullableSelf;
|
||||
// Optional arguments
|
||||
void passOptionalSelf(optional TestInterface? arg);
|
||||
void passOptionalNonNullSelf(optional TestInterface arg);
|
||||
void passOptionalSelfWithDefault(optional TestInterface? arg = null);
|
||||
|
||||
// Non-wrapper-cache interface types
|
||||
[Creator]
|
||||
TestNonWrapperCacheInterface receiveNonWrapperCacheInterface();
|
||||
[Creator]
|
||||
TestNonWrapperCacheInterface? receiveNullableNonWrapperCacheInterface();
|
||||
[Creator]
|
||||
sequence<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
|
||||
[Creator]
|
||||
sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
|
||||
[Creator]
|
||||
sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
|
||||
[Creator]
|
||||
sequence<TestNonWrapperCacheInterface?>? receiveNullableNonWrapperCacheInterfaceNullableSequence();
|
||||
|
||||
// Non-castable interface types
|
||||
TestNonCastableInterface receiveOther();
|
||||
TestNonCastableInterface? receiveNullableOther();
|
||||
TestNonCastableInterface receiveWeakOther();
|
||||
TestNonCastableInterface? receiveWeakNullableOther();
|
||||
// A verstion to test for casting to TestNonCastableInterface&
|
||||
void passOther(TestNonCastableInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passOther2(TestNonCastableInterface arg);
|
||||
void passNullableOther(TestNonCastableInterface? arg);
|
||||
attribute TestNonCastableInterface nonNullOther;
|
||||
attribute TestNonCastableInterface? nullableOther;
|
||||
// Optional arguments
|
||||
void passOptionalOther(optional TestNonCastableInterface? arg);
|
||||
void passOptionalNonNullOther(optional TestNonCastableInterface arg);
|
||||
void passOptionalOtherWithDefault(optional TestNonCastableInterface? arg = null);
|
||||
|
||||
// External interface types
|
||||
TestExternalInterface receiveExternal();
|
||||
TestExternalInterface? receiveNullableExternal();
|
||||
TestExternalInterface receiveWeakExternal();
|
||||
TestExternalInterface? receiveWeakNullableExternal();
|
||||
// A verstion to test for casting to TestExternalInterface&
|
||||
void passExternal(TestExternalInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passExternal2(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();
|
||||
// A verstion to test for casting to TestCallbackInterface&
|
||||
void passCallbackInterface(TestCallbackInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passCallbackInterface2(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
|
||||
sequence<long> receiveSequence();
|
||||
sequence<long>? receiveNullableSequence();
|
||||
sequence<long?> receiveSequenceOfNullableInts();
|
||||
sequence<long?>? receiveNullableSequenceOfNullableInts();
|
||||
void passSequence(sequence<long> arg);
|
||||
void passNullableSequence(sequence<long>? arg);
|
||||
void passSequenceOfNullableInts(sequence<long?> arg);
|
||||
void passOptionalSequenceOfNullableInts(optional sequence<long?> arg);
|
||||
void passOptionalNullableSequenceOfNullableInts(optional sequence<long?>? arg);
|
||||
sequence<TestInterface> receiveCastableObjectSequence();
|
||||
sequence<TestInterface?> receiveNullableCastableObjectSequence();
|
||||
sequence<TestInterface>? receiveCastableObjectNullableSequence();
|
||||
sequence<TestInterface?>? receiveNullableCastableObjectNullableSequence();
|
||||
sequence<TestInterface> receiveWeakCastableObjectSequence();
|
||||
sequence<TestInterface?> receiveWeakNullableCastableObjectSequence();
|
||||
sequence<TestInterface>? receiveWeakCastableObjectNullableSequence();
|
||||
sequence<TestInterface?>? receiveWeakNullableCastableObjectNullableSequence();
|
||||
void passCastableObjectSequence(sequence<TestInterface> arg);
|
||||
void passNullableCastableObjectSequence(sequence<TestInterface?> arg);
|
||||
void passCastableObjectNullableSequence(sequence<TestInterface>? arg);
|
||||
void passNullableCastableObjectNullableSequence(sequence<TestInterface?>? arg);
|
||||
void passOptionalSequence(optional sequence<long> arg);
|
||||
void passOptionalNullableSequence(optional sequence<long>? arg);
|
||||
void passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
|
||||
void passOptionalObjectSequence(optional sequence<TestInterface> arg);
|
||||
|
||||
sequence<DOMString> receiveStringSequence();
|
||||
void passStringSequence(sequence<DOMString> arg);
|
||||
|
||||
sequence<any> receiveAnySequence();
|
||||
sequence<any>? receiveNullableAnySequence();
|
||||
|
||||
// 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);
|
||||
Uint8Array receiveUint8Array();
|
||||
|
||||
// String 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);
|
||||
|
||||
// Enumerated types
|
||||
void passEnum(TestEnum arg);
|
||||
// No support for nullable enums yet
|
||||
// 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);
|
||||
TestEnum receiveEnum();
|
||||
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();
|
||||
|
||||
// Any types
|
||||
void passAny(any arg);
|
||||
void passOptionalAny(optional any arg);
|
||||
void passAnyDefaultNull(optional any arg = null);
|
||||
any receiveAny();
|
||||
|
||||
// object types
|
||||
void passObject(object arg);
|
||||
void passNullableObject(object? arg);
|
||||
void passOptionalObject(optional object arg);
|
||||
void passOptionalNullableObject(optional object? arg);
|
||||
void passOptionalNullableObjectWithDefaultValue(optional object? arg = null);
|
||||
object receiveObject();
|
||||
object? receiveNullableObject();
|
||||
|
||||
// Union types
|
||||
void passUnion((object or long) arg);
|
||||
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<object> or long) arg);
|
||||
void passUnionWithArrayBuffer((ArrayBuffer or long) arg);
|
||||
void passUnionWithString((DOMString or object) arg);
|
||||
//void passUnionWithEnum((TestEnum or object) arg);
|
||||
void passUnionWithCallback((TestCallback or long) arg);
|
||||
void passUnionWithObject((object or long) arg);
|
||||
//void passUnionWithDict((Dict or long) arg);
|
||||
|
||||
// binaryNames tests
|
||||
void methodRenamedFrom();
|
||||
void methodRenamedFrom(byte argument);
|
||||
readonly attribute byte attributeGetterRenamedFrom;
|
||||
attribute byte attributeRenamedFrom;
|
||||
|
||||
void passDictionary(optional Dict x);
|
||||
void passOtherDictionary(optional GrandparentDict x);
|
||||
void passSequenceOfDictionaries(sequence<Dict> x);
|
||||
void passDictionaryOrLong(optional Dict x);
|
||||
void passDictionaryOrLong(long x);
|
||||
|
||||
void passDictContainingDict(optional DictContainingDict arg);
|
||||
void passDictContainingSequence(optional DictContainingSequence arg);
|
||||
|
||||
// EnforceRange/Clamp tests
|
||||
void dontEnforceRangeOrClamp(byte arg);
|
||||
void doEnforceRange([EnforceRange] byte arg);
|
||||
void doClamp([Clamp] byte arg);
|
||||
|
||||
// Typedefs
|
||||
const myLong myLongConstant = 5;
|
||||
void exerciseTypedefInterfaces1(AnotherNameForTestInterface arg);
|
||||
AnotherNameForTestInterface exerciseTypedefInterfaces2(NullableTestInterface arg);
|
||||
void exerciseTypedefInterfaces3(YetAnotherNameForTestInterface arg);
|
||||
|
||||
// Miscellania
|
||||
[LenientThis] attribute long attrWithLenientThis;
|
||||
};
|
||||
|
||||
interface TestNonWrapperCacheInterface {
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
interface ImplementedInterface : ImplementedInterfaceParent {
|
||||
void implementedMethod();
|
||||
attribute boolean implementedProperty;
|
||||
|
||||
const long implementedConstant = 5;
|
||||
};
|
||||
|
||||
interface DiamondImplements {
|
||||
readonly attribute long diamondImplementedProperty;
|
||||
};
|
||||
interface DiamondBranch1A {
|
||||
};
|
||||
interface DiamondBranch1B {
|
||||
};
|
||||
interface DiamondBranch2A : DiamondImplements {
|
||||
};
|
||||
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;
|
||||
DOMString str;
|
||||
DOMString empty = "";
|
||||
TestEnum otherEnum = "b";
|
||||
DOMString otherStr = "def";
|
||||
DOMString? yetAnotherStr = null;
|
||||
};
|
||||
|
||||
dictionary ParentDict : GrandparentDict {
|
||||
long c = 5;
|
||||
TestInterface someInterface;
|
||||
TestExternalInterface someExternalInterface;
|
||||
};
|
||||
|
||||
dictionary DictContainingDict {
|
||||
Dict memberDict;
|
||||
};
|
||||
|
||||
dictionary DictContainingSequence {
|
||||
sequence<long> ourSequence;
|
||||
};
|
||||
|
||||
interface TestIndexedGetterInterface {
|
||||
getter long item(unsigned long index);
|
||||
[Infallible]
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface TestNamedGetterInterface {
|
||||
getter DOMString (DOMString name);
|
||||
};
|
||||
|
||||
interface TestIndexedAndNamedGetterInterface {
|
||||
getter long (unsigned long index);
|
||||
getter DOMString namedItem(DOMString name);
|
||||
[Infallible]
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface TestIndexedSetterInterface {
|
||||
setter creator void setItem(unsigned long index, DOMString item);
|
||||
};
|
||||
|
||||
interface TestNamedSetterInterface {
|
||||
setter creator void (DOMString name, TestIndexedSetterInterface item);
|
||||
};
|
||||
|
||||
interface TestIndexedAndNamedSetterInterface {
|
||||
setter creator void (unsigned long index, TestIndexedSetterInterface item);
|
||||
setter creator void setNamedItem(DOMString name, TestIndexedSetterInterface item);
|
||||
};
|
||||
|
||||
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);
|
||||
[Infallible]
|
||||
stringifier DOMString ();
|
||||
[Infallible]
|
||||
readonly attribute unsigned long length;
|
||||
};
|
|
@ -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;
|
||||
};
|
|
@ -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;
|
|
@ -0,0 +1,5 @@
|
|||
<body>
|
||||
<script>
|
||||
worker = new Worker("a");
|
||||
</script>
|
||||
</body>
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>iframe content for test_forOf_iframe.html</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="basket">
|
||||
<span id="egg0"></span>
|
||||
<span id="egg1"><span id="duckling1"></span></span>
|
||||
<span id="egg2"></span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=748983
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 748983</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=748983">Mozilla Bug 748983</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 748983 **/
|
||||
ok(document instanceof EventTarget, "document is an event target")
|
||||
ok(new XMLHttpRequest() instanceof XMLHttpRequest, "instanceof should work on XHR");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test for Bug 773326</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
new Worker("data:text/javascript,new XMLHttpRequest(42)");
|
||||
}, "Should not crash")
|
||||
</script>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=775543
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 775543</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=775543">Mozilla Bug 775543</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_bug775543.html" onload="test();"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 775543 **/
|
||||
|
||||
function test()
|
||||
{
|
||||
var a = XPCNativeWrapper(document.getElementById("t").contentWindow.wrappedJSObject.worker);
|
||||
isnot(XPCNativeWrapper.unwrap(a), a, "XPCNativeWrapper(Worker) should be an Xray wrapper");
|
||||
a.toString();
|
||||
ok(true, "Shouldn't crash when calling a method on an Xray wrapper around a worker");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=788369
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 788369</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=788369">Mozilla Bug 788369</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 788369 **/
|
||||
try {
|
||||
var xhr = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP");
|
||||
ok(xhr instanceof XMLHttpRequest, "Should have an XHR object");
|
||||
} catch (e) {
|
||||
ok(false, "Should not throw exception when constructing: " + e);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
15
components/script/dom/bindings/codegen/test/test_enums.html
Normal file
15
components/script/dom/bindings/codegen/test/test_enums.html
Normal file
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Enums</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("get", "foo")
|
||||
assert_equals(xhr.responseType, "");
|
||||
xhr.responseType = "foo";
|
||||
assert_equals(xhr.responseType, "");
|
||||
}, "Assigning an invalid value to an enum attribute should not throw.");
|
||||
</script>
|
94
components/script/dom/bindings/codegen/test/test_forOf.html
Normal file
94
components/script/dom/bindings/codegen/test/test_forOf.html
Normal file
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=725907
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 725907</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=725907">Mozilla Bug 725907</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<div id="basket">
|
||||
<span id="egg0"></span>
|
||||
<span id="egg1"><span id="duckling1"></span></span>
|
||||
<span id="egg2"></span>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 725907 **/
|
||||
|
||||
function runTestsForDocument(document, msgSuffix) {
|
||||
function is(a, b, msg) { SimpleTest.is(a, b, msg + msgSuffix); }
|
||||
function isnot(a, b, msg) { SimpleTest.isnot(a, b, msg + msgSuffix); }
|
||||
|
||||
var basket = document.getElementById("basket");
|
||||
var egg3 = document.createElement("span");
|
||||
egg3.id = "egg3";
|
||||
|
||||
var log = '';
|
||||
for (var x of basket.childNodes) {
|
||||
if (x.nodeType != x.TEXT_NODE)
|
||||
log += x.id + ";";
|
||||
}
|
||||
is(log, "egg0;egg1;egg2;", "'for (x of div.childNodes)' should iterate over child nodes");
|
||||
|
||||
log = '';
|
||||
for (var x of basket.childNodes) {
|
||||
if (x.nodeType != x.TEXT_NODE) {
|
||||
log += x.id + ";";
|
||||
if (x.id == "egg1")
|
||||
basket.appendChild(egg3);
|
||||
}
|
||||
}
|
||||
is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.childNodes)' should see elements added during iteration");
|
||||
|
||||
var iter1 = basket.childNodes.iterator();
|
||||
var iter2 = basket.childNodes.iterator();
|
||||
isnot(iter1, iter2, "nodelist.iterator() returns a new iterator each time");
|
||||
|
||||
log = '';
|
||||
basket.appendChild(document.createTextNode("some text"));
|
||||
for (var x of basket.children)
|
||||
log += x.id + ";";
|
||||
is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.children)' should iterate over child elements");
|
||||
|
||||
var iter1 = basket.children.iterator();
|
||||
var iter2 = basket.children.iterator();
|
||||
isnot(iter1, iter2, ".iterator() returns a new iterator each time");
|
||||
|
||||
var count = 0;
|
||||
for (var x of document.getElementsByClassName("hazardous-materials"))
|
||||
count++;
|
||||
is(count, 0, "'for (x of emptyNodeList)' loop should run zero times");
|
||||
|
||||
var log = '';
|
||||
for (var x of document.querySelectorAll("span"))
|
||||
log += x.id + ";";
|
||||
is(log, "egg0;egg1;duckling1;egg2;egg3;", "for-of loop should work with a querySelectorAll() NodeList");
|
||||
}
|
||||
|
||||
/* All the tests run twice. First, in this document, so without any wrappers. */
|
||||
runTestsForDocument(document, "");
|
||||
|
||||
/* And once using the document of an iframe, so working with cross-compartment wrappers. */
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
function iframeLoaded(iframe) {
|
||||
runTestsForDocument(iframe.contentWindow.document, " (in iframe)");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<iframe src="forOf_iframe.html" onload="iframeLoaded(this)"></iframe>
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<canvas id="c" width="1" height="1"></canvas>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
function testInt64NonFinite(arg) {
|
||||
// We can use a WebGLRenderingContext to test conversion to 64-bit signed
|
||||
// ints edge cases.
|
||||
try {
|
||||
var gl = $("c").getContext("experimental-webgl");
|
||||
} catch (ex) {
|
||||
// No WebGL support on MacOS 10.5. Just skip this test
|
||||
todo(false, "WebGL not supported");
|
||||
return;
|
||||
}
|
||||
is(gl.getError(), 0, "Should not start in an error state");
|
||||
|
||||
var b = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, b);
|
||||
|
||||
var a = new Float32Array(1);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, a, gl.STATIC_DRAW);
|
||||
|
||||
gl.bufferSubData(gl.ARRAY_BUFFER, arg, a);
|
||||
|
||||
is(gl.getError(), 0, "Should have treated non-finite double as 0");
|
||||
}
|
||||
|
||||
testInt64NonFinite(NaN);
|
||||
testInt64NonFinite(Infinity);
|
||||
testInt64NonFinite(-Infinity);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=742156
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 742156</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=742156">Mozilla Bug 742156</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 742156 **/
|
||||
|
||||
var nativeToString = ("" + String.replace).replace("replace", "EventTarget");
|
||||
try {
|
||||
var eventTargetToString = "" + EventTarget;
|
||||
is(eventTargetToString, nativeToString,
|
||||
"Stringifying a DOM interface object should return the same string" +
|
||||
"as stringifying a native function.");
|
||||
}
|
||||
catch (e) {
|
||||
ok(false, "Stringifying a DOM interface object shouldn't throw.");
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=462428
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 462428</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462428">Mozilla Bug 462428</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 462428 **/
|
||||
var x = new XMLHttpRequest;
|
||||
x.open("GET", "");
|
||||
var getter = x.__lookupGetter__('readyState');
|
||||
ok(getter !== undefined, "But able to look it up the normal way");
|
||||
ok(!x.hasOwnProperty('readyState'), "property should still be on the prototype");
|
||||
|
||||
var sawProp = false;
|
||||
for (var i in x) {
|
||||
if (i === "readyState") {
|
||||
sawProp = true;
|
||||
}
|
||||
}
|
||||
|
||||
ok(sawProp, "property should be enumerable");
|
||||
|
||||
is(getter.call(x), 1, "the getter actually works");
|
||||
|
||||
Object.getPrototypeOf(x).__defineSetter__('readyState', function() {});
|
||||
is(getter.call(x), 1, "the getter works after defineSetter");
|
||||
|
||||
is(x.responseType, "", "Should have correct responseType up front");
|
||||
var setter = x.__lookupSetter__('responseType');
|
||||
setter.call(x, "document");
|
||||
is(x.responseType, "document", "the setter is bound correctly");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=775852
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 775852</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=775852">Mozilla Bug 775852</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<canvas width="1" height="1" id="c"></canvas>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 775852 **/
|
||||
function doTest() {
|
||||
try {
|
||||
var gl = $("c").getContext("experimental-webgl");
|
||||
} catch (e) {
|
||||
// No WebGL support on MacOS 10.5. Just skip this test
|
||||
todo(false, "WebGL not supported");
|
||||
return;
|
||||
}
|
||||
var setterCalled = false;
|
||||
|
||||
extLength = gl.getSupportedExtensions().length;
|
||||
ok(extLength > 0,
|
||||
"This test won't work right if we have no supported extensions");
|
||||
|
||||
Object.defineProperty(Array.prototype, "0",
|
||||
{
|
||||
set: function(val) {
|
||||
setterCalled = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Test that our property got defined correctly
|
||||
var arr = []
|
||||
arr[0] = 5;
|
||||
is(setterCalled, true, "Setter should be called when setting prop on array");
|
||||
|
||||
setterCalled = false;
|
||||
|
||||
is(gl.getSupportedExtensions().length, extLength,
|
||||
"We should still have the same number of extensions");
|
||||
|
||||
is(setterCalled, false,
|
||||
"Setter should not be called when getting supported extensions");
|
||||
}
|
||||
doTest();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=744772
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 744772</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=744772">Mozilla Bug 744772</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 744772 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function callback() {
|
||||
new XMLHttpRequest().upload;
|
||||
ok(true, "Accessing unreferenced DOM interface objects shouldn't crash");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
delete window.XMLHttpRequestUpload;
|
||||
SpecialPowers.exactGC(window, callback);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue