Remove, fix and clean up automated tests.

This commit is contained in:
Fedor 2020-06-21 01:27:47 +03:00 committed by Fedor
parent d00cbd1471
commit 1b4a31b5d9
161 changed files with 1 additions and 18321 deletions

View File

@ -62,8 +62,6 @@ support-files = ../file_bug357450.js
[test_bug1139964.xul]
[test_bug1209621.xul]
[test_cpows.xul]
[test_custom_element_content.xul]
[test_custom_element_ep.xul]
[test_domparsing.xul]
[test_fileconstructor.xul]
[test_fileconstructor_tempfile.xul]

View File

@ -630,7 +630,6 @@ skip-if = toolkit == 'android' #bug 904183
[test_document.all_unqualified.html]
[test_document_constructor.html]
[test_document_importNode_document.html]
[test_custom_element.html]
[test_domcursor.html]
[test_domparser_null_char.html]
[test_domparsing.html]
@ -698,7 +697,6 @@ skip-if = (os != 'android') # meta-viewport tag support is mobile-only
skip-if = toolkit == 'android' #TIMED_OUT
[test_mozMatchesSelector.html]
[test_mutationobserver_anonymous.html]
[test_mutationobservers.html]
[test_named_frames.html]
[test_navigator_hardwareConcurrency.html]
[test_navigator_language.html]

View File

@ -4,8 +4,6 @@
# 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/.
TEST_DIRS += ['test']
XPIDL_SOURCES += [
'nsIScriptError.idl'
]
@ -104,33 +102,6 @@ SOURCES += [
'WebIDLGlobalNameHash.cpp',
]
# Tests for maplike and setlike require bindings to be built, which means they
# must be included in libxul. This breaks the "no test classes are exported"
# rule stated in the test/ directory, but it's the only way this will work.
# Test classes are only built in debug mode, and all tests requiring use of
# them are only run in debug mode.
if CONFIG['MOZ_DEBUG']:
EXPORTS.mozilla.dom += [
"test/TestFunctions.h",
"test/TestInterfaceIterableDouble.h",
"test/TestInterfaceIterableDoubleUnion.h",
"test/TestInterfaceIterableSingle.h",
"test/TestInterfaceMaplike.h",
"test/TestInterfaceMaplikeObject.h",
"test/TestInterfaceSetlike.h",
"test/TestInterfaceSetlikeNode.h"
]
UNIFIED_SOURCES += [
"test/TestFunctions.cpp",
"test/TestInterfaceIterableDouble.cpp",
"test/TestInterfaceIterableDoubleUnion.cpp",
"test/TestInterfaceIterableSingle.cpp",
"test/TestInterfaceMaplike.cpp",
"test/TestInterfaceMaplikeObject.cpp",
"test/TestInterfaceSetlike.cpp",
"test/TestInterfaceSetlikeNode.cpp",
]
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']:

View File

@ -1,21 +0,0 @@
# 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

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
/* -*- 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<JSObject*> 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

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +0,0 @@
/* -*- 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;
};

View File

@ -1,815 +0,0 @@
/* -*- 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<Dict> seq, optional any any2,
optional object obj3, optional object? obj4),
NamedConstructor=Example2((long or MozMap<any>) 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<float> arg9, sequence<unrestricted float> arg10,
sequence<float?> arg11, sequence<unrestricted float?> arg12,
sequence<double> arg13, sequence<unrestricted double> arg14,
sequence<double?> arg15, sequence<unrestricted double?> 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<float> arg9,
sequence<unrestricted float> arg10,
sequence<float?> arg11,
sequence<unrestricted float?> arg12,
sequence<double> arg13,
sequence<unrestricted double> arg14,
sequence<double?> arg15,
sequence<unrestricted double?> 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<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface?>? 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<long> readonlySequence;
[Cached, Pure]
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
[Cached, Pure]
readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
[Cached, Pure, Frozen]
readonly attribute sequence<long> readonlyFrozenSequence;
[Cached, Pure, Frozen]
readonly attribute sequence<long>? readonlyFrozenNullableSequence;
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<TestCallbackInterface> receiveCallbackObjectSequence();
sequence<TestInterface?> receiveNullableCastableObjectSequence();
sequence<TestCallbackInterface?> receiveNullableCallbackObjectSequence();
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 passOptionalSequenceWithDefaultValue(optional sequence<long> arg = []);
void passOptionalNullableSequence(optional sequence<long>? arg);
void passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
void passOptionalNullableSequenceWithDefaultValue2(optional sequence<long>? arg = []);
void passOptionalObjectSequence(optional sequence<TestInterface> arg);
void passExternalInterfaceSequence(sequence<TestExternalInterface> arg);
void passNullableExternalInterfaceSequence(sequence<TestExternalInterface?> arg);
sequence<DOMString> receiveStringSequence();
void passStringSequence(sequence<DOMString> arg);
sequence<ByteString> receiveByteStringSequence();
void passByteStringSequence(sequence<ByteString> arg);
sequence<any> receiveAnySequence();
sequence<any>? receiveNullableAnySequence();
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<any>> receiveAnySequenceSequence();
sequence<object> receiveObjectSequence();
sequence<object?> receiveNullableObjectSequence();
void passSequenceOfSequences(sequence<sequence<long>> arg);
void passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<long>> receiveSequenceOfSequences();
// MozMap types
void passMozMap(MozMap<long> arg);
void passNullableMozMap(MozMap<long>? arg);
void passMozMapOfNullableInts(MozMap<long?> arg);
void passOptionalMozMapOfNullableInts(optional MozMap<long?> arg);
void passOptionalNullableMozMapOfNullableInts(optional MozMap<long?>? arg);
void passCastableObjectMozMap(MozMap<TestInterface> arg);
void passNullableCastableObjectMozMap(MozMap<TestInterface?> arg);
void passCastableObjectNullableMozMap(MozMap<TestInterface>? arg);
void passNullableCastableObjectNullableMozMap(MozMap<TestInterface?>? arg);
void passOptionalMozMap(optional MozMap<long> arg);
void passOptionalNullableMozMap(optional MozMap<long>? arg);
void passOptionalNullableMozMapWithDefaultValue(optional MozMap<long>? arg = null);
void passOptionalObjectMozMap(optional MozMap<TestInterface> arg);
void passExternalInterfaceMozMap(MozMap<TestExternalInterface> arg);
void passNullableExternalInterfaceMozMap(MozMap<TestExternalInterface?> arg);
void passStringMozMap(MozMap<DOMString> arg);
void passByteStringMozMap(MozMap<ByteString> arg);
void passMozMapOfMozMaps(MozMap<MozMap<long>> arg);
MozMap<long> receiveMozMap();
MozMap<long>? receiveNullableMozMap();
MozMap<long?> receiveMozMapOfNullableInts();
MozMap<long?>? receiveNullableMozMapOfNullableInts();
//XXXbz No support for MozMap of MozMaps return values yet.
//MozMap<MozMap<long>> receiveMozMapOfMozMaps();
MozMap<any> 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<ArrayBuffer> arg);
void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> 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<any> arg);
void passNullableSequenceOfAny(sequence<any>? arg);
void passOptionalSequenceOfAny(optional sequence<any> arg);
void passOptionalNullableSequenceOfAny(optional sequence<any>? arg);
void passOptionalSequenceOfAnyWithDefaultValue(optional sequence<any>? arg = null);
void passSequenceOfSequenceOfAny(sequence<sequence<any>> arg);
void passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
void passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
void passMozMapOfAny(MozMap<any> arg);
void passNullableMozMapOfAny(MozMap<any>? arg);
void passOptionalMozMapOfAny(optional MozMap<any> arg);
void passOptionalNullableMozMapOfAny(optional MozMap<any>? arg);
void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap<any>? arg = null);
void passMozMapOfMozMapOfAny(MozMap<MozMap<any>> arg);
void passMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?> arg);
void passNullableMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?>? arg);
void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap<MozMap<any>?>? arg);
void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap<sequence<any>?>? arg);
void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence<MozMap<any>?>? 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<object> arg);
void passSequenceOfNullableObject(sequence<object?> arg);
void passNullableSequenceOfObject(sequence<object>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
void passMozMapOfObject(MozMap<object> 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<long> or long) arg);
void passUnion16(optional (sequence<long> or long) arg);
void passUnion17(optional (sequence<long>? or long) arg = 5);
void passUnion18((sequence<object> or long) arg);
void passUnion19(optional (sequence<object> or long) arg);
void passUnion20(optional (sequence<object> or long) arg = []);
void passUnion21((MozMap<long> or long) arg);
void passUnion22((MozMap<object> or long) arg);
void passUnion23((sequence<ImageData> or long) arg);
void passUnion24((sequence<ImageData?> or long) arg);
void passUnion25((sequence<sequence<ImageData>> or long) arg);
void passUnion26((sequence<sequence<ImageData?>> or long) arg);
void passUnion27(optional (sequence<DOMString> or EventInit) arg);
void passUnion28(optional (EventInit or sequence<DOMString>) arg);
void passUnionWithCallback((EventHandler or long) arg);
void passUnionWithByteString((ByteString or long) arg);
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
void passUnionWithMozMapAndSequence((MozMap<DOMString> or sequence<DOMString>) arg);
void passUnionWithSequenceAndMozMap((sequence<DOMString> or MozMap<DOMString>) 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<object> 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<Date> arg);
void passNullableDateSequence(sequence<Date?> arg);
void passDateMozMap(MozMap<Date> arg);
Date receiveDate();
Date? receiveNullableDate();
// Promise types
void passPromise(Promise<any> arg);
void passNullablePromise(Promise<any>? arg);
void passOptionalPromise(optional Promise<any> arg);
void passOptionalNullablePromise(optional Promise<any>? arg);
void passOptionalNullablePromiseWithDefaultValue(optional Promise<any>? arg = null);
void passPromiseSequence(sequence<Promise<any>> arg);
void passNullablePromiseSequence(sequence<Promise<any>?> arg);
Promise<any> receivePromise();
Promise<any> 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<Dict> x);
void passMozMapOfDictionaries(MozMap<GrandparentDict> x);
// No support for nullable dictionaries inside a sequence (nor should there be)
// void passSequenceOfNullableDictionaries(sequence<Dict?> 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<long> arg);
void overload17(MozMap<long> arg);
void overload18(MozMap<DOMString> arg);
void overload18(sequence<DOMString> arg);
void overload19(sequence<long> arg);
void overload19(optional Dict arg);
void overload20(optional Dict arg);
void overload20(sequence<long> 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;
[CEReactions] void ceReactionsMethod();
[CEReactions] void ceReactionsMethodOverload();
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
[CEReactions] attribute boolean ceReactionsAttr;
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;
};

View File

@ -1,94 +0,0 @@
/* -*- 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<Promise>
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<uint32_t>& 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<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aWrapper)
{
return TestFunctionsBinding::Wrap(aCx, this, aGivenProto, aWrapper);
}
}
}

View File

@ -1,52 +0,0 @@
/* -*- 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<Promise>
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<uint32_t>& aLength,
DOMString& aString);
bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aWrapper);
private:
nsString mStringData;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestFunctions_h

View File

@ -1,82 +0,0 @@
/* 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<nsString, nsString>(NS_LITERAL_STRING("a"),
NS_LITERAL_STRING("b")));
mValues.AppendElement(std::pair<nsString, nsString>(NS_LITERAL_STRING("c"),
NS_LITERAL_STRING("d")));
mValues.AppendElement(std::pair<nsString, nsString>(NS_LITERAL_STRING("e"),
NS_LITERAL_STRING("f")));
}
//static
already_AddRefed<TestInterfaceIterableDouble>
TestInterfaceIterableDouble::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceIterableDouble> r = new TestInterfaceIterableDouble(window);
return r.forget();
}
JSObject*
TestInterfaceIterableDouble::WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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

View File

@ -1,51 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceIterableDouble>
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
size_t GetIterableLength();
nsAString& GetKeyAtIndex(uint32_t aIndex);
nsAString& GetValueAtIndex(uint32_t aIndex);
private:
virtual ~TestInterfaceIterableDouble() {}
nsCOMPtr<nsPIDOMWindowInner> mParent;
nsTArray<std::pair<nsString, nsString>> mValues;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceIterableDouble_h

View File

@ -1,83 +0,0 @@
/* 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<nsString, OwningStringOrLong>(NS_LITERAL_STRING("long"),
a));
a.SetAsString() = NS_LITERAL_STRING("a");
mValues.AppendElement(std::pair<nsString, OwningStringOrLong>(NS_LITERAL_STRING("string"),
a));
}
//static
already_AddRefed<TestInterfaceIterableDoubleUnion>
TestInterfaceIterableDoubleUnion::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceIterableDoubleUnion> r = new TestInterfaceIterableDoubleUnion(window);
return r.forget();
}
JSObject*
TestInterfaceIterableDoubleUnion::WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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

View File

@ -1,51 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceIterableDoubleUnion>
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
size_t GetIterableLength();
nsAString& GetKeyAtIndex(uint32_t aIndex);
OwningStringOrLong& GetValueAtIndex(uint32_t aIndex);
private:
virtual ~TestInterfaceIterableDoubleUnion() {}
nsCOMPtr<nsPIDOMWindowInner> mParent;
nsTArray<std::pair<nsString, OwningStringOrLong>> mValues;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceIterableDoubleUnion_h

View File

@ -1,77 +0,0 @@
/* 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>
TestInterfaceIterableSingle::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceIterableSingle> r = new TestInterfaceIterableSingle(window);
return r.forget();
}
JSObject*
TestInterfaceIterableSingle::WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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

View File

@ -1,51 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceIterableSingle>
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
uint32_t Length() const;
int32_t IndexedGetter(uint32_t aIndex, bool& aFound) const;
private:
virtual ~TestInterfaceIterableSingle() {}
nsCOMPtr<nsPIDOMWindowInner> mParent;
nsTArray<int32_t> mValues;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceIterableSingle_h

View File

@ -1,166 +0,0 @@
/* -*- 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])

View File

@ -1,4 +0,0 @@
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}

View File

@ -1,38 +0,0 @@
/* -*- 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])

View File

@ -1,84 +0,0 @@
/* 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>
TestInterfaceMaplike::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceMaplike> r = new TestInterfaceMaplike(window);
return r.forget();
}
JSObject*
TestInterfaceMaplike::WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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

View File

@ -1,52 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceMaplike>
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<nsPIDOMWindowInner> mParent;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceMaplike_h

View File

@ -1,88 +0,0 @@
/* 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>
TestInterfaceMaplikeObject::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceMaplikeObject> r =
new TestInterfaceMaplikeObject(window);
return r.forget();
}
JSObject*
TestInterfaceMaplikeObject::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return TestInterfaceMaplikeObjectBinding::Wrap(aCx, this, aGivenProto);
}
nsPIDOMWindowInner*
TestInterfaceMaplikeObject::GetParentObject() const
{
return mParent;
}
void
TestInterfaceMaplikeObject::SetInternal(const nsAString& aKey)
{
RefPtr<TestInterfaceMaplike> 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

View File

@ -1,52 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceMaplikeObject>
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<nsPIDOMWindowInner> mParent;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceMaplikeObject_h

View File

@ -1,58 +0,0 @@
/* 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>
TestInterfaceSetlike::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceSetlike> r = new TestInterfaceSetlike(nullptr, window);
return r.forget();
}
JSObject*
TestInterfaceSetlike::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return TestInterfaceSetlikeBinding::Wrap(aCx, this, aGivenProto);
}
nsPIDOMWindowInner*
TestInterfaceSetlike::GetParentObject() const
{
return mParent;
}
} // namespace dom
} // namespace mozilla

View File

@ -1,46 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceSetlike>
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
private:
virtual ~TestInterfaceSetlike() {}
nsCOMPtr<nsPIDOMWindowInner> mParent;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceSetlike_h

View File

@ -1,58 +0,0 @@
/* 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>
TestInterfaceSetlikeNode::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
if (!window) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;
}
RefPtr<TestInterfaceSetlikeNode> r = new TestInterfaceSetlikeNode(nullptr, window);
return r.forget();
}
JSObject*
TestInterfaceSetlikeNode::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto)
{
return TestInterfaceSetlikeNodeBinding::Wrap(aCx, this, aGivenProto);
}
nsPIDOMWindowInner*
TestInterfaceSetlikeNode::GetParentObject() const
{
return mParent;
}
} // namespace dom
} // namespace mozilla

View File

@ -1,46 +0,0 @@
/* -*- 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<JSObject*> aGivenProto) override;
static already_AddRefed<TestInterfaceSetlikeNode>
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
private:
virtual ~TestInterfaceSetlikeNode() {}
nsCOMPtr<nsPIDOMWindowInner> mParent;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_TestInterfaceSetlikeNode_h

View File

@ -1,840 +0,0 @@
/* -*- 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<Dict> 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<float> arg9, sequence<unrestricted float> arg10,
sequence<float?> arg11, sequence<unrestricted float?> arg12,
sequence<double> arg13, sequence<unrestricted double> arg14,
sequence<double?> arg15, sequence<unrestricted double?> 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<float> arg9,
sequence<unrestricted float> arg10,
sequence<float?> arg11,
sequence<unrestricted float?> arg12,
sequence<double> arg13,
sequence<unrestricted double> arg14,
sequence<double?> arg15,
sequence<unrestricted double?> 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<TestNonWrapperCacheInterface> receiveNonWrapperCacheInterfaceSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface?> receiveNullableNonWrapperCacheInterfaceSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface>? receiveNonWrapperCacheInterfaceNullableSequence();
[NewObject]
sequence<TestNonWrapperCacheInterface?>? 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<long> readonlySequence;
[Cached, Pure]
readonly attribute sequence<Dict> readonlySequenceOfDictionaries;
[Cached, Pure]
readonly attribute sequence<Dict>? readonlyNullableSequenceOfDictionaries;
[Cached, Pure, Frozen]
readonly attribute sequence<long> readonlyFrozenSequence;
[Cached, Pure, Frozen]
readonly attribute sequence<long>? readonlyFrozenNullableSequence;
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<TestJSImplInterface> receiveCastableObjectSequence();
sequence<TestCallbackInterface> receiveCallbackObjectSequence();
sequence<TestJSImplInterface?> receiveNullableCastableObjectSequence();
sequence<TestCallbackInterface?> receiveNullableCallbackObjectSequence();
sequence<TestJSImplInterface>? receiveCastableObjectNullableSequence();
sequence<TestJSImplInterface?>? receiveNullableCastableObjectNullableSequence();
sequence<TestJSImplInterface> receiveWeakCastableObjectSequence();
sequence<TestJSImplInterface?> receiveWeakNullableCastableObjectSequence();
sequence<TestJSImplInterface>? receiveWeakCastableObjectNullableSequence();
sequence<TestJSImplInterface?>? receiveWeakNullableCastableObjectNullableSequence();
void passCastableObjectSequence(sequence<TestJSImplInterface> arg);
void passNullableCastableObjectSequence(sequence<TestJSImplInterface?> arg);
void passCastableObjectNullableSequence(sequence<TestJSImplInterface>? arg);
void passNullableCastableObjectNullableSequence(sequence<TestJSImplInterface?>? arg);
void passOptionalSequence(optional sequence<long> arg);
void passOptionalSequenceWithDefaultValue(optional sequence<long> arg = []);
void passOptionalNullableSequence(optional sequence<long>? arg);
void passOptionalNullableSequenceWithDefaultValue(optional sequence<long>? arg = null);
void passOptionalNullableSequenceWithDefaultValue2(optional sequence<long>? arg = []);
void passOptionalObjectSequence(optional sequence<TestJSImplInterface> arg);
void passExternalInterfaceSequence(sequence<TestExternalInterface> arg);
void passNullableExternalInterfaceSequence(sequence<TestExternalInterface?> arg);
sequence<DOMString> receiveStringSequence();
sequence<ByteString> receiveByteStringSequence();
// Callback interface problem. See bug 843261.
//void passStringSequence(sequence<DOMString> arg);
sequence<any> receiveAnySequence();
sequence<any>? receiveNullableAnySequence();
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<any>> receiveAnySequenceSequence();
sequence<object> receiveObjectSequence();
sequence<object?> receiveNullableObjectSequence();
void passSequenceOfSequences(sequence<sequence<long>> arg);
void passSequenceOfSequencesOfSequences(sequence<sequence<sequence<long>>> arg);
//XXXbz No support for sequence of sequence return values yet.
//sequence<sequence<long>> receiveSequenceOfSequences();
// MozMap types
void passMozMap(MozMap<long> arg);
void passNullableMozMap(MozMap<long>? arg);
void passMozMapOfNullableInts(MozMap<long?> arg);
void passOptionalMozMapOfNullableInts(optional MozMap<long?> arg);
void passOptionalNullableMozMapOfNullableInts(optional MozMap<long?>? arg);
void passCastableObjectMozMap(MozMap<TestJSImplInterface> arg);
void passNullableCastableObjectMozMap(MozMap<TestJSImplInterface?> arg);
void passCastableObjectNullableMozMap(MozMap<TestJSImplInterface>? arg);
void passNullableCastableObjectNullableMozMap(MozMap<TestJSImplInterface?>? arg);
void passOptionalMozMap(optional MozMap<long> arg);
void passOptionalNullableMozMap(optional MozMap<long>? arg);
void passOptionalNullableMozMapWithDefaultValue(optional MozMap<long>? arg = null);
void passOptionalObjectMozMap(optional MozMap<TestJSImplInterface> arg);
void passExternalInterfaceMozMap(MozMap<TestExternalInterface> arg);
void passNullableExternalInterfaceMozMap(MozMap<TestExternalInterface?> arg);
void passStringMozMap(MozMap<DOMString> arg);
void passByteStringMozMap(MozMap<ByteString> arg);
void passMozMapOfMozMaps(MozMap<MozMap<long>> arg);
MozMap<long> receiveMozMap();
MozMap<long>? receiveNullableMozMap();
MozMap<long?> receiveMozMapOfNullableInts();
MozMap<long?>? receiveNullableMozMapOfNullableInts();
//XXXbz No support for MozMap of MozMaps return values yet.
//MozMap<MozMap<long>> receiveMozMapOfMozMaps();
MozMap<any> 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<ArrayBuffer> arg);
void passSequenceOfNullableArrayBuffers(sequence<ArrayBuffer?> arg);
void passMozMapOfArrayBuffers(MozMap<ArrayBuffer> arg);
void passMozMapOfNullableArrayBuffers(MozMap<ArrayBuffer?> 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<any> arg);
void passNullableSequenceOfAny(sequence<any>? arg);
void passOptionalSequenceOfAny(optional sequence<any> arg);
void passOptionalNullableSequenceOfAny(optional sequence<any>? arg);
void passOptionalSequenceOfAnyWithDefaultValue(optional sequence<any>? arg = null);
void passSequenceOfSequenceOfAny(sequence<sequence<any>> arg);
void passSequenceOfNullableSequenceOfAny(sequence<sequence<any>?> arg);
void passNullableSequenceOfNullableSequenceOfAny(sequence<sequence<any>?>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfAny(optional sequence<sequence<any>?>? arg);
void passMozMapOfAny(MozMap<any> arg);
void passNullableMozMapOfAny(MozMap<any>? arg);
void passOptionalMozMapOfAny(optional MozMap<any> arg);
void passOptionalNullableMozMapOfAny(optional MozMap<any>? arg);
void passOptionalMozMapOfAnyWithDefaultValue(optional MozMap<any>? arg = null);
void passMozMapOfMozMapOfAny(MozMap<MozMap<any>> arg);
void passMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?> arg);
void passNullableMozMapOfNullableMozMapOfAny(MozMap<MozMap<any>?>? arg);
void passOptionalNullableMozMapOfNullableMozMapOfAny(optional MozMap<MozMap<any>?>? arg);
void passOptionalNullableMozMapOfNullableSequenceOfAny(optional MozMap<sequence<any>?>? arg);
void passOptionalNullableSequenceOfNullableMozMapOfAny(optional sequence<MozMap<any>?>? 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<object> arg);
void passSequenceOfNullableObject(sequence<object?> arg);
void passNullableSequenceOfObject(sequence<object>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfObject(optional sequence<sequence<object>?>? arg);
void passOptionalNullableSequenceOfNullableSequenceOfNullableObject(optional sequence<sequence<object?>?>? arg);
void passMozMapOfObject(MozMap<object> 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<long> or long) arg);
void passUnion16(optional (sequence<long> or long) arg);
void passUnion17(optional (sequence<long>? or long) arg = 5);
void passUnion18((sequence<object> or long) arg);
void passUnion19(optional (sequence<object> or long) arg);
void passUnion20(optional (sequence<object> or long) arg = []);
void passUnion21((MozMap<long> or long) arg);
void passUnion22((MozMap<object> or long) arg);
void passUnion23((sequence<ImageData> or long) arg);
void passUnion24((sequence<ImageData?> or long) arg);
void passUnion25((sequence<sequence<ImageData>> or long) arg);
void passUnion26((sequence<sequence<ImageData?>> or long) arg);
void passUnion27(optional (sequence<DOMString> or EventInit) arg);
void passUnion28(optional (EventInit or sequence<DOMString>) arg);
void passUnionWithCallback((EventHandler or long) arg);
void passUnionWithByteString((ByteString or long) arg);
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
void passUnionWithMozMapAndSequence((MozMap<DOMString> or sequence<DOMString>) arg);
void passUnionWithSequenceAndMozMap((sequence<DOMString> or MozMap<DOMString>) 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<object> 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<Date> arg);
void passNullableDateSequence(sequence<Date?> arg);
void passDateMozMap(MozMap<Date> arg);
Date receiveDate();
Date? receiveNullableDate();
// Promise types
void passPromise(Promise<any> arg);
void passNullablePromise(Promise<any>? arg);
void passOptionalPromise(optional Promise<any> arg);
void passOptionalNullablePromise(optional Promise<any>? arg);
void passOptionalNullablePromiseWithDefaultValue(optional Promise<any>? arg = null);
void passPromiseSequence(sequence<Promise<any>> arg);
void passNullablePromiseSequence(sequence<Promise<any>?> arg);
Promise<any> receivePromise();
Promise<any> 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<Dict> x);
void passMozMapOfDictionaries(MozMap<GrandparentDict> x);
// No support for nullable dictionaries inside a sequence (nor should there be)
// void passSequenceOfNullableDictionaries(sequence<Dict?> 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<long> arg);
void overload17(MozMap<long> arg);
void overload18(MozMap<DOMString> arg);
void overload18(sequence<DOMString> arg);
void overload19(sequence<long> arg);
void overload19(optional Dict arg);
void overload20(optional Dict arg);
void overload20(sequence<long> 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;
[CEReactions] void ceReactionsMethod();
[CEReactions] void ceReactionsMethodOverload();
[CEReactions] void ceReactionsMethodOverload(DOMString bar);
[CEReactions] attribute boolean ceReactionsAttr;
// 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;
};

View File

@ -1,29 +0,0 @@
/* -*- 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 {
};

View File

@ -1,7 +0,0 @@
/* -*- 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;

View File

@ -1,22 +0,0 @@
[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]

View File

@ -1,12 +0,0 @@
<!DOCTYPE HTML>
<html>
<body>
<script type="application/javascript">
function runTest()
{
return [ parent.HTMLElement.prototype instanceof Element,
parent.HTMLElement.prototype instanceof parent.Element ];
}
</script>
</body>
</html>

View File

@ -1,5 +0,0 @@
<body>
<script>
worker = new Worker("a");
</script>
</body>

View File

@ -1,5 +0,0 @@
<body>
<script>
document.x = 5;
</script>
</body>

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html>
<script>
window.expando = 42;
window.shadowedIframe = 42;
Object.setPrototypeOf(window, Object.create(Window.prototype,
{
shadowedIframe: { value: 42 },
iframe: { value: 42 },
document: { value: 42 },
addEventListener: { value: 42 },
toString: { value: 42 }
}));
window.documentElement.expando = 42;
Object.defineProperty(window.documentElement, "version", { value: 42 });
</script>
<iframe name="shadowedIframe" id="shadowedIframe"></iframe>
<iframe name="iframe" id="iframe"></iframe>
<iframe name="document" id="document"></iframe>
<iframe name="self" id="self"></iframe>
<iframe name="addEventListener" id="addEventListener"></iframe>
<iframe name="toString" id="toString"></iframe>
<iframe name="item" id="item"></iframe>
</html>

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<div id="stage"></div>
<script>
function stage(str) {
var s = document.getElementById("stage");
s.textContent = str;
}
stage("before");
setTimeout(function() {
stage("in timeout");
});
setInterval(function() {
stage("in interval");
});
addEventListener("keydown", function() {
stage("keydown");
}, false);
try {
focus();
stage("after");
} catch(e) {
stage("exception raised");
}
</script>

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<div id="stage"></div>
<script>
function stage(str) {
var s = document.getElementById("stage");
s.textContent = str;
}
stage("before");
setTimeout(function() {
stage("in timeout");
});
setInterval(function() {
stage("in interval");
});
addEventListener("keydown", function() {
stage("keydown");
}, false);
try {
window.fullScreen;
stage("after");
} catch(e) {
stage("exception raised");
}
</script>

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<script>
document.x = 5
</script>
<img id="y" name="y"></div>
<img id="z" name="z"></div>
</html>

View File

@ -1,13 +0,0 @@
<!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>

View File

@ -1,79 +0,0 @@
[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

View File

@ -1,58 +0,0 @@
# -*- 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']

View File

@ -1,32 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=796850
-->
<head>
<meta charset="utf-8">
<title>Test for ByteString support</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=796850">Mozilla Bug 796850</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 796850 **/
var xhr = new XMLHttpRequest();
caught = false;
try {
xhr.open("\u5427", "about:mozilla", true);
}
catch (TypeError) {
caught = true;
}
ok(caught, "Character values > 255 not rejected for ByteString");
</script>
</pre>
</body>
</html>

View File

@ -1,54 +0,0 @@
<!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 **/
SimpleTest.waitForExplicitFinish();
function runTest()
{
ok(document instanceof EventTarget, "document is an event target")
ok(new XMLHttpRequest() instanceof XMLHttpRequest, "instanceof should work on XHR");
ok(HTMLElement.prototype instanceof Node, "instanceof needs to walk the prototype chain")
var otherWin = document.getElementById("testFrame").contentWindow;
ok(otherWin.HTMLElement.prototype instanceof otherWin.Node, "Same-origin instanceof of a interface prototype object should work, even if called cross-origin");
ok(!(otherWin.HTMLElement.prototype instanceof Node), "Cross-origin instanceof of a interface prototype object shouldn't work");
// We need to reset HTMLElement.prototype.__proto__ to the original value
// before using anything from the harness, otherwise the harness code breaks
// in weird ways.
HTMLElement.prototype.__proto__ = otherWin.Element.prototype;
var [ shouldSucceed, shouldFail ] = otherWin.runTest();
shouldSucceed = shouldSucceed && HTMLElement.prototype instanceof otherWin.Element;
shouldFail = shouldFail && HTMLElement.prototype instanceof Element;
HTMLElement.prototype.__proto__ = Element.prototype;
ok(shouldSucceed, "If an interface prototype object is on the protochain then instanceof with the interface object should succeed");
ok(!shouldFail, "If an interface prototype object is not on the protochain then instanceof with the interface object should succeed");
SimpleTest.finish();
}
</script>
</pre>
<iframe id="testFrame" src="file_InstanceOf.html" onload="runTest()"></iframe>
</body>
</html>

View File

@ -1,20 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for bug 987110</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var props = Object.getOwnPropertyNames(Object.prototype);
// If you change this list, make sure it continues to match the list in
// Codegen.py's CGDictionary.getMemberDefinition method.
var expected = [
"constructor", "toSource", "toString", "toLocaleString", "valueOf",
"hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable",
"__defineGetter__", "__defineSetter__", "__lookupGetter__",
"__lookupSetter__", "__proto__"
];
assert_array_equals(props.sort(), expected.sort());
}, "Own properties of Object.prototype");
</script>

View File

@ -1,108 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1148593
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1148593</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1148593 **/
SimpleTest.waitForExplicitFinish();
var TESTS;
function nextTest() {
var t = TESTS.pop();
if (t) {
t();
} else {
SimpleTest.finish();
}
}
function checkStack(functionName) {
try {
noSuchFunction();
} catch (e) {
ok(e.stack.indexOf(functionName) >= 0, "stack includes " + functionName);
}
nextTest();
}
function eventListener() {
checkStack("registerEventListener");
}
function registerEventListener(link) {
link.onload = eventListener;
}
function eventTest() {
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "data:text/css,";
registerEventListener(link);
document.body.appendChild(link);
}
function xhrListener() {
checkStack("xhrTest");
}
function xhrTest() {
var ourFile = location.href;
var x = new XMLHttpRequest();
x.onload = xhrListener;
x.open("get", ourFile, true);
x.send();
}
function rafListener() {
checkStack("rafTest");
}
function rafTest() {
requestAnimationFrame(rafListener);
}
var intervalId;
function intervalHandler() {
clearInterval(intervalId);
checkStack("intervalTest");
}
function intervalTest() {
intervalId = setInterval(intervalHandler, 5);
}
function postMessageHandler(ev) {
ev.stopPropagation();
checkStack("postMessageTest");
}
function postMessageTest() {
window.addEventListener("message", postMessageHandler, true);
window.postMessage("whatever", "*");
}
function runTests() {
TESTS = [postMessageTest, intervalTest, rafTest, xhrTest, eventTest];
nextTest();
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv(
{"set": [['javascript.options.asyncstack', true]]},
runTests);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1148593">Mozilla Bug 1148593</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,60 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=936056
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 936056</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 936056 **/
SimpleTest.waitForExplicitFinish();
window.onload = function() {
var desc = Object.getOwnPropertyDescriptor(frames[0], "document");
if (!desc || !desc.get) {
todo(false, "This test does nothing so far, but will once Window is on WebIDL bindings");
SimpleTest.finish();
return;
}
get = desc.get;
ok(get, "Couldn't find document getter");
Object.defineProperty(frames[0], "foo", { get: get, configurable: true });
var barewordFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = foo; return doc.documentElement; })");
var qualifiedFunc = frames[0].eval("(function (count) { var doc; for (var i = 0; i < count; ++i) doc = window.document; return doc.documentElement; })");
document.querySelector("iframe").onload = function () {
// interp
is(barewordFunc(1).textContent, "OLD", "Bareword should see own inner 1");
is(qualifiedFunc(1).textContent, "NEW",
"Qualified should see current inner 1");
// baseline
is(barewordFunc(100).textContent, "OLD", "Bareword should see own inner 2");
is(qualifiedFunc(100).textContent, "NEW",
"Qualified should see current inner 2");
// ion
is(barewordFunc(10000).textContent, "OLD", "Bareword should see own inner 3");
is(qualifiedFunc(10000).textContent, "NEW",
"Qualified should see current inner 2");
SimpleTest.finish();
}
frames[0].location = "data:text/plain,NEW";
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936056">Mozilla Bug 936056</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe src="data:text/plain,OLD"></iframe>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,124 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="runTest();">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function Listener(aBrowser, aPrerendered, aCallback) {
this.init(aBrowser, aPrerendered, aCallback);
}
Listener.prototype = {
init: function(aBrowser, aPrerendered, aCallback) {
this.mBrowser = aBrowser;
this.mPrerendered = aPrerendered;
this.mCallback = aCallback;
},
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {
if ((aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_DOCUMENT)) {
var doc = this.mBrowser.contentDocument;
var stage = doc.getElementById("stage");
if (this.mPrerendered) {
is(stage.textContent, "before", "The blacklisted call should properly be intercepted in prerendering mode");
} else {
// In normal mode, we may or may not have run the timeout and/or the interval.
switch (stage.textContent) {
case "after":
case "in timeout":
case "in interval":
ok(true, "The blacklisted call should work fine in normal mode");
break;
default:
ok(false, "The blacklisted call should work fine in normal mode");
break;
}
}
progress.removeProgressListener(progressListener);
// Set three timeouts to see if the interval triggered
var self = this;
function checkInterval() {
var expected = self.mPrerendered ? "before" : "in interval";
var desc = self.mPrerendered ? "No timer should be running" : "Timers should run as normal";
is(stage.textContent, expected, desc);
// Now, dispatch a key event to the window and see if the keydown handler runs
synthesizeKey("a", {}, self.mBrowser.contentWindow);
expected = self.mPrerendered ? "before" : "keydown";
desc = self.mPrerendered ? "No event handler should be running" : "Event handlers should run as normal";
is(stage.textContent, expected, desc);
self.mCallback();
}
setTimeout(function() {
setTimeout(function() {
setTimeout(function() {
checkInterval();
}, 0);
}, 0);
}, 0);
}
},
onProgressChange : function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {},
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) {},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange : function(aWebProgress, aRequest, aState) {},
mBrowser: null,
mPrerendered: false,
mCallback: null
};
var progress, progressListener;
function runTest() {
testStep(false, "file_focuser.html", function() {
testStep(true, "file_focuser.html", function() {
testStep(false, "file_fullScreenPropertyAccessor.html", function() {
testStep(true, "file_fullScreenPropertyAccessor.html", function() {
SimpleTest.finish();
});
});
});
});
}
function testStep(aPrerendered, aFileName, aCallback) {
var browser = document.getElementById(aPrerendered ? "prerendered" : "normal");;
progressListener = new Listener(browser, aPrerendered, aCallback);
var docShell = browser.docShell;
progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebProgress);
progress.addProgressListener(progressListener,
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
browser.loadURI("chrome://mochitests/content/chrome/dom/bindings/test/" + aFileName);
}
]]>
</script>
<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069719">Mozilla Bug 1069719</a>
<p id="display"></p>
<pre id="test">
</pre>
</body>
<browser prerendered="true" id="prerendered"/>
<browser id="normal"/>
</window>

View File

@ -1,123 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1036214
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1036214</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for subsumes-checking |any| and |object| for js-implemented WebIDL. **/
SimpleTest.waitForExplicitFinish();
var xoObjects = [];
function setup() {
xoObjects.push(window[0]);
xoObjects.push(window[0].location);
xoObjects.push(SpecialPowers.unwrap(SpecialPowers.wrap(window[0]).document));
xoObjects.push(SpecialPowers);
xoObjects.push(SpecialPowers.wrap);
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
}
function checkThrows(f, msg) {
try {
f();
ok(false, "Should have thrown: " + msg);
} catch (e) {
ok(true, "Threw correctly: " + msg);
ok(/denied|insecure/.test(e), "Threw security exception: " + e);
}
}
function go() {
//
// Test the basics of the test interface.
//
var any = { a: 11 };
var obj = { b: 22, c: "str" };
var obj2 = { foo: "baz" };
var myDict = { anyMember: 42, objectMember: { answer: 42 }, objectOrStringMember: { answer: "anobject" },
anySequenceMember: [{}, 1, "thirdinsequence"],
innerDictionary: { innerObject: { answer: "rabbithole" } } };
var t = new TestInterfaceJS(any, obj, myDict);
is(Object.getPrototypeOf(t), TestInterfaceJS.prototype, "Prototype setup works correctly");
is(t.anyArg, any, "anyArg is correct");
is(t.objectArg, obj, "objectArg is correct");
is(t.dictionaryArg.anyMember, 42, "dictionaryArg looks correct");
is(t.dictionaryArg.objectMember.answer, 42, "dictionaryArg looks correct");
t.anyAttr = 2;
is(t.anyAttr, 2, "ping-pong any attribute works");
t.objAttr = obj2;
is(t.objAttr, obj2, "ping-pong object attribute works");
t.dictionaryAttr = myDict;
is(t.dictionaryAttr.anyMember, 42, "ping-pong dictionary attribute works");
is(t.dictionaryAttr.objectMember.answer, 42, "ping-pong dictionary attribute works");
is(any, t.pingPongAny(any), "ping-pong works with any");
is(obj, t.pingPongObject(obj), "ping-pong works with obj");
is(obj, t.pingPongObjectOrString(obj), "ping-pong works with obj or string");
is("foo", t.pingPongObjectOrString("foo"), "ping-pong works with obj or string");
is(t.pingPongDictionary(myDict).anyMember, 42, "ping pong works with dict");
is(t.pingPongDictionary(myDict).objectMember.answer, 42, "ping pong works with dict");
is(t.pingPongDictionary(myDict).objectOrStringMember.answer, "anobject", "ping pong works with dict");
is(t.pingPongDictionary(myDict).anySequenceMember[2], "thirdinsequence", "ping pong works with dict");
is(t.pingPongDictionary(myDict).innerDictionary.innerObject.answer, "rabbithole", "ping pong works with layered dicts");
is(t.pingPongDictionaryOrLong({anyMember: 42}), 42, "ping pong (dict or long) works with dict");
is(t.pingPongDictionaryOrLong(42), 42, "ping pong (dict or long) works with long");
ok(/canary/.test(t.pingPongMap({ someVal: 42, someOtherVal: "canary" })), "ping pong works with mozmap");
is(t.objectSequenceLength([{}, {}, {}]), 3, "ping pong works with object sequence");
is(t.anySequenceLength([42, 'string', {}, undefined]), 4, "ping pong works with any sequence");
//
// Test that we throw in the cross-origin cases.
//
xoObjects.forEach(function(xoObj) {
var blank = new TestInterfaceJS();
checkThrows(() => new TestInterfaceJS(xoObj, undefined), "any param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, xoObj), "obj param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, undefined, { anyMember: xoObj }), "any dict param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, undefined, { objectMember: xoObj }), "object dict param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, undefined, { objectOrStringMember: xoObj }), "union dict param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, undefined, { anySequenceMember: [0, xoObj, 'hi' ] }), "sequence dict param for constructor");
checkThrows(() => new TestInterfaceJS(undefined, undefined, { innerDictionary: { innerObject: xoObj } }), "inner dict param for constructor");
checkThrows(() => t.anyAttr = xoObj, "anyAttr");
checkThrows(() => t.objectAttr = xoObj, "objAttr");
checkThrows(() => t.dictionaryAttr = { anyMember: xoObj }, "dictionaryAttr any");
checkThrows(() => t.dictionaryAttr = { objectMember: xoObj }, "dictionaryAttr object");
checkThrows(() => t.pingPongAny(xoObj), "pingpong any");
checkThrows(() => t.pingPongObject(xoObj), "pingpong obj");
checkThrows(() => t.pingPongObjectOrString(xoObj), "pingpong union");
checkThrows(() => t.pingPongDictionary({ anyMember: xoObj }), "dictionary pingpong any");
checkThrows(() => t.pingPongDictionary({ objectMember: xoObj }), "dictionary pingpong object");
checkThrows(() => t.pingPongDictionary({ anyMember: xoObj, objectMember: xoObj }), "dictionary pingpong both");
checkThrows(() => t.pingPongDictionary({ objectOrStringMember: xoObj }), "dictionary pingpong objectorstring");
checkThrows(() => t.pingPongDictionaryOrLong({ objectMember: xoObj }), "unionable dictionary");
checkThrows(() => t.pingPongDictionaryOrLong({ anyMember: xoObj }), "unionable dictionary");
checkThrows(() => t.pingPongMap({ someMember: 42, someOtherMember: {}, crossOriginMember: xoObj }), "mozmap");
checkThrows(() => t.objectSequenceLength([{}, {}, xoObj, {}]), "object sequence");
checkThrows(() => t.anySequenceLength([42, 'someString', xoObj, {}]), "any sequence");
});
SimpleTest.finish();
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1036214">Mozilla Bug 1036214</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<iframe id="ifr" onload="setup();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
</body>
</html>

View File

@ -1,49 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1041646
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1041646</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1041646 **/
// We need to reject the promise with a DOMException, so make sure we have
// something that produces one.
function throwException() {
document.createTextNode("").appendChild(document);
}
try {
throwException();
} catch (e) {
ok(e instanceof DOMException, "This test won't test what it should be testing");
}
SimpleTest.waitForExplicitFinish();
// We want a new DOMException each time here.
for (var i = 0; i < 100; ++i) {
new Promise(throwException);
}
// Now make sure we wait for all those promises above to reject themselves
Promise.resolve(1).then(function() {
SpecialPowers.gc(); // This should not assert or crash
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1041646">Mozilla Bug 1041646</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,271 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE HTML>
<html>
<head>
<title>Test Maplike Interface</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
base_properties = [["has", "function", 1],
["entries", "function", 0],
["keys", "function", 0],
["values", "function", 0],
["forEach", "function", 1],
["size", "number"]];
maplike_properties = base_properties.concat([["set", "function", 2]]);
setlike_properties = base_properties;
rw_properties = [["clear", "function", 0],
["delete", "function", 1]];
setlike_rw_properties = base_properties.concat(rw_properties).concat([["add", "function", 1]]);
maplike_rw_properties = maplike_properties.concat(rw_properties).concat([["get", "function",1]]);
var testExistence = function testExistence(prefix, obj, properties) {
for (var [name, type, args] of properties) {
// Properties are somewhere up the proto chain, hasOwnProperty won't work
isnot(obj[name], undefined,
`${prefix} object has property ${name}`);
is(typeof obj[name], type,
`${prefix} object property ${name} is a ${type}`);
// Check function length
if (type == "function") {
is(obj[name].length, args,
`${prefix} object property ${name} is length ${args}`);
is(obj[name].name, name,
`${prefix} object method name is ${name}`);
}
// Find where property is on proto chain, check for enumerablility there.
var owner = obj;
while (owner) {
var propDesc = Object.getOwnPropertyDescriptor(owner, name);
if (propDesc) {
ok(!propDesc.enumerable,
`${prefix} object property ${name} is not enumerable`);
break;
}
owner = Object.getPrototypeOf(owner);
}
}
}
var m;
var testSet;
var testIndex;
// Simple map creation and functionality test
info("SimpleMap: Testing simple map creation and functionality");
m = new TestInterfaceMaplike();
ok(m, "SimpleMap: got a TestInterfaceMaplike object");
testExistence("SimpleMap: ", m, maplike_rw_properties);
is(m.size, 0, "SimpleMap: size should be zero");
ok(!m.has("test"), "SimpleMap: maplike has should return false");
is(m.get("test"), undefined, "SimpleMap: maplike get should return undefined on bogus lookup");
m1 = m.set("test", 1);
is(m, m1, "SimpleMap: return from set should be map object");
is(m.size, 1, "SimpleMap: size should be 1");
ok(m.has("test"), "SimpleMap: maplike has should return true");
is(m.get("test"), 1, "SimpleMap: maplike get should return value entered");
m2 = m.set("test2", 2);
is(m.size, 2, "SimpleMap: size should be 2");
testSet = [["test", 1], ["test2", 2]];
testIndex = 0;
m.forEach(function(v, k, o) {
"use strict";
is(o, m, "SimpleMap: foreach obj is correct");
is(k, testSet[testIndex][0], "SimpleMap: foreach map key: " + k + " = " + testSet[testIndex][0]);
is(v, testSet[testIndex][1], "SimpleMap: foreach map value: " + v + " = " + testSet[testIndex][1]);
testIndex += 1;
});
is(testIndex, 2, "SimpleMap: foreach ran correct number of times");
ok(m.has("test2"), "SimpleMap: maplike has should return true");
is(m.get("test2"), 2, "SimpleMap: maplike get should return value entered");
is(m.delete("test2"), true, "SimpleMap: maplike deletion should return boolean");
is(m.size, 1, "SimpleMap: size should be 1");
iterable = false;
for (var e of m) {
iterable = true;
is(e[0], "test", "SimpleMap: iterable first array element should be key");
is(e[1], 1, "SimpleMap: iterable second array element should be value");
}
is(m[Symbol.iterator].length, 0, "SimpleMap: @@iterator symbol is correct length");
is(m[Symbol.iterator].name, "entries", "SimpleMap: @@iterator symbol has correct name");
is(m[Symbol.iterator], m.entries, 'SimpleMap: @@iterator is an alias for "entries"');
ok(iterable, "SimpleMap: @@iterator symbol resolved correctly");
for (var k of m.keys()) {
is(k, "test", "SimpleMap: first keys element should be 'test'");
}
for (var v of m.values()) {
is(v, 1, "SimpleMap: first values elements should be 1");
}
for (var e of m.entries()) {
is(e[0], "test", "SimpleMap: entries first array element should be 'test'");
is(e[1], 1, "SimpleMap: entries second array element should be 1");
}
m.clear();
is(m.size, 0, "SimpleMap: size should be 0 after clear");
// Simple set creation and functionality test
info("SimpleSet: Testing simple set creation and functionality");
m = new TestInterfaceSetlike();
ok(m, "SimpleSet: got a TestInterfaceSetlike object");
testExistence("SimpleSet: ", m, setlike_rw_properties);
is(m.size, 0, "SimpleSet: size should be zero");
ok(!m.has("test"), "SimpleSet: maplike has should return false");
m1 = m.add("test");
is(m, m1, "SimpleSet: return from set should be map object");
is(m.size, 1, "SimpleSet: size should be 1");
ok(m.has("test"), "SimpleSet: maplike has should return true");
m2 = m.add("test2");
is(m.size, 2, "SimpleSet: size should be 2");
testSet = ["test", "test2"];
testIndex = 0;
m.forEach(function(v, k, o) {
"use strict";
is(o, m, "SimpleSet: foreach obj is correct");
is(k, testSet[testIndex], "SimpleSet: foreach set key: " + k + " = " + testSet[testIndex]);
testIndex += 1;
});
is(testIndex, 2, "SimpleSet: foreach ran correct number of times");
ok(m.has("test2"), "SimpleSet: maplike has should return true");
is(m.delete("test2"), true, "SimpleSet: maplike deletion should return true");
is(m.size, 1, "SimpleSet: size should be 1");
iterable = false;
for (var e of m) {
iterable = true;
is(e, "test", "SimpleSet: iterable first array element should be key");
}
is(m[Symbol.iterator].length, 0, "SimpleSet: @@iterator symbol is correct length");
is(m[Symbol.iterator].name, "values", "SimpleSet: @@iterator symbol has correct name");
is(m[Symbol.iterator], m.values, 'SimpleSet: @@iterator is an alias for "values"');
ok(iterable, "SimpleSet: @@iterator symbol resolved correctly");
for (var k of m.keys()) {
is(k, "test", "SimpleSet: first keys element should be 'test'");
}
for (var v of m.values()) {
is(v, "test", "SimpleSet: first values elements should be 'test'");
}
for (var e of m.entries()) {
is(e[0], "test", "SimpleSet: Entries first array element should be 'test'");
is(e[1], "test", "SimpleSet: Entries second array element should be 'test'");
}
m.clear();
is(m.size, 0, "SimpleSet: size should be 0 after clear");
// Map convenience function test
info("Testing map convenience functions");
m = new TestInterfaceMaplike();
ok(m, "MapConvenience: got a TestInterfaceMaplike object");
is(m.size, 0, "MapConvenience: size should be zero");
ok(!m.hasInternal("test"), "MapConvenience: maplike hasInternal should return false");
m.setInternal("test", 1);
is(m.size, 1, "MapConvenience: size should be 1");
ok(m.hasInternal("test"), "MapConvenience: maplike hasInternal should return true");
is(m.get("test"), 1, "MapConvenience: maplike get should return value entered");
m2 = m.setInternal("test2", 2);
is(m.size, 2, "size should be 2");
ok(m.hasInternal("test2"), "MapConvenience: maplike hasInternal should return true");
is(m.get("test2"), 2, "MapConvenience: maplike get should return value entered");
is(m.deleteInternal("test2"), true, "MapConvenience: maplike deleteInternal should return true");
is(m.size, 1, "MapConvenience: size should be 1");
m.clearInternal();
is(m.size, 0, "MapConvenience: size should be 0 after clearInternal");
// Map convenience function test using objects and readonly
info("Testing Map convenience function test using objects and readonly");
m = new TestInterfaceMaplikeObject();
ok(m, "ReadOnlyMapConvenience: got a TestInterfaceMaplikeObject object");
is(m.size, 0, "ReadOnlyMapConvenience: size should be zero");
is(m["set"], undefined, "ReadOnlyMapConvenience: readonly map, should be no set function");
is(m["clear"], undefined, "ReadOnlyMapConvenience: readonly map, should be no clear function");
is(m["delete"], undefined, "ReadOnlyMapConvenience: readonly map, should be no delete function");
ok(!m.hasInternal("test"), "ReadOnlyMapConvenience: maplike hasInternal should return false");
m.setInternal("test");
is(m.size, 1, "size should be 1");
ok(m.hasInternal("test"), "ReadOnlyMapConvenience: maplike hasInternal should return true");
m2 = m.setInternal("test2");
is(m.size, 2, "size should be 2");
ok(m.hasInternal("test2"), "ReadOnlyMapConvenience: maplike hasInternal should return true");
is(m.deleteInternal("test2"), true, "ReadOnlyMapConvenience: maplike deleteInternal should return true");
is(m.size, 1, "ReadOnlyMapConvenience: size should be 1");
m.clearInternal();
is(m.size, 0, "ReadOnlyMapConvenience: size should be 0 after clearInternal");
// JS implemented map creation convenience function test
info("JSMapConvenience: Testing JS implemented map creation convenience functions");
m = new TestInterfaceJSMaplike();
ok(m, "JSMapConvenience: got a TestInterfaceJSMaplike object");
is(m.size, 0, "JSMapConvenience: size should be zero");
ok(!m.has("test"), "JSMapConvenience: maplike has should return false");
m.setInternal("test", 1);
is(m.size, 1, "JSMapConvenience: size should be 1");
ok(m.has("test"), "JSMapConvenience: maplike has should return true");
is(m.get("test"), 1, "JSMapConvenience: maplike get should return value entered");
m2 = m.setInternal("test2", 2);
is(m.size, 2, "JSMapConvenience: size should be 2");
ok(m.has("test2"), "JSMapConvenience: maplike has should return true");
is(m.get("test2"), 2, "JSMapConvenience: maplike get should return value entered");
is(m.deleteInternal("test2"), true, "JSMapConvenience: maplike deleteInternal should return true");
is(m.size, 1, "JSMapConvenience: size should be 1");
for (var k of m.keys()) {
is(k, "test", "JSMapConvenience: first keys element should be 'test'");
}
for (var v of m.values()) {
is(v, 1, "JSMapConvenience: first values elements should be 1");
}
for (var e of m.entries()) {
is(e[0], "test", "JSMapConvenience: entries first array element should be 'test'");
is(e[1], 1, "JSMapConvenience: entries second array element should be 1");
}
m.clearInternal();
is(m.size, 0, "JSMapConvenience: size should be 0 after clearInternal");
// Test this override for forEach
info("ForEachThisOverride: Testing this override for forEach");
m = new TestInterfaceMaplike();
m.set("test", 1);
m.forEach(function(v, k, o) {
"use strict";
is(o, m, "ForEachThisOverride: foreach obj is correct");
is(this, 5, "ForEachThisOverride: 'this' value should be correct");
}, 5);
// Test defaulting arguments on maplike to undefined
info("MapArgsDefault: Testing maplike defaulting arguments to undefined");
m = new TestInterfaceMaplike();
m.set();
is(m.size, 1, "MapArgsDefault: should have 1 entry");
m.forEach(function(v, k) {
"use strict";
is(typeof k, "string", "MapArgsDefault: key is a string");
is(k, "undefined", "MapArgsDefault: key is the string undefined");
is(v, 0, "MapArgsDefault: value is 0");
});
is(m.get(), 0, "MapArgsDefault: no argument to get() returns correct value");
m.delete();
is(m.size, 0, "MapArgsDefault: should have 0 entries");
// Test defaulting arguments on setlike to undefined
info("SetArgsDefault: Testing setlike defaulting arguments to undefined");
m = new TestInterfaceSetlike();
m.add();
is(m.size, 1, "SetArgsDefault: should have 1 entry");
m.forEach(function(v, k) {
"use strict";
is(typeof k, "string", "SetArgsDefault: key is a string");
is(k, "undefined", "SetArgsDefault: key is the string undefined");
});
m.delete();
is(m.size, 0, "SetArgsDefault: should have 0 entries");
SimpleTest.finish();
});
</script>
</body>
</html>

View File

@ -1,68 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1123516
-->
<window title="Mozilla Bug 1123516"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<iframe id="t"></iframe>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1123516"
target="_blank">Mozilla Bug 1123516</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 1123516 **/
const Cu = Components.utils;
function doTest() {
var win = $("t").contentWindow;
var sandbox = Components.utils.Sandbox(win, { sandboxPrototype: win });
is(sandbox._content, undefined, "_content does nothing over Xray");
// Test cross-compartment usage of maplike/setlike WebIDL structures.
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
try {
var maplike = Components.utils.evalInSandbox("var m = new TestInterfaceMaplike(); m;", sandbox);
maplike.set("test2", 2);
is(maplike.get("test2"), 2, "Should be able to create and use maplike/setlike across compartments");
var test = Components.utils.evalInSandbox("m.get('test2');", sandbox);
is(test, 2, "Maplike/setlike should still work in original compartment");
is(maplike.size, 1, "Testing size retrieval across compartments");
} catch(e) {
ok(false, "Shouldn't throw when working with cross-compartment maplike/setlike interfaces " + e)
};
try {
var setlike = Components.utils.evalInSandbox("var m = new TestInterfaceSetlikeNode(); m.add(document.documentElement); m;", sandbox);
is(TestInterfaceSetlikeNode.prototype.has.call(setlike, win.document.documentElement), true,
"Cross-compartment unwrapping/comparison has works");
// TODO: Should throw until iterators are handled by Xrays, Bug 1023984
try {
var e = TestInterfaceSetlikeNode.prototype.keys.call(setlike);
ok(false, "Calling iterators via xrays should fail");
} catch(e) {
ok(true, "Calling iterators via xrays should fail");
}
setlike.forEach((v,k,t) => { is(v, win.document.documentElement, "Cross-compartment forEach works"); });
TestInterfaceSetlikeNode.prototype.forEach.call(setlike,
(v,k,t) => { is(v, win.document.documentElement, "Cross-compartment forEach works"); });
is(TestInterfaceSetlikeNode.prototype.delete.call(setlike, win.document.documentElement), true,
"Cross-compartment unwrapping/comparison delete works");
} catch(e) {
ok(false, "Shouldn't throw when working with cross-compartment maplike/setlike interfaces " + e)
};
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
</window>

View File

@ -1,14 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>Test for Bug 1123875</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(() => {
assert_throws(new TypeError, () => {
"use strict";
document.childNodes.length = 0;
});
}, "setting a readonly attribute on a proxy in strict mode should throw a TypeError");
</script>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1287912
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1287912</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=1287912">Mozilla Bug 1287912</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
function test()
{
var win = document.getElementById("t").contentWindow;
is(Object.getPrototypeOf(win.Image), win.Function.prototype, "The __proto__ of a named constructor is Function.prototype");
is(win.Image.prototype, win.HTMLImageElement.prototype, "The prototype property of a named constructor is the interface prototype object");
is(win.HTMLImageElement['foo'], undefined, "Should not have a property named foo on the HTMLImageElement interface object");
is(win.Image['foo'], undefined, "Should not have a property named foo on the Image named constructor");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=560072
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 560072</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=560072">Mozilla Bug 560072</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 560072 **/
is(document.body,
Object.getOwnPropertyDescriptor(Document.prototype, "body").get.call(document),
"Should get body out of property descriptor");
is(document.body,
Object.getOwnPropertyDescriptor(
Object.getPrototypeOf(Object.getPrototypeOf(document)), "body").get.call(document),
"Should get body out of property descriptor this way too");
</script>
</pre>
</body>
</html>

View File

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=742191
-->
<head>
<meta charset="utf-8">
<title>Test for invalid argument object</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=742191">Mozilla Bug 742191</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 742191 **/
function doTest() {
var gotTypeError = false;
var ctx = document.createElement("canvas").getContext("2d");
try {
ctx.drawImage({}, 0, 0);
} catch(e) {
if (e instanceof TypeError) {
gotTypeError = true;
}
}
ok(gotTypeError, "passing an invalid argument should cause a type error!");
}
doTest();
</script>
</pre>
</body>
</html>

View File

@ -1,29 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=759621
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 759621</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=759621">Mozilla Bug 759621</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 759621 **/
var l = document.getElementsByTagName("*");
l.namedItem = "pass";
is(l.namedItem, "pass", "Should be able to set expando shadowing a proto prop");
</script>
</pre>
</body>
</html>

View File

@ -1,11 +0,0 @@
<!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>

View File

@ -1,37 +0,0 @@
<!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>

View File

@ -1,30 +0,0 @@
<!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>

View File

@ -1,34 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=852846
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 852846</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 852846 **/
var elem = document.createElement("div");
is(elem.style.color, "", "Shouldn't have color set on HTML element")
elem.style = "color: green";
is(elem.style.color, "green", "Should have color set on HTML element")
elem = document.createElementNS("http://www.w3.org/2000/svg", "svg");
is(elem.style.color, "", "Shouldn't have color set on SVG element")
elem.style = "color: green";
is(elem.style.color, "green", "Should have color set on SVG element")
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=852846">Mozilla Bug 852846</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=862092
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 862092</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 862092 **/
SimpleTest.waitForExplicitFinish();
function runTest()
{
var frameDoc = document.getElementById("f").contentDocument;
var a = document.createElement("select");
a.expando = "test";
a = frameDoc.adoptNode(a)
is(a.expando, "test", "adoptNode needs to preserve expandos");
SimpleTest.finish();
}
</script>
</head>
<body onload="runTest();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862092">Mozilla Bug 862092</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="f"></iframe>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=963382
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 963382</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for clearing cache attributes in JS-implemented WebIDL implementations. **/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
function go() {
var t = new TestInterfaceJS();
// Test [Cached] attribute clearing.
is(t.cachedAttr, 15, "Initial value of number");
t.setCachedAttr(3);
is(t.cachedAttr, 15, "Setting the number on the inner JS object should not affect cached value");
t.clearCachedAttrCache();
is(t.cachedAttr, 3, "Setting the number on the inner JS object should affect cached value after clearing the cache.");
SimpleTest.finish();
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=963382">Mozilla Bug 963382</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,21 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for callback invocation for a callback that comes from a
no-longer-current window that still has an active document.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe srcdoc='<script>function f() { parent.callCount++; }</script>'></iframe>
<script>
var callCount = 0;
var t = async_test("A test of callback invocation in a no-longer-current window with a still-active document");
window.addEventListener("load", t.step_func_done(function() {
var d = document.createElement("div");
d.addEventListener("xyz", frames[0].f);
frames[0].document.open();
frames[0].document.write("All gone");
frames[0].document.close();
d.dispatchEvent(new Event("xyz"));
assert_equals(callCount, 1, "Callback should have been called");
}));
</script>

View File

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=957929
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 957929</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 957929 **/
SimpleTest.waitForExplicitFinish();
function f() {
"use strict";
is(this, undefined, "Should have undefined this value");
SimpleTest.finish();
}
addLoadEvent(function() {
requestAnimationFrame(f);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=957929">Mozilla Bug 957929</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for ...</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
promise_test(function(t) {
var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, JSON.parse);
return promise_rejects(t, new SyntaxError,
Promise.resolve().then(iterator.nextNode.bind(iterator)));
}, "Trying to use JSON.parse as filter should throw a catchable SyntaxError exception even when the filter is invoked async");
promise_test(function(t) {
return promise_rejects(t, new SyntaxError, Promise.resolve('{').then(JSON.parse));
}, "Trying to use JSON.parse as a promise callback should allow the next promise to handle the resulting exception.");
</script>

View File

@ -1,48 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882541
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 882541</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 882541 **/
var div = document.createElement("div");
div.appendChild(document.createElement("span"));
var div2;
div2 = div.cloneNode();
is(div2.childNodes.length, 0, "cloneNode() should do a shallow clone");
div2 = div.cloneNode(undefined);
is(div2.childNodes.length, 0, "cloneNode(undefined) should do a shallow clone");
div2 = div.cloneNode(true);
is(div2.childNodes.length, 1, "cloneNode(true) should do a deep clone");
div2 = document.importNode(div);
is(div2.childNodes.length, 0, "importNode(node) should do a deep import");
div2 = document.importNode(div, undefined);
is(div2.childNodes.length, 0, "importNode(undefined) should do a shallow import");
div2 = document.importNode(div, true);
is(div2.childNodes.length, 1, "importNode(true) should do a deep import");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882541">Mozilla Bug 882541</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for accessing symbols on a cross-origin window</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<iframe src="http://www1.w3c-test.org/common/blank.html"></iframe>
<script>
async_test(function (t) {
window.addEventListener("load", t.step_func(
function() {
assert_equals(document.querySelector("iframe").contentDocument, null, "Should have a crossorigin frame");
assert_throws(new Error(), function() {
frames[0][Symbol.iterator];
}, "Should throw exception on cross-origin Window symbol-named get");
assert_throws(new Error(), function() {
frames[0].location[Symbol.iterator];
}, "Should throw exception on cross-origin Location symbol-named get");
t.done();
}
));
}, "Check Symbol access on load");
</script>

View File

@ -1,157 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=910220
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 910220</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=910220">Mozilla Bug 910220</a>
<p id="display"></p>
<div id="content" style="display: none">
<form name="x"></form>
</div>
<pre id="test">
</pre>
<script type="application/javascript">
/** Test for Bug 910220 **/
function getX() {
return "x";
}
function namedSetStrict(obj) {
"use strict";
var threw;
try {
obj.x = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when setting named property on " + obj);
try {
obj[getX()] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when setting named property via SETELEM on " + obj);
try {
Object.defineProperty(obj, "x", { value: 17 });
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when defining named property on " + obj);
}
function namedSetNonStrict(obj) {
var threw;
try {
obj.x = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(!threw,
"Should not throw in non-strict mode when setting named property on " + obj);
try {
obj[getX()] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(!threw,
"Should not throw in non-strict mode when setting named property via SETELEM on" + obj);
try {
Object.defineProperty(obj, "x", { value: 17 });
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in non-strict mode when defining named property on " + obj);
}
for (var obj of [ document, document.forms ]) {
namedSetStrict(obj);
namedSetNonStrict(obj);
}
function indexedSetStrict(obj) {
"use strict";
var threw;
try {
obj[0] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when setting indexed property on " + obj);
try {
obj[1000] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when setting out of bounds indexed property on " + obj);
try {
Object.defineProperty(obj, "0", { value: 17 });
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in strict mode when defining indexed property on " + obj);
}
function indexedSetNonStrict(obj) {
var threw;
try {
obj[0] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(!threw,
"Should not throw in non-strict mode when setting indexed property on " + obj);
try {
obj[1000] = 5;
threw = false;
} catch (e) {
threw = true;
}
ok(!threw,
"Should not throw in non-strict mode when setting out of bounds indexed property on " + obj);
try {
Object.defineProperty(obj, "0", { value: 17 });
threw = false;
} catch (e) {
threw = true;
}
ok(threw,
"Should throw in non-strict mode when defining indexed property on " + obj);
}
for (var obj of [ document.forms, document.childNodes ]) {
indexedSetStrict(obj);
indexedSetNonStrict(obj);
}
</script>
</body>
</html>

View File

@ -1,49 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=905493
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 905493</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=905493">Mozilla Bug 905493</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_document_location_set_via_xray.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 905493 **/
function test()
{
var doc = document.getElementById("t").contentWindow.document;
ok(!("x" in doc), "Should have an Xray here");
is(doc.x, undefined, "Really should have an Xray here");
is(doc.wrappedJSObject.x, 5, "And wrapping the right thing");
document.getElementById("t").onload = function() {
ok(true, "Load happened");
SimpleTest.finish();
};
try {
// Test the forwarding location setter
doc.location = "chrome://mochikit/content/tests/SimpleTest/test.css";
} catch (e) {
// Load failed
ok(false, "Load failed");
SimpleTest.finish();
}
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1041731
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1041731</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=1041731">Mozilla Bug 1041731</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_document_location_set_via_xray.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 1041731 **/
function test()
{
var loc = document.getElementById("t").contentWindow.document.location;
is(loc.toString, loc.toString, "Unforgeable method on the Xray should be cached");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1221421
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1221421</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript">
var x = document.documentElement.style;
x.__proto__ = [1, 2, 3];
var res = 0;
for (var h = 0; h < 5000; ++h) {
res += x.length;
}
is(res, 15000, "length getter should return array length");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1221421">Mozilla Bug 1221421</a>
</body>
</html>

View File

@ -1,231 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=787070
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 787070</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=787070">Mozilla Bug 787070</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_dom_xrays.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 1021066 **/
var Cu = Components.utils;
// values should contain the values that the property should have on each of
// the objects on the prototype chain of obj. A value of undefined signals
// that the value should not be present on that prototype.
function checkXrayProperty(obj, name, values)
{
var instance = obj;
do {
var value = values.shift();
if (typeof value == "undefined") {
ok(!obj.hasOwnProperty(name), "hasOwnProperty shouldn't see \"" + name + "\" through Xrays");
is(Object.getOwnPropertyDescriptor(obj, name), undefined, "getOwnPropertyDescriptor shouldn't see \"" + name + "\" through Xrays");
ok(Object.keys(obj).indexOf(name) == -1, "Enumerating the Xray should not return \"" + name + "\"");
} else {
ok(obj.hasOwnProperty(name), "hasOwnProperty should see \"" + name + "\" through Xrays");
var pd = Object.getOwnPropertyDescriptor(obj, name);
ok(pd, "getOwnPropertyDescriptor should see \"" + name + "\" through Xrays");
if (pd && pd.get) {
is(pd.get.call(instance), value, "Should get the right value for \"" + name + "\" through Xrays");
} else {
is(obj[name], value, "Should get the right value for \"" + name + "\" through Xrays");
}
if (pd && pd.enumerable) {
ok(Object.keys(obj).indexOf("" + name) > -1, "Enumerating the Xray should return \"" + name + "\"");
}
}
} while ((obj = Object.getPrototypeOf(obj)));
}
function checkWindowXrayProperty(obj, name, windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue)
{
checkXrayProperty(obj, name, [ windowValue, windowPrototypeValue, namedPropertiesValue, eventTargetValue ]);
}
function test()
{
// Window
var win = document.getElementById("t").contentWindow;
var doc = document.getElementById("t").contentDocument;
var winProto = Object.getPrototypeOf(win);
is(winProto, win.Window.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
var namedPropertiesObject = Object.getPrototypeOf(winProto);
is(Cu.getClassName(namedPropertiesObject, /* unwrap = */ true), "WindowProperties", "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
var eventTargetProto = Object.getPrototypeOf(namedPropertiesObject);
is(eventTargetProto, win.EventTarget.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
// Xrays need to filter expandos.
checkWindowXrayProperty(win, "expando", undefined);
ok(!("expando" in win), "Xrays should filter expandos");
checkWindowXrayProperty(win, "shadowedIframe", undefined, undefined, doc.getElementById("shadowedIframe").contentWindow);
ok("shadowedIframe" in win, "Named properties should be exposed through Xrays");
// Named properties live on the named properties object for global objects.
checkWindowXrayProperty(win, "iframe", undefined, undefined, doc.getElementById("iframe").contentWindow);
ok("iframe" in win, "Named properties should be exposed through Xrays");
// Window properties live on the instance, shadowing the properties of the named property object.
checkWindowXrayProperty(win, "document", doc, undefined, doc.getElementById("document").contentWindow);
ok("document" in win, "WebIDL properties should be exposed through Xrays");
// Unforgeable properties live on the instance, shadowing the properties of the named property object.
checkWindowXrayProperty(win, "self", win, undefined, doc.getElementById("self").contentWindow);
ok("self" in win, "WebIDL properties should be exposed through Xrays");
// Object.prototype is at the end of the prototype chain.
var obj = win;
while ((proto = Object.getPrototypeOf(obj))) {
obj = proto;
}
is(obj, win.Object.prototype, "Object.prototype should be at the end of the prototype chain");
// Named properties shouldn't shadow WebIDL- or ECMAScript-defined properties.
checkWindowXrayProperty(win, "addEventListener", undefined, undefined, undefined, eventTargetProto.addEventListener);
is(win.addEventListener, eventTargetProto.addEventListener, "Named properties shouldn't shadow WebIDL-defined properties");
is(win.toString, win.Object.prototype.toString, "Named properties shouldn't shadow ECMAScript-defined properties");
// HTMLDocument
// Unforgeable properties live on the instance.
checkXrayProperty(doc, "location", [ win.location ]);
is(String(win.location), document.getElementById("t").src,
"Should have the right stringification");
// HTMLHtmlElement
var elem = doc.documentElement;
var elemProto = Object.getPrototypeOf(elem);
is(elemProto, win.HTMLHtmlElement.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
elemProto = Object.getPrototypeOf(elemProto);
is(elemProto, win.HTMLElement.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
elemProto = Object.getPrototypeOf(elemProto);
is(elemProto, win.Element.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
elemProto = Object.getPrototypeOf(elemProto);
is(elemProto, win.Node.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
elemProto = Object.getPrototypeOf(elemProto);
is(elemProto, win.EventTarget.prototype, "The proto chain of the Xray should mirror the prototype chain of the Xrayed object");
// Xrays need to filter expandos.
ok(!("expando" in elem), "Xrays should filter expandos");
// WebIDL-defined properties live on the prototype.
checkXrayProperty(elem, "version", [ undefined, "" ]);
is(elem.version, "", "WebIDL properties should be exposed through Xrays");
// HTMLCollection
var coll = doc.getElementsByTagName("iframe");
// Named properties live on the instance for non-global objects.
checkXrayProperty(coll, "iframe", [ doc.getElementById("iframe") ]);
// Indexed properties live on the instance.
checkXrayProperty(coll, 0, [ doc.getElementById("shadowedIframe") ]);
// WebIDL-defined properties live on the prototype, overriding any named properties.
checkXrayProperty(coll, "item", [ undefined, win.HTMLCollection.prototype.item ]);
// ECMAScript-defined properties live on the prototype, overriding any named properties.
checkXrayProperty(coll, "toString", [ undefined, undefined, win.Object.prototype.toString ]);
// Frozen arrays should come from our compartment, not the target one.
var languages1 = win.navigator.languages;
isnot(languages1, undefined, "Must have .languages");
ok(Array.isArray(languages1), ".languages should be an array");
ok(Object.isFrozen(languages1), ".languages should be a frozen array");
ok(!Cu.isXrayWrapper(languages1), "Should have our own version of array");
is(Cu.getGlobalForObject(languages1), window,
"languages1 should come from our window");
// We want to get .languages in the content compartment, but without waiving
// Xrays altogether.
var languages2 = win.eval("navigator.languages");
isnot(languages2, undefined, "Must still have .languages");
ok(Array.isArray(languages2), ".languages should still be an array");
ok(Cu.isXrayWrapper(languages2), "Should have xray for content version of array");
is(Cu.getGlobalForObject(languages2), win,
"languages2 come from the underlying window");
ok(Object.isFrozen(languages2.wrappedJSObject),
".languages should still be a frozen array underneath");
isnot(languages1, languages2, "Must have distinct arrays");
isnot(languages1, languages2.wrappedJSObject,
"Must have distinct arrays no matter how we slice it");
// Check that DataTransfer's .types has the hack to alias contains()
// to includes().
var dataTransfer = new win.DataTransfer();
is(dataTransfer.types.contains, dataTransfer.types.includes,
"Should have contains() set up as an alias to includes()");
// Waive Xrays on the dataTransfer itself, since the .types we get is
// different over Xrays vs not.
is(dataTransfer.wrappedJSObject.types.contains, undefined,
"Underlying object should not have contains() set up as an alias to " +
"includes()");
// Check that deleters work correctly in the [OverrideBuiltins] case.
var elem = win.document.documentElement;
var dataset = elem.dataset;
is(dataset.foo, undefined, "Should not have a 'foo' property");
ok(!('foo' in dataset), "Really should not have a 'foo' property");
is(elem.getAttribute("data-foo"), null,
"Should not have a 'data-foo' attribute");
ok(!elem.hasAttribute("data-foo"),
"Really should not have a 'data-foo' attribute");
dataset.foo = "bar";
is(dataset.foo, "bar", "Should now have a 'foo' property");
ok('foo' in dataset, "Really should have a 'foo' property");
is(elem.getAttribute("data-foo"), "bar",
"Should have a 'data-foo' attribute");
ok(elem.hasAttribute("data-foo"),
"Really should have a 'data-foo' attribute");
delete dataset.foo;
is(dataset.foo, undefined, "Should not have a 'foo' property again");
ok(!('foo' in dataset), "Really should not have a 'foo' property again");
is(elem.getAttribute("data-foo"), null,
"Should not have a 'data-foo' attribute again");
ok(!elem.hasAttribute("data-foo"),
"Really should not have a 'data-foo' attribute again");
// Check that deleters work correctly in the non-[OverrideBuiltins] case.
var storage = win.sessionStorage;
is(storage.foo, undefined, "Should not have a 'foo' property");
ok(!('foo' in storage), "Really should not have a 'foo' property");
is(storage.getItem("foo"), null, "Should not have an item named 'foo'");
storage.foo = "bar";
is(storage.foo, "bar", "Should have a 'foo' property");
ok('foo' in storage, "Really should have a 'foo' property");
is(storage.getItem("foo"), "bar", "Should have an item named 'foo'");
delete storage.foo
is(storage.foo, undefined, "Should not have a 'foo' property again");
ok(!('foo' in storage), "Really should not have a 'foo' property again");
is(storage.getItem("foo"), null, "Should not have an item named 'foo' again");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -1,15 +0,0 @@
<!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>

View File

@ -1,45 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1295322
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1295322</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=1295322">Mozilla Bug 1295322</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
<script type="application/javascript">
/** Test for Bug 1295322 **/
iframe = document.createElement('iframe');
iframe.name = "eWin";
document.body.appendChild(iframe);
try{
// NOTE: The idea here is to call something that will end up throwing an
// exception in a JS component and then propagate back to C++ code before
// returning to us. If opening a feed: URI stops doing that, we will need a
// new guinea pig here.
open('feed://java:script:codeshouldgohere','eWin');
ok(false, "Should have thrown!");
} catch(e){
try {
is(e.name, "NS_ERROR_UNEXPECTED", "Should have the right exception");
is(e.filename, location.href,
"Should not be seeing where the exception really came from");
} catch (e2) {
ok(false, "Should be able to work with the exception");
}
}
</script>
</body>
</html>

View File

@ -1,56 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=847119
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 847119</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 847119 **/
var xhr = new XMLHttpRequest();
var domthrows = function() { xhr.open(); }
var count = 20000;
function f() {
var k = 0;
for (var j = 0; j < count; ++j) {
try { domthrows(); } catch(e) { ++k; }
}
return k;
}
function g() { return count; }
is(f(), count, "Should get count exceptions");
for (var h of [f, g]) {
try { is(h(), count, "Should get count exceptions here too"); } catch (e) {}
}
ok(true, "We should get here");
var domthrows = function() { xhr.withCredentials = false; }
xhr.open("GET", "");
xhr.send();
is(f(), count, "Should get count exceptions from getter");
for (var h of [f, g]) {
try { is(h(), count, "Should get count exceptions from getter here too"); } catch (e) {}
}
ok(true, "We should get here too");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=847119">Mozilla Bug 847119</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,82 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=882653
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 882653</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 882653 **/
// Each test is a string to eval, the expected exception message, and the
// test description.
var tests = [
[ 'document.documentElement.appendChild.call({}, new Image())',
"'appendChild' called on an object that does not implement interface Node.",
"bogus method this object" ],
[ 'Object.getOwnPropertyDescriptor(Document.prototype, "documentElement").get.call({})',
"'get documentElement' called on an object that does not implement interface Document.",
"bogus getter this object" ],
[ 'Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML").set.call({})',
"'set innerHTML' called on an object that does not implement interface Element.",
"bogus setter this object" ],
[ 'document.documentElement.appendChild(5)',
"Argument 1 of Node.appendChild is not an object.",
"bogus interface argument" ],
[ 'document.documentElement.appendChild(null)',
"Argument 1 of Node.appendChild is not an object.",
"null interface argument" ],
[ 'document.createTreeWalker(document).currentNode = 5',
"Value being assigned to TreeWalker.currentNode is not an object.",
"interface setter call" ],
[ 'document.documentElement.appendChild({})',
"Argument 1 of Node.appendChild does not implement interface Node.",
"wrong interface argument" ],
[ 'document.createTreeWalker(document).currentNode = {}',
"Value being assigned to TreeWalker.currentNode does not implement interface Node.",
"wrong interface setter call" ],
[ 'document.createElement("canvas").getContext("2d").fill("bogus")',
"Argument 1 of CanvasRenderingContext2D.fill 'bogus' is not a valid value for enumeration CanvasWindingRule.",
"bogus enum value" ],
[ 'document.createTreeWalker(document, 0xFFFFFFFF, { acceptNode: 5 }).nextNode()',
"Property 'acceptNode' is not callable.",
"non-callable callback interface operation property" ],
[ '(new TextDecoder).decode(new Uint8Array(), new RegExp())',
"Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
"regexp passed for a dictionary" ],
[ 'URL.createObjectURL(null, null)',
"Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
"overload resolution failure" ],
[ 'document.createElement("select").add({})',
"Argument 1 of HTMLSelectElement.add could not be converted to any of: HTMLOptionElement, HTMLOptGroupElement.",
"invalid value passed for union" ],
[ 'document.createElement("canvas").getContext("2d").createLinearGradient(0, 1, 0, 1).addColorStop(NaN, "")',
"Argument 1 of CanvasGradient.addColorStop is not a finite floating-point value.",
"invalid float" ]
];
for (var i = 0; i < tests.length; ++i) {
msg = "Correct exception should be thrown for " + tests[i][2];
try {
eval(tests[i][0]);
ok(false, msg);
} catch (e) {
is(e.message, tests[i][1], msg);
}
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=882653">Mozilla Bug 882653</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,166 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1107592</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1107592 **/
SimpleTest.waitForExplicitFinish();
function doTest() {
var file = location.href;
var asyncFrame;
/* Async parent frames from pushPrefEnv don't show up in e10s. */
var isE10S = !SpecialPowers.isMainProcess();
if (!isE10S && SpecialPowers.getBoolPref("javascript.options.asyncstack")) {
asyncFrame = `Async*@${file}:153:3
`;
} else {
asyncFrame = "";
}
var t = new TestInterfaceJS();
try {
t.testThrowError();
} catch (e) {
ok(e instanceof Error, "Should have an Error here");
ok(!(e instanceof DOMException), "Should not have DOMException here");
ok(!("code" in e), "Should not have a 'code' property");
is(e.name, "Error", "Should not have an interesting name here");
is(e.message, "We are an Error", "Should have the right message");
is(e.stack,
`doTest@${file}:31:7
${asyncFrame}`,
"Exception stack should still only show our code");
is(e.fileName,
file,
"Should have the right file name");
is(e.lineNumber, 31, "Should have the right line number");
is(e.columnNumber, 7, "Should have the right column number");
}
try {
t.testThrowDOMException();
} catch (e) {
ok(e instanceof Error, "Should also have an Error here");
ok(e instanceof DOMException, "Should have DOMException here");
is(e.name, "NotSupportedError", "Should have the right name here");
is(e.message, "We are a DOMException",
"Should also have the right message");
is(e.code, DOMException.NOT_SUPPORTED_ERR,
"Should have the right 'code'");
is(e.stack,
`doTest@${file}:50:7
${asyncFrame}`,
"Exception stack should still only show our code");
is(e.filename,
file,
"Should still have the right file name");
is(e.lineNumber, 50, "Should still have the right line number");
todo_isnot(e.columnNumber, 0,
"No column number support for DOMException yet");
}
try {
t.testThrowTypeError();
} catch (e) {
ok(e instanceof TypeError, "Should have a TypeError here");
ok(!(e instanceof DOMException), "Should not have DOMException here (2)");
ok(!("code" in e), "Should not have a 'code' property (2)");
is(e.name, "TypeError", "Should be named TypeError");
is(e.message, "We are a TypeError",
"Should also have the right message (2)");
is(e.stack,
`doTest@${file}:72:7
${asyncFrame}`,
"Exception stack for TypeError should only show our code");
is(e.fileName,
file,
"Should still have the right file name for TypeError");
is(e.lineNumber, 72, "Should still have the right line number for TypeError");
is(e.columnNumber, 7, "Should have the right column number for TypeError");
}
try {
t.testThrowCallbackError(function() { Array.indexOf() });
} catch (e) {
ok(e instanceof TypeError, "Should have a TypeError here (3)");
ok(!(e instanceof DOMException), "Should not have DOMException here (3)");
ok(!("code" in e), "Should not have a 'code' property (3)");
is(e.name, "TypeError", "Should be named TypeError (3)");
is(e.message, "missing argument 0 when calling function Array.indexOf",
"Should also have the right message (3)");
is(e.stack,
`doTest/<@${file}:92:45
doTest@${file}:92:7
${asyncFrame}`,
"Exception stack for TypeError should only show our code (3)");
is(e.fileName,
file,
"Should still have the right file name for TypeError (3)");
is(e.lineNumber, 92, "Should still have the right line number for TypeError (3)");
is(e.columnNumber, 45, "Should have the right column number for TypeError (3)");
}
try {
t.testThrowXraySelfHosted();
} catch (e) {
ok(!(e instanceof Error), "Should have an Exception here (4)");
ok(!(e instanceof DOMException), "Should not have DOMException here (4)");
ok(!("code" in e), "Should not have a 'code' property (4)");
is(e.name, "NS_ERROR_UNEXPECTED", "Name should be sanitized (4)");
is(e.message, "", "Message should be sanitized (5)");
is(e.stack,
`doTest@${file}:113:7
${asyncFrame}`,
"Exception stack for sanitized exception should only show our code (4)");
is(e.filename,
file,
"Should still have the right file name for sanitized exception (4)");
is(e.lineNumber, 113, "Should still have the right line number for sanitized exception (4)");
todo_isnot(e.columnNumber, 0, "Should have the right column number for sanitized exception (4)");
}
try {
t.testThrowSelfHosted();
} catch (e) {
ok(!(e instanceof Error), "Should have an Exception here (5)");
ok(!(e instanceof DOMException), "Should not have DOMException here (5)");
ok(!("code" in e), "Should not have a 'code' property (5)");
is(e.name, "NS_ERROR_UNEXPECTED", "Name should be sanitized (5)");
is(e.message, "", "Message should be sanitized (5)");
is(e.stack,
`doTest@${file}:132:7
${asyncFrame}`,
"Exception stack for sanitized exception should only show our code (5)");
is(e.filename,
file,
"Should still have the right file name for sanitized exception (5)");
is(e.lineNumber, 132, "Should still have the right line number for sanitized exception (5)");
todo_isnot(e.columnNumber, 0, "Should have the right column number for sanitized exception (5)");
}
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug 1107592</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,56 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=923010
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 923010</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 923010 **/
try {
var conn = new RTCPeerConnection();
var candidate = new RTCIceCandidate({candidate: null });
conn.addIceCandidate(candidate)
.then(function() {
ok(false, "addIceCandidate succeeded when it should have failed");
}, function(reason) {
is(reason.lineNumber, 17, "Rejection should have been on line 17");
is(reason.message,
"Invalid candidate passed to addIceCandidate!",
"Should have the rejection we expect");
})
.catch(function(reason) {
ok(false, "unexpected error: " + reason);
});
} catch (e) {
// b2g has no WebRTC, apparently
todo(false, "No WebRTC on b2g yet");
}
conn.close();
try {
conn.setIdentityProvider("example.com", "foo");
ok(false, "That call to setIdentityProvider should have thrown");
} catch (e) {
is(e.lineNumber, 36, "Exception should have been on line 36");
is(e.message,
"Peer connection is closed",
"Should have the exception we expect");
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=923010">Mozilla Bug 923010</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,86 +0,0 @@
<!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");
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 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>

View File

@ -1,50 +0,0 @@
<!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.
var gl = $("c").getContext("experimental-webgl");
if (!gl) {
// No WebGL support on MacOS 10.5. Just skip this test
todo(false, "WebGL not supported");
return;
}
var error = gl.getError()
// on the b2g emulator we get GL_INVALID_FRAMEBUFFER_OPERATION
if (error == 0x0506) // GL_INVALID_FRAMEBUFFER_OPERATION
return;
is(error, 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>

View File

@ -1,28 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1084001
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1084001</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1084001 **/
is(Image.name, "Image", "Image name");
is(Promise.name, "Promise", "Promise name");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1084001">Mozilla Bug 1084001</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,47 +0,0 @@
<!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.");
}
try {
eventTargetToString = Function.prototype.toString.call(EventTarget);
is(eventTargetToString, nativeToString,
"Stringifying a DOM interface object via Function.prototype.toString " +
"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>

View File

@ -1,241 +0,0 @@
<!-- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ -->
<!DOCTYPE HTML>
<html>
<head>
<title>Test Iterable Interface</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
base_properties = [["entries", "function", 0],
["keys", "function", 0],
["values", "function", 0],
["forEach", "function", 1]]
var testExistence = function testExistence(prefix, obj, properties) {
for (var [name, type, args] of properties) {
// Properties are somewhere up the proto chain, hasOwnProperty won't work
isnot(obj[name], undefined,
`${prefix} object has property ${name}`);
is(typeof obj[name], type,
`${prefix} object property ${name} is a ${type}`);
// Check function length
if (type == "function") {
is(obj[name].length, args,
`${prefix} object property ${name} is length ${args}`);
is(obj[name].name, name,
`${prefix} object method name is ${name}`);
}
// Find where property is on proto chain, check for enumerablility there.
var owner = obj;
while (owner) {
var propDesc = Object.getOwnPropertyDescriptor(owner, name);
if (propDesc) {
ok(propDesc.enumerable,
`${prefix} object property ${name} is enumerable`);
break;
}
owner = Object.getPrototypeOf(owner);
}
}
}
var itr;
// Simple single type iterable creation and functionality test
info("IterableSingle: Testing simple iterable creation and functionality");
itr = new TestInterfaceIterableSingle();
testExistence("IterableSingle: ", itr, base_properties);
is(itr[Symbol.iterator], Array.prototype[Symbol.iterator],
"IterableSingle: Should be using %ArrayIterator% for @@iterator");
is(itr.keys, Array.prototype.keys,
"IterableSingle: Should be using %ArrayIterator% for 'keys'");
is(itr.entries, Array.prototype.entries,
"IterableSingle: Should be using %ArrayIterator% for 'entries'");
is(itr.values, itr[Symbol.iterator],
"IterableSingle: Should be using @@iterator for 'values'");
is(itr.forEach, Array.prototype.forEach,
"IterableSingle: Should be using %ArrayIterator% for 'forEach'");
var keys = [...itr.keys()];
var values = [...itr.values()];
var entries = [...itr.entries()];
var key_itr = itr.keys();
var value_itr = itr.values();
var entries_itr = itr.entries();
for (var i = 0; i < 3; ++i) {
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, i, "IterableSingle: Key iterator value should be " + i);
is(key.value, keys[i],
"IterableSingle: Key iterator value should match destructuring " + i);
is(value.value, key.value, "IterableSingle: Value iterator value should be " + key.value);
is(value.value, values[i],
"IterableSingle: Value iterator value should match destructuring " + i);
is(entry.value[0], i, "IterableSingle: Entry iterator value 0 should be " + i);
is(entry.value[1], i, "IterableSingle: Entry iterator value 1 should be " + i);
is(entry.value[0], entries[i][0],
"IterableSingle: Entry iterator value 0 should match destructuring " + i);
is(entry.value[1], entries[i][1],
"IterableSingle: Entry iterator value 1 should match destructuring " + i);
}
var callsToForEachCallback = 0;
var thisArg = {};
itr.forEach(function(value, index, obj) {
is(index, callsToForEachCallback,
`IterableSingle: Should have the right index at ${callsToForEachCallback} calls to forEach callback`);
is(value, values[index],
`IterableSingle: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
is(this, thisArg,
"IterableSingle: Should have the right this value for forEach callback");
is(obj, itr,
"IterableSingle: Should have the right third arg for forEach callback");
++callsToForEachCallback;
}, thisArg);
is(callsToForEachCallback, 3,
"IterableSingle: Should have right total number of calls to forEach callback");
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, undefined, "IterableSingle: Key iterator value should be undefined");
is(key.done, true, "IterableSingle: Key iterator done should be true");
is(value.value, undefined, "IterableSingle: Value iterator value should be undefined");
is(value.done, true, "IterableSingle: Value iterator done should be true");
is(entry.value, undefined, "IterableDouble: Entry iterator value should be undefined");
is(entry.done, true, "IterableSingle: Entry iterator done should be true");
is(Object.prototype.toString.call(Object.getPrototypeOf(key_itr)),
"[object Array Iterator]",
"iterator prototype should have the right brand");
// Simple dual type iterable creation and functionality test
info("IterableDouble: Testing simple iterable creation and functionality");
itr = new TestInterfaceIterableDouble();
testExistence("IterableDouble: ", itr, base_properties);
is(itr.entries, itr[Symbol.iterator],
"IterableDouble: Should be using @@iterator for 'entries'");
var elements = [["a", "b"], ["c", "d"], ["e", "f"]]
var keys = [...itr.keys()];
var values = [...itr.values()];
var entries = [...itr.entries()];
var key_itr = itr.keys();
var value_itr = itr.values();
var entries_itr = itr.entries();
for (var i = 0; i < 3; ++i) {
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, elements[i][0], "IterableDouble: Key iterator value should be " + elements[i][0]);
is(key.value, keys[i],
"IterableDouble: Key iterator value should match destructuring " + i);
is(value.value, elements[i][1], "IterableDouble: Value iterator value should be " + elements[i][1]);
is(value.value, values[i],
"IterableDouble: Value iterator value should match destructuring " + i);
is(entry.value[0], elements[i][0], "IterableDouble: Entry iterator value 0 should be " + elements[i][0]);
is(entry.value[1], elements[i][1], "IterableDouble: Entry iterator value 1 should be " + elements[i][1]);
is(entry.value[0], entries[i][0],
"IterableDouble: Entry iterator value 0 should match destructuring " + i);
is(entry.value[1], entries[i][1],
"IterableDouble: Entry iterator value 1 should match destructuring " + i);
}
callsToForEachCallback = 0;
thisArg = {};
itr.forEach(function(value, key, obj) {
is(key, keys[callsToForEachCallback],
`IterableDouble: Should have the right key at ${callsToForEachCallback} calls to forEach callback`);
is(value, values[callsToForEachCallback],
`IterableDouble: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
is(this, thisArg,
"IterableDouble: Should have the right this value for forEach callback");
is(obj, itr,
"IterableSingle: Should have the right third arg for forEach callback");
++callsToForEachCallback;
}, thisArg);
is(callsToForEachCallback, 3,
"IterableDouble: Should have right total number of calls to forEach callback");
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next()
is(key.value, undefined, "IterableDouble: Key iterator value should be undefined");
is(key.done, true, "IterableDouble: Key iterator done should be true");
is(value.value, undefined, "IterableDouble: Value iterator value should be undefined");
is(value.done, true, "IterableDouble: Value iterator done should be true");
is(entry.value, undefined, "IterableDouble: Entry iterator value should be undefined");
is(entry.done, true, "IterableDouble: Entry iterator done should be true");
is(Object.prototype.toString.call(Object.getPrototypeOf(key_itr)),
"[object TestInterfaceIterableDoubleIteratorPrototype]",
"iterator prototype should have the right brand");
// Simple dual type iterable creation and functionality test
info("IterableDoubleUnion: Testing simple iterable creation and functionality");
itr = new TestInterfaceIterableDoubleUnion();
testExistence("IterableDoubleUnion: ", itr, base_properties);
is(itr.entries, itr[Symbol.iterator],
"IterableDoubleUnion: Should be using @@iterator for 'entries'");
var elements = [["long", 1], ["string", "a"]]
var keys = [...itr.keys()];
var values = [...itr.values()];
var entries = [...itr.entries()];
var key_itr = itr.keys();
var value_itr = itr.values();
var entries_itr = itr.entries();
for (var i = 0; i < elements.length; ++i) {
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next();
is(key.value, elements[i][0], "IterableDoubleUnion: Key iterator value should be " + elements[i][0]);
is(key.value, keys[i],
"IterableDoubleUnion: Key iterator value should match destructuring " + i);
is(value.value, elements[i][1], "IterableDoubleUnion: Value iterator value should be " + elements[i][1]);
is(value.value, values[i],
"IterableDoubleUnion: Value iterator value should match destructuring " + i);
is(entry.value[0], elements[i][0], "IterableDoubleUnion: Entry iterator value 0 should be " + elements[i][0]);
is(entry.value[1], elements[i][1], "IterableDoubleUnion: Entry iterator value 1 should be " + elements[i][1]);
is(entry.value[0], entries[i][0],
"IterableDoubleUnion: Entry iterator value 0 should match destructuring " + i);
is(entry.value[1], entries[i][1],
"IterableDoubleUnion: Entry iterator value 1 should match destructuring " + i);
}
callsToForEachCallback = 0;
thisArg = {};
itr.forEach(function(value, key, obj) {
is(key, keys[callsToForEachCallback],
`IterableDoubleUnion: Should have the right key at ${callsToForEachCallback} calls to forEach callback`);
is(value, values[callsToForEachCallback],
`IterableDoubleUnion: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
is(this, thisArg,
"IterableDoubleUnion: Should have the right this value for forEach callback");
is(obj, itr,
"IterableSingle: Should have the right third arg for forEach callback");
++callsToForEachCallback;
}, thisArg);
is(callsToForEachCallback, 2,
"IterableDoubleUnion: Should have right total number of calls to forEach callback");
var key = key_itr.next();
var value = value_itr.next();
var entry = entries_itr.next()
is(key.value, undefined, "IterableDoubleUnion: Key iterator value should be undefined");
is(key.done, true, "IterableDoubleUnion: Key iterator done should be true");
is(value.value, undefined, "IterableDoubleUnion: Value iterator value should be undefined");
is(value.done, true, "IterableDoubleUnion: Value iterator done should be true");
is(entry.value, undefined, "IterableDoubleUnion: Entry iterator value should be undefined");
is(entry.done, true, "IterableDoubleUnion: Entry iterator done should be true");
is(Object.prototype.toString.call(Object.getPrototypeOf(key_itr)),
"[object TestInterfaceIterableDoubleUnionIteratorPrototype]",
"iterator prototype should have the right brand");
SimpleTest.finish();
});
</script>
</body>
</html>

View File

@ -1,47 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1186696
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1186696</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1186696 **/
SimpleTest.waitForExplicitFinish();
function doTest() {
var values = [ function() {}, 5, null, undefined, "some string", {} ];
while (values.length != 0) {
var value = values.pop();
var t = new TestInterfaceJS();
t.onsomething = value;
var gottenValue = t.onsomething;
if (typeof value == "object" || typeof value == "function") {
is(gottenValue, value, "Should get back the object-or-null we put in");
} else {
is(gottenValue, null, "Should get back null");
}
}
SimpleTest.finish();
}
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1186696">Mozilla Bug 1186696</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,85 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="runTest();">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function Listener(aBrowser, aPrerendered, aCallback) {
this.init(aBrowser, aPrerendered, aCallback);
}
Listener.prototype = {
init: function(aBrowser, aCallback) {
this.mBrowser = aBrowser;
this.mCallback = aCallback;
},
QueryInterface: function(aIID) {
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) {
if ((aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) &&
(aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_DOCUMENT)) {
setTimeout(this.mCallback, 0);
}
},
onProgressChange : function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {},
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) {},
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) {},
onSecurityChange : function(aWebProgress, aRequest, aState) {},
mBrowser: null,
mPrerendered: false,
mCallback: null
};
var progress, progressListener;
function runTest() {
SpecialPowers.pushPrefEnv({
"set": [
["dom.max_script_run_time", 1]
]
}, function() {
test(function() {
ok("The page is successfully interrupted.");
SimpleTest.finish();
});
});
}
function test(aCallback) {
var browser = document.getElementById("prerendered");;
progressListener = new Listener(browser, aCallback);
var docShell = browser.docShell;
progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebProgress);
progress.addProgressListener(progressListener,
Components.interfaces.nsIWebProgress.NOTIFY_ALL);
browser.loadURI("data:text/html,<script>;for(;;);</script" + ">");
}
]]>
</script>
<body id="html_body" xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1050456">Mozilla Bug 1050456</a>
<p id="display"></p>
<pre id="test">
</pre>
</body>
<browser prerendered="true" id="prerendered"/>
</window>

View File

@ -1,27 +0,0 @@
<!doctype html>
<meta charset=utf-8>
<title>[LenientThis]</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
function noop1() { }
function noop2() { }
test(function() {
var desc = Object.getOwnPropertyDescriptor(Document.prototype, "onreadystatechange");
document.onreadystatechange = noop1;
assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1");
assert_equals(desc.get.call({ }), undefined, "document.onreadystatechange getter.call({}) == undefined");
}, "invoking Document.onreadystatechange's getter with an invalid this object returns undefined");
test(function() {
var desc = Object.getOwnPropertyDescriptor(Document.prototype, "onreadystatechange");
document.onreadystatechange = noop1;
assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1");
assert_equals(desc.set.call({ }, noop2), undefined, "document.onreadystatechange setter.call({}) == undefined");
assert_equals(document.onreadystatechange, noop1, "document.onreadystatechange == noop1 (still)");
}, "invoking Document.onreadystatechange's setter with an invalid this object does nothing and returns undefined");
</script>

View File

@ -1,49 +0,0 @@
<!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>

View File

@ -1,36 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=808991
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 808991</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=808991">Mozilla Bug 808991</a>
<p id="display"></p>
<div id="content" style="display: none" data-1="foo" data-bar="baz">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 808991 **/
is($("content").dataset[1], "foo",
"Indexed props should work like named on dataset");
is($("content").dataset["1"], "foo",
"Indexed props as strings should work like named on dataset");
is($("content").dataset.bar, "baz",
"Named props should work on dataset");
is($("content").dataset['bar'], "baz",
"Named props as strings should work on dataset");
</script>
</pre>
</body>
</html>

View File

@ -1,40 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Test for named getter enumerability</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var list = document.getElementsByTagName("div");
var desc = Object.getOwnPropertyDescriptor(list, "0");
assert_equals(typeof desc, "object", "Should have a '0' property");
assert_true(desc.enumerable, "'0' property should be enumerable");
desc = Object.getOwnPropertyDescriptor(list, "log");
assert_equals(typeof desc, "object", "Should have a 'log' property");
assert_false(desc.enumerable, "'log' property should not be enumerable");
}, "Correct getOwnPropertyDescriptor behavior");
test(function() {
var list = document.getElementsByTagName("div");
props = [];
for (var prop in list) {
props.push(prop);
}
assert_not_equals(props.indexOf("0"), -1, "Should enumerate '0'");
assert_equals(props.indexOf("log"), -1, "Should not enumerate 'log'");
}, "Correct enumeration behavior");
test(function() {
var list = document.getElementsByTagName("div");
props = Object.keys(list)
assert_not_equals(props.indexOf("0"), -1, "Keys should contain '0'");
assert_equals(props.indexOf("log"), -1, "Keys should not contain 'log'");
}, "Correct keys() behavior");
test(function() {
var list = document.getElementsByTagName("div");
props = Object.getOwnPropertyNames(list)
assert_not_equals(props.indexOf("0"), -1,
"own prop names should contain '0'");
assert_not_equals(props.indexOf("log"), -1,
"own prop names should contain 'log'");
}, "Correct getOwnPropertyNames() behavior");
</script>

View File

@ -1,42 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=
-->
<head>
<meta charset="utf-8">
<title>Test for Bug </title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug **/
SimpleTest.waitForExplicitFinish();
SimpleTest.expectUncaughtException();
setTimeout(function() {
SpecialPowers.Cu.getJSTestingFunctions().throwOutOfMemory();
}, 0);
addEventListener("error", function(e) {
is(e.type, "error", "Should have an error event");
is(e.message, "uncaught exception: out of memory",
"Should have the right error message");
// Make sure we finish async, in case the expectUncaughtException assertion
// about having seen the exception runs after our listener
SimpleTest.executeSoon(SimpleTest.finish);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,45 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=603201
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 603201</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 603201 **/
SimpleTest.waitForExplicitFinish();
function runTest()
{
var nodes = document.body.childNodes;
Object.setPrototypeOf(Number.prototype, nodes);
Object.defineProperty(nodes, "getter", {get: function() {
"use strict";
is(this, 1);
return "getter";
}});
Object.defineProperty(Object.getPrototypeOf(nodes), "getter2", {get: function() {
"use strict";
is(this, 1);
return "getter2";
}});
var number = 1;
is(number.getter, "getter");
is(number.getter2, "getter2");
SimpleTest.finish();
}
</script>
</head>
<body onload="runTest();">
<pre>Test</pre>
</body>
</html>

View File

@ -1,143 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1107592</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1107592 **/
SimpleTest.waitForExplicitFinish();
function checkExn(lineNumber, name, message, code, filename, testNumber, stack, exn) {
is(exn.lineNumber, lineNumber,
"Should have the right line number in test " + testNumber);
is(exn.name, name,
"Should have the right exception name in test " + testNumber);
is("filename" in exn ? exn.filename : exn.fileName, filename,
"Should have the right file name in test " + testNumber);
is(exn.message, message,
"Should have the right message in test " + testNumber);
is(exn.code, code, "Should have the right .code in test " + testNumber);
if (message === "") {
is(exn.name, "InternalError",
"Should have one of our synthetic exceptions in test " + testNumber);
}
is(exn.stack, stack, "Should have the right stack in test " + testNumber);
}
function ensurePromiseFail(testNumber, value) {
ok(false, "Test " + testNumber + " should not have a fulfilled promise");
}
function doTest() {
var t = new TestInterfaceJS();
/* Async parent frames from pushPrefEnv don't show up in e10s. */
var isE10S = !SpecialPowers.isMainProcess();
var asyncStack = SpecialPowers.getBoolPref("javascript.options.asyncstack");
var ourFile = location.href;
var unwrapError = "Promise rejection value is a non-unwrappable cross-compartment wrapper.";
var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:130:3
` : "";
Promise.all([
t.testPromiseWithThrowingChromePromiseInit().then(
ensurePromiseFail.bind(null, 1),
checkExn.bind(null, 49, "InternalError", unwrapError,
undefined, ourFile, 1,
`doTest@${ourFile}:49:7
` +
parentFrame)),
t.testPromiseWithThrowingContentPromiseInit(function() {
thereIsNoSuchContentFunction1();
}).then(
ensurePromiseFail.bind(null, 2),
checkExn.bind(null, 57, "ReferenceError",
"thereIsNoSuchContentFunction1 is not defined",
undefined, ourFile, 2,
`doTest/<@${ourFile}:57:11
doTest@${ourFile}:56:7
` +
parentFrame)),
t.testPromiseWithThrowingChromeThenFunction().then(
ensurePromiseFail.bind(null, 3),
checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 3, asyncStack ? (`Async*doTest@${ourFile}:67:7
` +
parentFrame) : "")),
t.testPromiseWithThrowingContentThenFunction(function() {
thereIsNoSuchContentFunction2();
}).then(
ensurePromiseFail.bind(null, 4),
checkExn.bind(null, 73, "ReferenceError",
"thereIsNoSuchContentFunction2 is not defined",
undefined, ourFile, 4,
`doTest/<@${ourFile}:73:11
` +
(asyncStack ? `Async*doTest@${ourFile}:72:7
` : "") +
parentFrame)),
t.testPromiseWithThrowingChromeThenable().then(
ensurePromiseFail.bind(null, 5),
checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 5, asyncStack ? (`Async*doTest@${ourFile}:84:7
` +
parentFrame) : "")),
t.testPromiseWithThrowingContentThenable({
then: function() { thereIsNoSuchContentFunction3(); }
}).then(
ensurePromiseFail.bind(null, 6),
checkExn.bind(null, 90, "ReferenceError",
"thereIsNoSuchContentFunction3 is not defined",
undefined, ourFile, 6,
`then@${ourFile}:90:32
` + (asyncStack ? `Async*doTest@${ourFile}:89:7\n` + parentFrame : ""))),
t.testPromiseWithDOMExceptionThrowingPromiseInit().then(
ensurePromiseFail.bind(null, 7),
checkExn.bind(null, 98, "NotFoundError",
"We are a second DOMException",
DOMException.NOT_FOUND_ERR, ourFile, 7,
`doTest@${ourFile}:98:7
` +
parentFrame)),
t.testPromiseWithDOMExceptionThrowingThenFunction().then(
ensurePromiseFail.bind(null, 8),
checkExn.bind(null, asyncStack ? 106 : 0, "NetworkError",
"We are a third DOMException",
DOMException.NETWORK_ERR, asyncStack ? ourFile : "", 8,
(asyncStack ? `Async*doTest@${ourFile}:106:7
` +
parentFrame : ""))),
t.testPromiseWithDOMExceptionThrowingThenable().then(
ensurePromiseFail.bind(null, 9),
checkExn.bind(null, asyncStack ? 114 : 0, "TypeMismatchError",
"We are a fourth DOMException",
DOMException.TYPE_MISMATCH_ERR,
asyncStack ? ourFile : "", 9,
(asyncStack ? `Async*doTest@${ourFile}:114:7
` +
parentFrame : ""))),
]).then(SimpleTest.finish,
function(err) {
ok(false, "One of our catch statements totally failed with err" + err + ', stack: ' + (err ? err.stack : ''));
SimpleTest.finish();
});
}
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug 1107592</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,99 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1021066
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1021066</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=1021066">Mozilla Bug 1021066</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_proxies_via_xray.html"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 1021066 **/
function test()
{
"use strict"; // So we'll get exceptions on sets
var doc = document.getElementById("t").contentWindow.document;
ok(!("x" in doc), "Should have an Xray here");
is(doc.x, undefined, "Really should have an Xray here");
is(doc.wrappedJSObject.x, 5, "And wrapping the right thing");
// Test overridebuiltins binding without named setter
is(doc.y, doc.getElementById("y"),
"Named getter should work on Document");
try {
doc.z = 5;
ok(false, "Should have thrown on set of readonly property on Document");
} catch (e) {
ok(/read-only/.test(e.message),
"Threw the right exception on set of readonly property on Document");
}
doc.w = 5;
is(doc.w, 5, "Should be able to set things that are not named props");
// Test non-overridebuiltins binding without named setter
var l = doc.getElementsByTagName("img");
is(l.y, doc.getElementById("y"),
"Named getter should work on HTMLCollection");
try {
l.z = 5;
ok(false, "Should have thrown on set of readonly property on HTMLCollection");
} catch (e) {
ok(/read-only/.test(e.message),
"Should throw the right exception on set of readonly property on HTMLCollection");
}
try {
l[10] = 5;
ok(false, "Should have thrown on set of indexed property on HTMLCollection");
} catch (e) {
ok(/doesn't have an indexed property setter/.test(e.message),
"Should throw the right exception on set of indexed property on HTMLCollection");
}
// Test overridebuiltins binding with named setter
var d = doc.documentElement.dataset;
d.foo = "bar";
// Check that this actually got passed on to the underlying object.
is(d.wrappedJSObject.foo, "bar",
"Set should get forwarded to the underlying object");
is(doc.documentElement.getAttribute("data-foo"), "bar",
"Attribute setter should have been called");
d.foo = "baz";
// Check that this actually got passed on to the underlying object.
is(d.wrappedJSObject.foo, "baz",
"Set should get forwarded to the underlying object again");
is(doc.documentElement.getAttribute("data-foo"), "baz",
"Attribute setter should have been called again");
// Test non-overridebuiltins binding with named setter
var s = doc.defaultView.localStorage;
s["test_proxies_via_xray"] = "bar";
// Check that this actually got passed on to the underlying object.
is(s.wrappedJSObject["test_proxies_via_xray"], "bar",
"Set should get forwarded to the underlying object without overridebuiltins");
s["test_proxies_via_xray"] = "baz";
// Check that this actually got passed on to the underlying object.
is(s.wrappedJSObject["test_proxies_via_xray"], "baz",
"Set should get forwarded to the underlying object again without overridebuiltins");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
</script>
</pre>
</body>
</html>

View File

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=827546
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 827546</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 827546 **/
var notEditable = document.createElement("div");
var thrown;
try {
thrown = false;
SpecialPowers.do_QueryInterface(notEditable, "nsIDOMNSEditableElement");
} catch (e) {
thrown = true;
}
ok(thrown,
"QI to nsIDOMNSEditableElement on a non-editable element should fail");
var editable = document.createElement("input");
ok(SpecialPowers.do_QueryInterface(editable, "nsIDOMNSEditableElement"),
"Editable element needs to support QI to nsIDOMNSEditableElement");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=827546">Mozilla Bug 827546</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,59 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1048659
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1048659</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for returning unions from JS-implemented WebIDL. **/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
function go() {
var t = new TestInterfaceJS();
var t2 = new TestInterfaceJS();
is(t.pingPongUnion(t2), t2, "ping pong union for left case should be identity");
is(t.pingPongUnion(12), 12, "ping pong union for right case should be identity");
is(t.pingPongUnionContainingNull("this is not a string"), "this is not a string",
"ping pong union containing union for left case should be identity");
is(t.pingPongUnionContainingNull(null), null,
"ping pong union containing null for right case null should be identity");
is(t.pingPongUnionContainingNull(t2), t2,
"ping pong union containing null for right case should be identity");
is(t.pingPongNullableUnion(t2), t2, "ping pong nullable union for left case should be identity");
is(t.pingPongNullableUnion(12), 12, "ping pong nullable union for right case should be identity");
is(t.pingPongNullableUnion(null), null, "ping pong nullable union for null case should be identity");
var rejectedBadUnion = false;
var result = null;
try {
result = t.returnBadUnion();
} catch (e) {
rejectedBadUnion = true;
}
is(result, null, "bad union should not set a value for result");
ok(rejectedBadUnion, "bad union should throw an exception");
SimpleTest.finish();
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1048659">Mozilla Bug 1048659</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,53 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1066432
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1066432</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1066432 **/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, function() {
var testInterfaceJS = new TestInterfaceJS();
ok(testInterfaceJS, "got a TestInterfaceJS object");
var nonIterableObject = {[Symbol.iterator]: 5};
try {
testInterfaceJS.testSequenceOverload(nonIterableObject);
ok(false, "Should have thrown in the overload case"); // see long comment above!
} catch (e) {
is(e.name, "TypeError", "Should get a TypeError for the overload case");
ok(e.message.includes("not iterable"),
"Should have a message about being non-iterable in the overload case");
}
try {
testInterfaceJS.testSequenceUnion(nonIterableObject);
ok(false, "Should have thrown in the union case");
} catch (e) {
is(e.name, "TypeError", "Should get a TypeError for the union case");
ok(e.message.includes("not iterable"),
"Should have a message about being non-iterable in the union case");
}
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1066432">Mozilla Bug 1066432</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,59 +0,0 @@
<!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() {
var gl = $("c").getContext("experimental-webgl");
if (!gl) {
// 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>

View File

@ -1,40 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1043690
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1043690</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=1043690">Mozilla Bug 1043690</a>
<p id="display"></p>
<div id="content" style="display: none">
<form>
<input name="action">
</form>
</div>
<script type="application/javascript">
/** Test for Bug 1043690 **/
var f = document.querySelector("form");
var i = document.querySelector("input");
is(f.getAttribute("action"), null, "Should have no action attribute");
is(f.action, i, "form.action should be the input");
f.action = "http://example.org";
is(f.getAttribute("action"), "http://example.org",
"Should have an action attribute now");
is(f.action, i, "form.action should still be the input");
i.remove();
is(f.action, "http://example.org/",
"form.action should no longer be shadowed");
</script>
<pre id="test">
</pre>
</body>
</html>

View File

@ -1,59 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1334537
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1334537</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1334537 **/
SimpleTest.waitForExplicitFinish();
function go() {
// Need a new global that will pick up our pref.
var ifr = document.createElement("iframe");
document.body.appendChild(ifr);
var t = new ifr.contentWindow.TestFunctions();
var testString = "abcdefghijklmnopqrstuvwxyz";
const substringLength = 10;
var shortTestString = testString.substring(0, substringLength);
t.setStringData(testString);
// Note: we want to do all our gets before we start running code we don't
// control inside the test harness, if we really want to exercise the string
// cache in controlled ways.
var asShortDOMString = t.getStringDataAsDOMString(substringLength);
var asFullDOMString = t.getStringDataAsDOMString();
var asShortAString = t.getStringDataAsAString(substringLength);
var asAString = t.getStringDataAsAString();
is(asShortAString, shortTestString, "Short DOMString should be short");
is(asFullDOMString, testString, "Full DOMString should be test string");
is(asShortAString, shortTestString, "Short AString should be short");
is(asAString, testString, "Full AString should be test string");
SimpleTest.finish();
}
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
go);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1334537">Mozilla Bug 1334537</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More