aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen/parser/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/bindings/codegen/parser/tests')
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py13
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py84
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_attr.py302
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py67
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py11
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py41
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_callback.py34
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py47
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_const.py64
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py75
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py28
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py15
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py198
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py150
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py84
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_enum.py81
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py13
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py20
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py28
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py107
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py15
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_implements.py216
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py18
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py44
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_interface.py188
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py15
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py60
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_method.py145
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py126
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_overload.py47
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py7
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py294
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py73
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py62
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py56
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py76
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_union.py169
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py14
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py53
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py10
-rw-r--r--src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py39
48 files changed, 0 insertions, 3287 deletions
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py b/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py
deleted file mode 100644
index e3b690bf6f1..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_any_null.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface DoubleNull {
- attribute any? foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py b/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py
deleted file mode 100644
index eb1f6d3c92e..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_argument_identifier_conflicts.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface ArgumentIdentifierConflict {
- void foo(boolean arg1, boolean arg1);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py b/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py
deleted file mode 100644
index ef8c2229aed..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_argument_novoid.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface VoidArgument1 {
- void foo(void arg2);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py b/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py
deleted file mode 100644
index 26528984595..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_array_of_interface.py
+++ /dev/null
@@ -1,13 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface A {
- attribute long a;
- };
-
- interface B {
- attribute A[] b;
- };
- """);
- parser.finish()
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py b/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py
deleted file mode 100644
index 5b8e56f86ca..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_arraybuffer.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestArrayBuffer {
- attribute ArrayBuffer bufferAttr;
- void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, ArrayBuffer[] arg3, sequence<ArrayBuffer> arg4);
-
- attribute ArrayBufferView viewAttr;
- void viewMethod(ArrayBufferView arg1, ArrayBufferView? arg2, ArrayBufferView[] arg3, sequence<ArrayBufferView> arg4);
-
- attribute Int8Array int8ArrayAttr;
- void int8ArrayMethod(Int8Array arg1, Int8Array? arg2, Int8Array[] arg3, sequence<Int8Array> arg4);
-
- attribute Uint8Array uint8ArrayAttr;
- void uint8ArrayMethod(Uint8Array arg1, Uint8Array? arg2, Uint8Array[] arg3, sequence<Uint8Array> arg4);
-
- attribute Uint8ClampedArray uint8ClampedArrayAttr;
- void uint8ClampedArrayMethod(Uint8ClampedArray arg1, Uint8ClampedArray? arg2, Uint8ClampedArray[] arg3, sequence<Uint8ClampedArray> arg4);
-
- attribute Int16Array int16ArrayAttr;
- void int16ArrayMethod(Int16Array arg1, Int16Array? arg2, Int16Array[] arg3, sequence<Int16Array> arg4);
-
- attribute Uint16Array uint16ArrayAttr;
- void uint16ArrayMethod(Uint16Array arg1, Uint16Array? arg2, Uint16Array[] arg3, sequence<Uint16Array> arg4);
-
- attribute Int32Array int32ArrayAttr;
- void int32ArrayMethod(Int32Array arg1, Int32Array? arg2, Int32Array[] arg3, sequence<Int32Array> arg4);
-
- attribute Uint32Array uint32ArrayAttr;
- void uint32ArrayMethod(Uint32Array arg1, Uint32Array? arg2, Uint32Array[] arg3, sequence<Uint32Array> arg4);
-
- attribute Float32Array float32ArrayAttr;
- void float32ArrayMethod(Float32Array arg1, Float32Array? arg2, Float32Array[] arg3, sequence<Float32Array> arg4);
-
- attribute Float64Array float64ArrayAttr;
- void float64ArrayMethod(Float64Array arg1, Float64Array? arg2, Float64Array[] arg3, sequence<Float64Array> arg4);
- };
- """)
-
- results = parser.finish()
-
- iface = results[0]
-
- harness.ok(True, "TestArrayBuffer interface parsed without error")
- harness.check(len(iface.members), 22, "Interface should have twenty two members")
-
- members = iface.members
-
- def checkStuff(attr, method, t):
- harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Expect an IDLAttribute")
- harness.ok(isinstance(method, WebIDL.IDLMethod), "Expect an IDLMethod")
-
- harness.check(str(attr.type), t, "Expect an ArrayBuffer type")
- harness.ok(attr.type.isSpiderMonkeyInterface(), "Should test as a js interface")
-
- (retType, arguments) = method.signatures()[0]
- harness.ok(retType.isVoid(), "Should have a void return type")
- harness.check(len(arguments), 4, "Expect 4 arguments")
-
- harness.check(str(arguments[0].type), t, "Expect an ArrayBuffer type")
- harness.ok(arguments[0].type.isSpiderMonkeyInterface(), "Should test as a js interface")
-
- harness.check(str(arguments[1].type), t + "OrNull", "Expect an ArrayBuffer type")
- harness.ok(arguments[1].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
-
- harness.check(str(arguments[2].type), t + "Array", "Expect an ArrayBuffer type")
- harness.ok(arguments[2].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
-
- harness.check(str(arguments[3].type), t + "Sequence", "Expect an ArrayBuffer type")
- harness.ok(arguments[3].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
-
-
- checkStuff(members[0], members[1], "ArrayBuffer")
- checkStuff(members[2], members[3], "ArrayBufferView")
- checkStuff(members[4], members[5], "Int8Array")
- checkStuff(members[6], members[7], "Uint8Array")
- checkStuff(members[8], members[9], "Uint8ClampedArray")
- checkStuff(members[10], members[11], "Int16Array")
- checkStuff(members[12], members[13], "Uint16Array")
- checkStuff(members[14], members[15], "Int32Array")
- checkStuff(members[16], members[17], "Uint32Array")
- checkStuff(members[18], members[19], "Float32Array")
- checkStuff(members[20], members[21], "Float64Array")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py b/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py
deleted file mode 100644
index 6b6142b6243..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_attr.py
+++ /dev/null
@@ -1,302 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- testData = [("::TestAttr%s::b", "b", "Byte%s", False),
- ("::TestAttr%s::rb", "rb", "Byte%s", True),
- ("::TestAttr%s::o", "o", "Octet%s", False),
- ("::TestAttr%s::ro", "ro", "Octet%s", True),
- ("::TestAttr%s::s", "s", "Short%s", False),
- ("::TestAttr%s::rs", "rs", "Short%s", True),
- ("::TestAttr%s::us", "us", "UnsignedShort%s", False),
- ("::TestAttr%s::rus", "rus", "UnsignedShort%s", True),
- ("::TestAttr%s::l", "l", "Long%s", False),
- ("::TestAttr%s::rl", "rl", "Long%s", True),
- ("::TestAttr%s::ul", "ul", "UnsignedLong%s", False),
- ("::TestAttr%s::rul", "rul", "UnsignedLong%s", True),
- ("::TestAttr%s::ll", "ll", "LongLong%s", False),
- ("::TestAttr%s::rll", "rll", "LongLong%s", True),
- ("::TestAttr%s::ull", "ull", "UnsignedLongLong%s", False),
- ("::TestAttr%s::rull", "rull", "UnsignedLongLong%s", True),
- ("::TestAttr%s::str", "str", "String%s", False),
- ("::TestAttr%s::rstr", "rstr", "String%s", True),
- ("::TestAttr%s::obj", "obj", "Object%s", False),
- ("::TestAttr%s::robj", "robj", "Object%s", True),
- ("::TestAttr%s::object", "object", "Object%s", False),
- ("::TestAttr%s::f", "f", "Float%s", False),
- ("::TestAttr%s::rf", "rf", "Float%s", True)]
-
- parser.parse("""
- interface TestAttr {
- attribute byte b;
- readonly attribute byte rb;
- attribute octet o;
- readonly attribute octet ro;
- attribute short s;
- readonly attribute short rs;
- attribute unsigned short us;
- readonly attribute unsigned short rus;
- attribute long l;
- readonly attribute long rl;
- attribute unsigned long ul;
- readonly attribute unsigned long rul;
- attribute long long ll;
- readonly attribute long long rll;
- attribute unsigned long long ull;
- readonly attribute unsigned long long rull;
- attribute DOMString str;
- readonly attribute DOMString rstr;
- attribute object obj;
- readonly attribute object robj;
- attribute object _object;
- attribute float f;
- readonly attribute float rf;
- };
-
- interface TestAttrNullable {
- attribute byte? b;
- readonly attribute byte? rb;
- attribute octet? o;
- readonly attribute octet? ro;
- attribute short? s;
- readonly attribute short? rs;
- attribute unsigned short? us;
- readonly attribute unsigned short? rus;
- attribute long? l;
- readonly attribute long? rl;
- attribute unsigned long? ul;
- readonly attribute unsigned long? rul;
- attribute long long? ll;
- readonly attribute long long? rll;
- attribute unsigned long long? ull;
- readonly attribute unsigned long long? rull;
- attribute DOMString? str;
- readonly attribute DOMString? rstr;
- attribute object? obj;
- readonly attribute object? robj;
- attribute object? _object;
- attribute float? f;
- readonly attribute float? rf;
- };
-
- interface TestAttrArray {
- attribute byte[] b;
- readonly attribute byte[] rb;
- attribute octet[] o;
- readonly attribute octet[] ro;
- attribute short[] s;
- readonly attribute short[] rs;
- attribute unsigned short[] us;
- readonly attribute unsigned short[] rus;
- attribute long[] l;
- readonly attribute long[] rl;
- attribute unsigned long[] ul;
- readonly attribute unsigned long[] rul;
- attribute long long[] ll;
- readonly attribute long long[] rll;
- attribute unsigned long long[] ull;
- readonly attribute unsigned long long[] rull;
- attribute DOMString[] str;
- readonly attribute DOMString[] rstr;
- attribute object[] obj;
- readonly attribute object[] robj;
- attribute object[] _object;
- attribute float[] f;
- readonly attribute float[] rf;
- };
-
- interface TestAttrNullableArray {
- attribute byte[]? b;
- readonly attribute byte[]? rb;
- attribute octet[]? o;
- readonly attribute octet[]? ro;
- attribute short[]? s;
- readonly attribute short[]? rs;
- attribute unsigned short[]? us;
- readonly attribute unsigned short[]? rus;
- attribute long[]? l;
- readonly attribute long[]? rl;
- attribute unsigned long[]? ul;
- readonly attribute unsigned long[]? rul;
- attribute long long[]? ll;
- readonly attribute long long[]? rll;
- attribute unsigned long long[]? ull;
- readonly attribute unsigned long long[]? rull;
- attribute DOMString[]? str;
- readonly attribute DOMString[]? rstr;
- attribute object[]? obj;
- readonly attribute object[]? robj;
- attribute object[]? _object;
- attribute float[]? f;
- readonly attribute float[]? rf;
- };
-
- interface TestAttrArrayOfNullableTypes {
- attribute byte?[] b;
- readonly attribute byte?[] rb;
- attribute octet?[] o;
- readonly attribute octet?[] ro;
- attribute short?[] s;
- readonly attribute short?[] rs;
- attribute unsigned short?[] us;
- readonly attribute unsigned short?[] rus;
- attribute long?[] l;
- readonly attribute long?[] rl;
- attribute unsigned long?[] ul;
- readonly attribute unsigned long?[] rul;
- attribute long long?[] ll;
- readonly attribute long long?[] rll;
- attribute unsigned long long?[] ull;
- readonly attribute unsigned long long?[] rull;
- attribute DOMString?[] str;
- readonly attribute DOMString?[] rstr;
- attribute object?[] obj;
- readonly attribute object?[] robj;
- attribute object?[] _object;
- attribute float?[] f;
- readonly attribute float?[] rf;
- };
-
- interface TestAttrNullableArrayOfNullableTypes {
- attribute byte?[]? b;
- readonly attribute byte?[]? rb;
- attribute octet?[]? o;
- readonly attribute octet?[]? ro;
- attribute short?[]? s;
- readonly attribute short?[]? rs;
- attribute unsigned short?[]? us;
- readonly attribute unsigned short?[]? rus;
- attribute long?[]? l;
- readonly attribute long?[]? rl;
- attribute unsigned long?[]? ul;
- readonly attribute unsigned long?[]? rul;
- attribute long long?[]? ll;
- readonly attribute long long?[]? rll;
- attribute unsigned long long?[]? ull;
- readonly attribute unsigned long long?[]? rull;
- attribute DOMString?[]? str;
- readonly attribute DOMString?[]? rstr;
- attribute object?[]? obj;
- readonly attribute object?[]? robj;
- attribute object?[]? _object;
- attribute float?[]? f;
- readonly attribute float?[]? rf;
- };
- """)
-
- results = parser.finish()
-
- def checkAttr(attr, QName, name, type, readonly):
- harness.ok(isinstance(attr, WebIDL.IDLAttribute),
- "Should be an IDLAttribute")
- harness.ok(attr.isAttr(), "Attr is an Attr")
- harness.ok(not attr.isMethod(), "Attr is not an method")
- harness.ok(not attr.isConst(), "Attr is not a const")
- harness.check(attr.identifier.QName(), QName, "Attr has the right QName")
- harness.check(attr.identifier.name, name, "Attr has the right name")
- harness.check(str(attr.type), type, "Attr has the right type")
- harness.check(attr.readonly, readonly, "Attr's readonly state is correct")
-
- harness.ok(True, "TestAttr interface parsed without error.")
- harness.check(len(results), 6, "Should be six productions.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttr", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttr", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "", name, type % "", readonly)
-
- iface = results[1]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrNullable", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrNullable", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "Nullable", name, type % "OrNull", readonly)
-
- iface = results[2]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrArray", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrArray", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "Array", name, type % "Array", readonly)
-
- iface = results[3]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrNullableArray", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrNullableArray", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "NullableArray", name, type % "ArrayOrNull", readonly)
-
- iface = results[4]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrArrayOfNullableTypes", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrArrayOfNullableTypes", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "ArrayOfNullableTypes", name, type % "OrNullArray", readonly)
-
- iface = results[5]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestAttrNullableArrayOfNullableTypes", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestAttrNullableArrayOfNullableTypes", "Interface has the right name")
- harness.check(len(iface.members), len(testData), "Expect %s members" % len(testData))
-
- attrs = iface.members
-
- for i in range(len(attrs)):
- data = testData[i]
- attr = attrs[i]
- (QName, name, type, readonly) = data
- checkAttr(attr, QName % "NullableArrayOfNullableTypes", name, type % "OrNullArrayOrNull", readonly)
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A {
- [SetterInfallible] readonly attribute boolean foo;
- };
- """)
- results = parser.finish()
- except Exception, x:
- threw = True
- harness.ok(threw, "Should not allow [SetterInfallible] on readonly attributes")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py b/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py
deleted file mode 100644
index fb1b97812bc..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_attr_sequence_type.py
+++ /dev/null
@@ -1,67 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface AttrSequenceType {
- attribute sequence<object> foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Attribute type must not be a sequence type")
-
- parser.reset()
-
- threw = False
- try:
- parser.parse("""
- interface AttrUnionWithSequenceType {
- attribute (sequence<object> or DOMString) foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Attribute type must not be a union with a sequence member type")
-
- parser.reset()
-
- threw = False
- try:
- parser.parse("""
- interface AttrNullableUnionWithSequenceType {
- attribute (sequence<object>? or DOMString) foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Attribute type must not be a union with a nullable sequence "
- "member type")
-
- parser.reset()
-
- threw = False
- try:
- parser.parse("""
- interface AttrUnionWithUnionWithSequenceType {
- attribute ((sequence<object> or DOMString) or AttrUnionWithUnionWithSequenceType) foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Attribute type must not be a union type with a union member "
- "type that has a sequence member type")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py b/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py
deleted file mode 100644
index 631e52eba0b..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_builtin_filename.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface Test {
- attribute long b;
- };
- """);
-
- attr = parser.finish()[0].members[0]
- harness.check(attr.type.filename(), '<builtin>', 'Filename on builtin type')
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py b/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py
deleted file mode 100644
index f8563fc2d9b..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_builtins.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestBuiltins {
- attribute boolean b;
- attribute byte s8;
- attribute octet u8;
- attribute short s16;
- attribute unsigned short u16;
- attribute long s32;
- attribute unsigned long u32;
- attribute long long s64;
- attribute unsigned long long u64;
- attribute DOMTimeStamp ts;
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestBuiltins interface parsed without error.")
- harness.check(len(results), 1, "Should be one production")
- harness.ok(isinstance(results[0], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- iface = results[0]
- harness.check(iface.identifier.QName(), "::TestBuiltins", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestBuiltins", "Interface has the right name")
- harness.check(iface.parent, None, "Interface has no parent")
-
- members = iface.members
- harness.check(len(members), 10, "Should be one production")
-
- names = ["b", "s8", "u8", "s16", "u16", "s32", "u32", "s64", "u64", "ts"]
- types = ["Boolean", "Byte", "Octet", "Short", "UnsignedShort", "Long", "UnsignedLong", "LongLong", "UnsignedLongLong", "UnsignedLongLong"]
- for i in range(10):
- attr = members[i]
- harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Should be an IDLAttribute")
- harness.check(attr.identifier.QName(), "::TestBuiltins::" + names[i], "Attr has correct QName")
- harness.check(attr.identifier.name, names[i], "Attr has correct name")
- harness.check(str(attr.type), types[i], "Attr type is the correct name")
- harness.ok(attr.type.isPrimitive(), "Should be a primitive type")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py b/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py
deleted file mode 100644
index 267d27dc087..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_callback.py
+++ /dev/null
@@ -1,34 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestCallback {
- attribute CallbackType? listener;
- };
-
- callback CallbackType = boolean (unsigned long arg);
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestCallback interface parsed without error.")
- harness.check(len(results), 2, "Should be one production.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestCallback", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestCallback", "Interface has the right name")
- harness.check(len(iface.members), 1, "Expect %s members" % 1)
-
- attr = iface.members[0]
- harness.ok(isinstance(attr, WebIDL.IDLAttribute),
- "Should be an IDLAttribute")
- harness.ok(attr.isAttr(), "Should be an attribute")
- harness.ok(not attr.isMethod(), "Attr is not an method")
- harness.ok(not attr.isConst(), "Attr is not a const")
- harness.check(attr.identifier.QName(), "::TestCallback::listener", "Attr has the right QName")
- harness.check(attr.identifier.name, "listener", "Attr has the right name")
- t = attr.type
- harness.ok(not isinstance(t, WebIDL.IDLWrapperType), "Attr has the right type")
- harness.ok(isinstance(t, WebIDL.IDLNullableType), "Attr has the right type")
- harness.ok(t.isCallback(), "Attr has the right type")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py b/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py
deleted file mode 100644
index 80896ca1edb..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_callback_interface.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- callback interface TestCallbackInterface {
- attribute boolean bool;
- };
- """)
-
- results = parser.finish()
-
- iface = results[0]
-
- harness.ok(iface.isCallback(), "Interface should be a callback")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface {
- };
- callback interface TestCallbackInterface : TestInterface {
- attribute boolean bool;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow non-callback parent of callback interface")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface : TestCallbackInterface {
- };
- callback interface TestCallbackInterface {
- attribute boolean bool;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow callback parent of non-callback interface")
-
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_const.py b/src/components/script/dom/bindings/codegen/parser/tests/test_const.py
deleted file mode 100644
index 12f411363fb..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_const.py
+++ /dev/null
@@ -1,64 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestConsts {
- const byte zero = 0;
- const byte b = -1;
- const octet o = 2;
- const short s = -3;
- const unsigned short us = 0x4;
- const long l = -0X5;
- const unsigned long ul = 6;
- const unsigned long long ull = 7;
- const long long ll = -010;
- const boolean t = true;
- const boolean f = false;
- const boolean? n = null;
- const boolean? nt = true;
- const boolean? nf = false;
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestConsts interface parsed without error.")
- harness.check(len(results), 1, "Should be one production.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestConsts", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestConsts", "Interface has the right name")
- harness.check(len(iface.members), 14, "Expect 14 members")
-
- consts = iface.members
-
- def checkConst(const, QName, name, type, value):
- harness.ok(isinstance(const, WebIDL.IDLConst),
- "Should be an IDLConst")
- harness.ok(const.isConst(), "Const is a const")
- harness.ok(not const.isAttr(), "Const is not an attr")
- harness.ok(not const.isMethod(), "Const is not a method")
- harness.check(const.identifier.QName(), QName, "Const has the right QName")
- harness.check(const.identifier.name, name, "Const has the right name")
- harness.check(str(const.type), type, "Const has the right type")
- harness.ok(const.type.isPrimitive(), "All consts should be primitive")
- harness.check(str(const.value.type), str(const.type),
- "Const's value has the same type as the type")
- harness.check(const.value.value, value, "Const value has the right value.")
-
- checkConst(consts[0], "::TestConsts::zero", "zero", "Byte", 0)
- checkConst(consts[1], "::TestConsts::b", "b", "Byte", -1)
- checkConst(consts[2], "::TestConsts::o", "o", "Octet", 2)
- checkConst(consts[3], "::TestConsts::s", "s", "Short", -3)
- checkConst(consts[4], "::TestConsts::us", "us", "UnsignedShort", 4)
- checkConst(consts[5], "::TestConsts::l", "l", "Long", -5)
- checkConst(consts[6], "::TestConsts::ul", "ul", "UnsignedLong", 6)
- checkConst(consts[7], "::TestConsts::ull", "ull", "UnsignedLongLong", 7)
- checkConst(consts[8], "::TestConsts::ll", "ll", "LongLong", -8)
- checkConst(consts[9], "::TestConsts::t", "t", "Boolean", True)
- checkConst(consts[10], "::TestConsts::f", "f", "Boolean", False)
- checkConst(consts[11], "::TestConsts::n", "n", "BooleanOrNull", None)
- checkConst(consts[12], "::TestConsts::nt", "nt", "BooleanOrNull", True)
- checkConst(consts[13], "::TestConsts::nf", "nf", "BooleanOrNull", False)
-
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py b/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py
deleted file mode 100644
index 6ec1be1871b..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_constructor.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- def checkArgument(argument, QName, name, type, optional, variadic):
- harness.ok(isinstance(argument, WebIDL.IDLArgument),
- "Should be an IDLArgument")
- harness.check(argument.identifier.QName(), QName, "Argument has the right QName")
- harness.check(argument.identifier.name, name, "Argument has the right name")
- harness.check(str(argument.type), type, "Argument has the right return type")
- harness.check(argument.optional, optional, "Argument has the right optional value")
- harness.check(argument.variadic, variadic, "Argument has the right variadic value")
-
- def checkMethod(method, QName, name, signatures,
- static=False, getter=False, setter=False, creator=False,
- deleter=False, legacycaller=False, stringifier=False):
- harness.ok(isinstance(method, WebIDL.IDLMethod),
- "Should be an IDLMethod")
- harness.ok(method.isMethod(), "Method is a method")
- harness.ok(not method.isAttr(), "Method is not an attr")
- harness.ok(not method.isConst(), "Method is not a const")
- harness.check(method.identifier.QName(), QName, "Method has the right QName")
- harness.check(method.identifier.name, name, "Method has the right name")
- harness.check(method.isStatic(), static, "Method has the correct static value")
- harness.check(method.isGetter(), getter, "Method has the correct getter value")
- harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
- harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
- harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
- harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
- harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
-
- sigpairs = zip(method.signatures(), signatures)
- for (gotSignature, expectedSignature) in sigpairs:
- (gotRetType, gotArgs) = gotSignature
- (expectedRetType, expectedArgs) = expectedSignature
-
- harness.check(str(gotRetType), expectedRetType,
- "Method has the expected return type.")
-
- for i in range(0, len(gotArgs)):
- (QName, name, type, optional, variadic) = expectedArgs[i]
- checkArgument(gotArgs[i], QName, name, type, optional, variadic)
-
- parser.parse("""
- [Constructor]
- interface TestConstructorNoArgs {
- };
-
- [Constructor(DOMString name)]
- interface TestConstructorWithArgs {
- };
-
- [Constructor(object foo), Constructor(boolean bar)]
- interface TestConstructorOverloads {
- };
- """)
- results = parser.finish()
- harness.check(len(results), 3, "Should be two productions")
- harness.ok(isinstance(results[0], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.ok(isinstance(results[1], WebIDL.IDLInterface),
- "Should be an IDLInterface")
-
- checkMethod(results[0].ctor(), "::TestConstructorNoArgs::constructor",
- "constructor", [("TestConstructorNoArgs (Wrapper)", [])])
- checkMethod(results[1].ctor(), "::TestConstructorWithArgs::constructor",
- "constructor",
- [("TestConstructorWithArgs (Wrapper)",
- [("::TestConstructorWithArgs::constructor::name", "name", "String", False, False)])])
- checkMethod(results[2].ctor(), "::TestConstructorOverloads::constructor",
- "constructor",
- [("TestConstructorOverloads (Wrapper)",
- [("::TestConstructorOverloads::constructor::foo", "foo", "Object", False, False)]),
- ("TestConstructorOverloads (Wrapper)",
- [("::TestConstructorOverloads::constructor::bar", "bar", "Boolean", False, False)])])
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py b/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py
deleted file mode 100644
index 192c5f6f97b..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py
+++ /dev/null
@@ -1,28 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- [Constructor, NoInterfaceObject]
- interface TestConstructorNoInterfaceObject {
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- [NoInterfaceObject, Constructor]
- interface TestConstructorNoInterfaceObject {
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py b/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py
deleted file mode 100644
index 6249d36fb8f..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_deduplicate.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface Foo;
- interface Bar;
- interface Foo;
- """);
-
- results = parser.finish()
-
- # There should be no duplicate interfaces in the result.
- expectedNames = sorted(['Foo', 'Bar'])
- actualNames = sorted(map(lambda iface: iface.identifier.name, results))
- harness.check(actualNames, expectedNames, "Parser shouldn't output duplicate names.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py b/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py
deleted file mode 100644
index 9ae9eb2b66f..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_dictionary.py
+++ /dev/null
@@ -1,198 +0,0 @@
-def WebIDLTest(parser, harness):
- parser.parse("""
- dictionary Dict2 : Dict1 {
- long child = 5;
- Dict1 aaandAnother;
- };
- dictionary Dict1 {
- long parent;
- double otherParent;
- };
- """)
- results = parser.finish()
-
- dict1 = results[1];
- dict2 = results[0];
-
- harness.check(len(dict1.members), 2, "Dict1 has two members")
- harness.check(len(dict2.members), 2, "Dict2 has four members")
-
- harness.check(dict1.members[0].identifier.name, "otherParent",
- "'o' comes before 'p'")
- harness.check(dict1.members[1].identifier.name, "parent",
- "'o' really comes before 'p'")
- harness.check(dict2.members[0].identifier.name, "aaandAnother",
- "'a' comes before 'c'")
- harness.check(dict2.members[1].identifier.name, "child",
- "'a' really comes before 'c'")
-
- # Now reset our parser
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary Dict {
- long prop = 5;
- long prop;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow name duplication in a dictionary")
-
- # Now reset our parser again
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary Dict1 : Dict2 {
- long prop = 5;
- };
- dictionary Dict2 : Dict3 {
- long prop2;
- };
- dictionary Dict3 {
- double prop;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow name duplication in a dictionary and "
- "its ancestor")
-
- # More reset
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface Iface {};
- dictionary Dict : Iface {
- long prop;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow non-dictionary parents for dictionaries")
-
- # Even more reset
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A : B {};
- dictionary B : A {};
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow cycles in dictionary inheritance chains")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- [TreatNullAs=EmptyString] DOMString foo;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow [TreatNullAs] on dictionary members");
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- [TreatUndefinedAs=EmptyString] DOMString foo;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow [TreatUndefinedAs] on dictionary members");
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- };
- interface X {
- void doFoo(A arg);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Trailing dictionary arg must be optional")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- };
- interface X {
- void doFoo(A arg1, optional long arg2);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Dictionary arg followed by optional arg must be optional")
-
- parser = parser.reset()
- parser.parse("""
- dictionary A {
- };
- interface X {
- void doFoo(A arg1, long arg2);
- };
- """)
- results = parser.finish()
- harness.ok(True, "Dictionary arg followed by required arg can be required")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- };
- interface X {
- void doFoo(optional A? arg1);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Dictionary arg must not be nullable")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- dictionary A {
- };
- interface X {
- void doFoo((A or long)? arg1);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Dictionary arg must not be in a nullable union")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py b/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py
deleted file mode 100644
index 86847800631..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_distinguishability.py
+++ /dev/null
@@ -1,150 +0,0 @@
-def firstArgType(method):
- return method.signatures()[0][1][0].type
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- dictionary Dict {
- };
- callback interface Foo {
- };
- interface Bar {
- // Bit of a pain to get things that have dictionary types
- void passDict(optional Dict arg);
- void passFoo(Foo arg);
- void passNullableUnion((object? or DOMString) arg);
- void passNullable(Foo? arg);
- };
- """)
- results = parser.finish()
-
- iface = results[2]
- harness.ok(iface.isInterface(), "Should have interface")
- dictMethod = iface.members[0]
- ifaceMethod = iface.members[1]
- nullableUnionMethod = iface.members[2]
- nullableIfaceMethod = iface.members[3]
-
- dictType = firstArgType(dictMethod)
- ifaceType = firstArgType(ifaceMethod)
-
- harness.ok(dictType.isDictionary(), "Should have dictionary type");
- harness.ok(ifaceType.isInterface(), "Should have interface type");
- harness.ok(ifaceType.isCallbackInterface(), "Should have callback interface type");
-
- harness.ok(not dictType.isDistinguishableFrom(ifaceType),
- "Dictionary not distinguishable from callback interface")
- harness.ok(not ifaceType.isDistinguishableFrom(dictType),
- "Callback interface not distinguishable from dictionary")
-
- nullableUnionType = firstArgType(nullableUnionMethod)
- nullableIfaceType = firstArgType(nullableIfaceMethod)
-
- harness.ok(nullableUnionType.isUnion(), "Should have union type");
- harness.ok(nullableIfaceType.isInterface(), "Should have interface type");
- harness.ok(nullableIfaceType.nullable(), "Should have nullable type");
-
- harness.ok(not nullableUnionType.isDistinguishableFrom(nullableIfaceType),
- "Nullable type not distinguishable from union with nullable "
- "member type")
- harness.ok(not nullableIfaceType.isDistinguishableFrom(nullableUnionType),
- "Union with nullable member type not distinguishable from "
- "nullable type")
-
- parser = parser.reset()
- parser.parse("""
- interface TestIface {
- void passKid(Kid arg);
- void passParent(Parent arg);
- void passGrandparent(Grandparent arg);
- void passImplemented(Implemented arg);
- void passImplementedParent(ImplementedParent arg);
- void passUnrelated1(Unrelated1 arg);
- void passUnrelated2(Unrelated2 arg);
- void passArrayBuffer(ArrayBuffer arg);
- void passArrayBuffer(ArrayBufferView arg);
- };
-
- interface Kid : Parent {};
- interface Parent : Grandparent {};
- interface Grandparent {};
- interface Implemented : ImplementedParent {};
- Parent implements Implemented;
- interface ImplementedParent {};
- interface Unrelated1 {};
- interface Unrelated2 {};
- """)
- results = parser.finish()
-
- iface = results[0]
- harness.ok(iface.isInterface(), "Should have interface")
- argTypes = [firstArgType(method) for method in iface.members]
- unrelatedTypes = [firstArgType(method) for method in iface.members[-3:]]
-
- for type1 in argTypes:
- for type2 in argTypes:
- distinguishable = (type1 is not type2 and
- (type1 in unrelatedTypes or
- type2 in unrelatedTypes))
-
- harness.check(type1.isDistinguishableFrom(type2),
- distinguishable,
- "Type %s should %sbe distinguishable from type %s" %
- (type1, "" if distinguishable else "not ", type2))
- harness.check(type2.isDistinguishableFrom(type1),
- distinguishable,
- "Type %s should %sbe distinguishable from type %s" %
- (type2, "" if distinguishable else "not ", type1))
-
- parser = parser.reset()
- parser.parse("""
- interface Dummy {};
- interface TestIface {
- void method(long arg1, TestIface arg2);
- void method(long arg1, long arg2);
- void method(long arg1, Dummy arg2);
- void method(DOMString arg1, DOMString arg2, DOMString arg3);
- };
- """)
- results = parser.finish()
- harness.check(len(results[1].members), 1,
- "Should look like we have one method")
- harness.check(len(results[1].members[0].signatures()), 4,
- "Should have four signatures")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface Dummy {};
- interface TestIface {
- void method(long arg1, TestIface arg2);
- void method(long arg1, long arg2);
- void method(any arg1, Dummy arg2);
- void method(DOMString arg1, DOMString arg2, DOMString arg3);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should throw when args before the distinguishing arg are not "
- "all the same type")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface Dummy {};
- interface TestIface {
- void method(long arg1, TestIface arg2);
- void method(long arg1, long arg2);
- void method(any arg1, DOMString arg2);
- void method(DOMString arg1, DOMString arg2, DOMString arg3);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should throw when there is no distinguishing index")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py b/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py
deleted file mode 100644
index 700c7eade00..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_double_null.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface DoubleNull {
- attribute byte?? foo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py b/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py
deleted file mode 100644
index 799f2e0e0ed..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_duplicate_qualifiers.py
+++ /dev/null
@@ -1,84 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface DuplicateQualifiers1 {
- getter getter byte foo(unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface DuplicateQualifiers2 {
- setter setter byte foo(unsigned long index, byte value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface DuplicateQualifiers3 {
- creator creator byte foo(unsigned long index, byte value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface DuplicateQualifiers4 {
- deleter deleter byte foo(unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface DuplicateQualifiers5 {
- getter deleter getter byte foo(unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- results = parser.parse("""
- interface DuplicateQualifiers6 {
- creator setter creator byte foo(unsigned long index, byte value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py b/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py
deleted file mode 100644
index ee0079f06da..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_empty_enum.py
+++ /dev/null
@@ -1,14 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- try:
- parser.parse("""
- enum TestEmptyEnum {
- };
- """)
-
- harness.ok(False, "Should have thrown!")
- except:
- harness.ok(True, "Parsing TestEmptyEnum enum should fail")
-
- results = parser.finish()
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py b/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py
deleted file mode 100644
index 69a6932062d..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_enum.py
+++ /dev/null
@@ -1,81 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- enum TestEnum {
- "",
- "foo",
- "bar"
- };
-
- interface TestEnumInterface {
- TestEnum doFoo(boolean arg);
- readonly attribute TestEnum foo;
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestEnumInterfaces interface parsed without error.")
- harness.check(len(results), 2, "Should be one production")
- harness.ok(isinstance(results[0], WebIDL.IDLEnum),
- "Should be an IDLEnum")
- harness.ok(isinstance(results[1], WebIDL.IDLInterface),
- "Should be an IDLInterface")
-
- enum = results[0]
- harness.check(enum.identifier.QName(), "::TestEnum", "Enum has the right QName")
- harness.check(enum.identifier.name, "TestEnum", "Enum has the right name")
- harness.check(enum.values(), ["", "foo", "bar"], "Enum has the right values")
-
- iface = results[1]
-
- harness.check(iface.identifier.QName(), "::TestEnumInterface", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestEnumInterface", "Interface has the right name")
- harness.check(iface.parent, None, "Interface has no parent")
-
- members = iface.members
- harness.check(len(members), 2, "Should be one production")
- harness.ok(isinstance(members[0], WebIDL.IDLMethod),
- "Should be an IDLMethod")
- method = members[0]
- harness.check(method.identifier.QName(), "::TestEnumInterface::doFoo",
- "Method has correct QName")
- harness.check(method.identifier.name, "doFoo", "Method has correct name")
-
- signatures = method.signatures()
- harness.check(len(signatures), 1, "Expect one signature")
-
- (returnType, arguments) = signatures[0]
- harness.check(str(returnType), "TestEnum (Wrapper)", "Method type is the correct name")
- harness.check(len(arguments), 1, "Method has the right number of arguments")
- arg = arguments[0]
- harness.ok(isinstance(arg, WebIDL.IDLArgument), "Should be an IDLArgument")
- harness.check(str(arg.type), "Boolean", "Argument has the right type")
-
- attr = members[1]
- harness.check(attr.identifier.QName(), "::TestEnumInterface::foo",
- "Attr has correct QName")
- harness.check(attr.identifier.name, "foo", "Attr has correct name")
-
- harness.check(str(attr.type), "TestEnum (Wrapper)", "Attr type is the correct name")
-
- # Now reset our parser
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- enum Enum {
- "a",
- "b",
- "c"
- };
- interface TestInterface {
- void foo(optional Enum e = "d");
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow a bogus default value for an enum")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py b/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py
deleted file mode 100644
index 51205d209e7..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_enum_duplicate_values.py
+++ /dev/null
@@ -1,13 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- try:
- parser.parse("""
- enum TestEnumDuplicateValue {
- "",
- ""
- };
- """)
- harness.ok(False, "Should have thrown!")
- except:
- harness.ok(True, "Enum TestEnumDuplicateValue should throw")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py b/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py
deleted file mode 100644
index ca0674aec04..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_error_colno.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- # Check that error messages put the '^' in the right place.
-
- threw = False
- input = 'interface ?'
- try:
- parser.parse(input)
- results = parser.finish()
- except WebIDL.WebIDLError, e:
- threw = True
- lines = str(e).split('\n')
-
- harness.check(len(lines), 3, 'Expected number of lines in error message')
- harness.check(lines[1], input, 'Second line shows error')
- harness.check(lines[2], ' ' * (len(input) - 1) + '^',
- 'Correct column pointer in error message')
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py b/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py
deleted file mode 100644
index f11222e7a4d..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- # Check that error messages put the '^' in the right place.
-
- threw = False
- input = """\
-// This is a comment.
-interface Foo {
-};
-
-/* This is also a comment. */
-interface ?"""
- try:
- parser.parse(input)
- results = parser.finish()
- except WebIDL.WebIDLError, e:
- threw = True
- lines = str(e).split('\n')
-
- harness.check(len(lines), 3, 'Expected number of lines in error message')
- harness.ok(lines[0].endswith('line 6:10'), 'First line of error should end with "line 6:10", but was "%s".' % lines[0])
- harness.check(lines[1], 'interface ?', 'Second line of error message is the line which caused the error.')
- harness.check(lines[2], ' ' * (len('interface ?') - 1) + '^',
- 'Correct column pointer in error message.')
-
- harness.ok(threw, "Should have thrown.")
-
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py b/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py
deleted file mode 100644
index 5c6887331e7..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_extended_attributes.py
+++ /dev/null
@@ -1,107 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- [Flippety]
- interface TestExtendedAttr {
- [Foopy] attribute byte b;
- };
- """)
-
- results = parser.finish()
-
- parser = parser.reset()
- parser.parse("""
- [Flippety="foo.bar",Floppety=flop]
- interface TestExtendedAttr {
- [Foopy="foo.bar"] attribute byte b;
- };
- """)
-
- results = parser.finish()
-
- parser = parser.reset()
- parser.parse("""
- interface TestLenientThis {
- [LenientThis] attribute byte b;
- };
- """)
-
- results = parser.finish()
- harness.ok(results[0].members[0].hasLenientThis(),
- "Should have a lenient this")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestLenientThis2 {
- [LenientThis=something] attribute byte b;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "[LenientThis] must take no arguments")
-
- parser = parser.reset()
- parser.parse("""
- interface TestClamp {
- void testClamp([Clamp] long foo);
- void testNotClamp(long foo);
- };
- """)
-
- results = parser.finish()
- # Pull out the first argument out of the arglist of the first (and
- # only) signature.
- harness.ok(results[0].members[0].signatures()[0][1][0].clamp,
- "Should be clamped")
- harness.ok(not results[0].members[1].signatures()[0][1][0].clamp,
- "Should not be clamped")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestClamp2 {
- void testClamp([Clamp=something] long foo);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "[Clamp] must take no arguments")
-
- parser = parser.reset()
- parser.parse("""
- interface TestEnforceRange {
- void testEnforceRange([EnforceRange] long foo);
- void testNotEnforceRange(long foo);
- };
- """)
-
- results = parser.finish()
- # Pull out the first argument out of the arglist of the first (and
- # only) signature.
- harness.ok(results[0].members[0].signatures()[0][1][0].enforceRange,
- "Should be enforceRange")
- harness.ok(not results[0].members[1].signatures()[0][1][0].enforceRange,
- "Should not be enforceRange")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestEnforceRange2 {
- void testEnforceRange([EnforceRange=something] long foo);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "[EnforceRange] must take no arguments")
-
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py b/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py
deleted file mode 100644
index cac24c832cc..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_forward_decl.py
+++ /dev/null
@@ -1,15 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface ForwardDeclared;
- interface ForwardDeclared;
-
- interface TestForwardDecl {
- attribute ForwardDeclared foo;
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestForwardDeclared interface parsed without error.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py b/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py
deleted file mode 100644
index 04c47d92abe..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_implements.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# Import the WebIDL module, so we can do isinstance checks and whatnot
-import WebIDL
-
-def WebIDLTest(parser, harness):
- # Basic functionality
- threw = False
- try:
- parser.parse("""
- A implements B;
- interface B {
- attribute long x;
- };
- interface A {
- attribute long y;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(not threw, "Should not have thrown on implements statement "
- "before interfaces")
- harness.check(len(results), 3, "We have three statements")
- harness.ok(isinstance(results[1], WebIDL.IDLInterface), "B is an interface")
- harness.check(len(results[1].members), 1, "B has one member")
- A = results[2]
- harness.ok(isinstance(A, WebIDL.IDLInterface), "A is an interface")
- harness.check(len(A.members), 2, "A has two members")
- harness.check(A.members[0].identifier.name, "y", "First member is 'y'")
- harness.check(A.members[1].identifier.name, "x", "Second member is 'x'")
-
- # Duplicated member names not allowed
- threw = False
- try:
- parser.parse("""
- C implements D;
- interface D {
- attribute long x;
- };
- interface C {
- attribute long x;
- };
- """)
- parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on implemented interface duplicating "
- "a name on base interface")
-
- # Same, but duplicated across implemented interfaces
- threw = False
- try:
- parser.parse("""
- E implements F;
- E implements G;
- interface F {
- attribute long x;
- };
- interface G {
- attribute long x;
- };
- interface E {};
- """)
- parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on implemented interfaces "
- "duplicating each other's member names")
-
- # Same, but duplicated across indirectly implemented interfaces
- threw = False
- try:
- parser.parse("""
- H implements I;
- H implements J;
- I implements K;
- interface K {
- attribute long x;
- };
- interface L {
- attribute long x;
- };
- interface I {};
- interface J : L {};
- interface H {};
- """)
- parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on indirectly implemented interfaces "
- "duplicating each other's member names")
-
- # Same, but duplicated across an implemented interface and its parent
- threw = False
- try:
- parser.parse("""
- M implements N;
- interface O {
- attribute long x;
- };
- interface N : O {
- attribute long x;
- };
- interface M {};
- """)
- parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on implemented interface and its "
- "ancestor duplicating member names")
-
- # Reset the parser so we can actually find things where we expect
- # them in the list
- parser = parser.reset()
-
- # Diamonds should be allowed
- threw = False
- try:
- parser.parse("""
- P implements Q;
- P implements R;
- Q implements S;
- R implements S;
- interface Q {};
- interface R {};
- interface S {
- attribute long x;
- };
- interface P {};
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(not threw, "Diamond inheritance is fine")
- harness.check(results[6].identifier.name, "S", "We should be looking at 'S'")
- harness.check(len(results[6].members), 1, "S should have one member")
- harness.check(results[6].members[0].identifier.name, "x",
- "S's member should be 'x'")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface {
- };
- callback interface TestCallbackInterface {
- };
- TestInterface implements TestCallbackInterface;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should not allow callback interfaces on the right-hand side "
- "of 'implements'")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface {
- };
- callback interface TestCallbackInterface {
- };
- TestCallbackInterface implements TestInterface;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should not allow callback interfaces on the left-hand side of "
- "'implements'")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface {
- };
- dictionary Dict {
- };
- Dict implements TestInterface;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should not allow non-interfaces on the left-hand side "
- "of 'implements'")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface TestInterface {
- };
- dictionary Dict {
- };
- TestInterface implements Dict;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should not allow non-interfaces on the right-hand side "
- "of 'implements'")
-
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py b/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py
deleted file mode 100644
index 1f520a28e16..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_parent.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestIncompleteParent : NotYetDefined {
- void foo();
- };
-
- interface NotYetDefined : EvenHigherOnTheChain {
- };
-
- interface EvenHigherOnTheChain {
- };
- """)
-
- parser.finish()
-
- harness.ok(True, "TestIncompleteParent interface parsed without error.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py b/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py
deleted file mode 100644
index fdc39604070..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_incomplete_types.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestIncompleteTypes {
- attribute FooInterface attr1;
-
- FooInterface method1(FooInterface arg);
- };
-
- interface FooInterface {
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestIncompleteTypes interface parsed without error.")
- harness.check(len(results), 2, "Should be two productions.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestIncompleteTypes", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestIncompleteTypes", "Interface has the right name")
- harness.check(len(iface.members), 2, "Expect 2 members")
-
- attr = iface.members[0]
- harness.ok(isinstance(attr, WebIDL.IDLAttribute),
- "Should be an IDLAttribute")
- method = iface.members[1]
- harness.ok(isinstance(method, WebIDL.IDLMethod),
- "Should be an IDLMethod")
-
- harness.check(attr.identifier.QName(), "::TestIncompleteTypes::attr1",
- "Attribute has the right QName")
- harness.check(attr.type.name, "FooInterface",
- "Previously unresolved type has the right name")
-
- harness.check(method.identifier.QName(), "::TestIncompleteTypes::method1",
- "Attribute has the right QName")
- (returnType, args) = method.signatures()[0]
- harness.check(returnType.name, "FooInterface",
- "Previously unresolved type has the right name")
- harness.check(args[0].type.name, "FooInterface",
- "Previously unresolved type has the right name")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py b/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py
deleted file mode 100644
index 5b07172c636..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_interface.py
+++ /dev/null
@@ -1,188 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("interface Foo { };")
- results = parser.finish()
- harness.ok(True, "Empty interface parsed without error.")
- harness.check(len(results), 1, "Should be one production")
- harness.ok(isinstance(results[0], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- iface = results[0]
- harness.check(iface.identifier.QName(), "::Foo", "Interface has the right QName")
- harness.check(iface.identifier.name, "Foo", "Interface has the right name")
- harness.check(iface.parent, None, "Interface has no parent")
-
- parser.parse("interface Bar : Foo { };")
- results = parser.finish()
- harness.ok(True, "Empty interface parsed without error.")
- harness.check(len(results), 2, "Should be two productions")
- harness.ok(isinstance(results[1], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- iface = results[1]
- harness.check(iface.identifier.QName(), "::Bar", "Interface has the right QName")
- harness.check(iface.identifier.name, "Bar", "Interface has the right name")
- harness.ok(isinstance(iface.parent, WebIDL.IDLInterface),
- "Interface has a parent")
-
- parser = parser.reset()
- parser.parse("""
- interface QNameBase {
- attribute long foo;
- };
-
- interface QNameDerived : QNameBase {
- attribute long long foo;
- attribute byte bar;
- };
- """)
- results = parser.finish()
- harness.check(len(results), 2, "Should be two productions")
- harness.ok(isinstance(results[0], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.ok(isinstance(results[1], WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(results[1].parent, results[0], "Inheritance chain is right")
- harness.check(len(results[0].members), 1, "Expect 1 productions")
- harness.check(len(results[1].members), 2, "Expect 2 productions")
- base = results[0]
- derived = results[1]
- harness.check(base.members[0].identifier.QName(), "::QNameBase::foo",
- "Member has the right QName")
- harness.check(derived.members[0].identifier.QName(), "::QNameDerived::foo",
- "Member has the right QName")
- harness.check(derived.members[1].identifier.QName(), "::QNameDerived::bar",
- "Member has the right QName")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : B {};
- interface B : A {};
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow cycles in interface inheritance chains")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : C {};
- interface C : B {};
- interface B : A {};
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow indirect cycles in interface inheritance chains")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A {};
- interface B {};
- A implements B;
- B implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow cycles via implements")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A {};
- interface C {};
- interface B {};
- A implements C;
- C implements B;
- B implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow indirect cycles via implements")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : B {};
- interface B {};
- B implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow inheriting from an interface that implements us")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : B {};
- interface B {};
- interface C {};
- B implements C;
- C implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow inheriting from an interface that indirectly implements us")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : B {};
- interface B : C {};
- interface C {};
- C implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow indirectly inheriting from an interface that implements us")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A : B {};
- interface B : C {};
- interface C {};
- interface D {};
- C implements D;
- D implements A;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow indirectly inheriting from an interface that indirectly implements us")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A;
- interface B : A {};
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should not allow inheriting from an interface that is only forward declared")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py b/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py
deleted file mode 100644
index db944e7aaf7..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_interface_const_identifier_conflicts.py
+++ /dev/null
@@ -1,15 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface IdentifierConflict {
- const byte thing1 = 1;
- const unsigned long thing1 = 1;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py b/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py
deleted file mode 100644
index 1a73fb917ed..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_interface_identifier_conflicts_across_members.py
+++ /dev/null
@@ -1,60 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface IdentifierConflictAcrossMembers1 {
- const byte thing1 = 1;
- readonly attribute long thing1;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface IdentifierConflictAcrossMembers2 {
- readonly attribute long thing1;
- const byte thing1 = 1;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface IdentifierConflictAcrossMembers3 {
- getter boolean thing1(DOMString name);
- readonly attribute long thing1;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface IdentifierConflictAcrossMembers1 {
- const byte thing1 = 1;
- long thing1();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_method.py b/src/components/script/dom/bindings/codegen/parser/tests/test_method.py
deleted file mode 100644
index 40b2d2cf8b9..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_method.py
+++ /dev/null
@@ -1,145 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestMethods {
- void basic();
- static void basicStatic();
- void basicWithSimpleArgs(boolean arg1, byte arg2, unsigned long arg3);
- boolean basicBoolean();
- static boolean basicStaticBoolean();
- boolean basicBooleanWithSimpleArgs(boolean arg1, byte arg2, unsigned long arg3);
- void optionalArg(optional byte? arg1, optional sequence<byte> arg2);
- void variadicArg(byte?... arg1);
- void crazyTypes(sequence<long?[]>? arg1, boolean?[][]? arg2);
- object getObject();
- void setObject(object arg1);
- void setAny(any arg1);
- float doFloats(float arg1);
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestMethods interface parsed without error.")
- harness.check(len(results), 1, "Should be one production.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestMethods", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestMethods", "Interface has the right name")
- harness.check(len(iface.members), 13, "Expect 13 members")
-
- methods = iface.members
-
- def checkArgument(argument, QName, name, type, optional, variadic):
- harness.ok(isinstance(argument, WebIDL.IDLArgument),
- "Should be an IDLArgument")
- harness.check(argument.identifier.QName(), QName, "Argument has the right QName")
- harness.check(argument.identifier.name, name, "Argument has the right name")
- harness.check(str(argument.type), type, "Argument has the right return type")
- harness.check(argument.optional, optional, "Argument has the right optional value")
- harness.check(argument.variadic, variadic, "Argument has the right variadic value")
-
- def checkMethod(method, QName, name, signatures,
- static=False, getter=False, setter=False, creator=False,
- deleter=False, legacycaller=False, stringifier=False):
- harness.ok(isinstance(method, WebIDL.IDLMethod),
- "Should be an IDLMethod")
- harness.ok(method.isMethod(), "Method is a method")
- harness.ok(not method.isAttr(), "Method is not an attr")
- harness.ok(not method.isConst(), "Method is not a const")
- harness.check(method.identifier.QName(), QName, "Method has the right QName")
- harness.check(method.identifier.name, name, "Method has the right name")
- harness.check(method.isStatic(), static, "Method has the correct static value")
- harness.check(method.isGetter(), getter, "Method has the correct getter value")
- harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
- harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
- harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
- harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
- harness.check(len(method.signatures()), len(signatures), "Method has the correct number of signatures")
-
- sigpairs = zip(method.signatures(), signatures)
- for (gotSignature, expectedSignature) in sigpairs:
- (gotRetType, gotArgs) = gotSignature
- (expectedRetType, expectedArgs) = expectedSignature
-
- harness.check(str(gotRetType), expectedRetType,
- "Method has the expected return type.")
-
- for i in range(0, len(gotArgs)):
- (QName, name, type, optional, variadic) = expectedArgs[i]
- checkArgument(gotArgs[i], QName, name, type, optional, variadic)
-
- checkMethod(methods[0], "::TestMethods::basic", "basic", [("Void", [])])
- checkMethod(methods[1], "::TestMethods::basicStatic", "basicStatic",
- [("Void", [])], static=True)
- checkMethod(methods[2], "::TestMethods::basicWithSimpleArgs",
- "basicWithSimpleArgs",
- [("Void",
- [("::TestMethods::basicWithSimpleArgs::arg1", "arg1", "Boolean", False, False),
- ("::TestMethods::basicWithSimpleArgs::arg2", "arg2", "Byte", False, False),
- ("::TestMethods::basicWithSimpleArgs::arg3", "arg3", "UnsignedLong", False, False)])])
- checkMethod(methods[3], "::TestMethods::basicBoolean", "basicBoolean", [("Boolean", [])])
- checkMethod(methods[4], "::TestMethods::basicStaticBoolean", "basicStaticBoolean", [("Boolean", [])], static=True)
- checkMethod(methods[5], "::TestMethods::basicBooleanWithSimpleArgs",
- "basicBooleanWithSimpleArgs",
- [("Boolean",
- [("::TestMethods::basicBooleanWithSimpleArgs::arg1", "arg1", "Boolean", False, False),
- ("::TestMethods::basicBooleanWithSimpleArgs::arg2", "arg2", "Byte", False, False),
- ("::TestMethods::basicBooleanWithSimpleArgs::arg3", "arg3", "UnsignedLong", False, False)])])
- checkMethod(methods[6], "::TestMethods::optionalArg",
- "optionalArg",
- [("Void",
- [("::TestMethods::optionalArg::arg1", "arg1", "ByteOrNull", True, False),
- ("::TestMethods::optionalArg::arg2", "arg2", "ByteSequence", True, False)])])
- checkMethod(methods[7], "::TestMethods::variadicArg",
- "variadicArg",
- [("Void",
- [("::TestMethods::variadicArg::arg1", "arg1", "ByteOrNull", True, True)])])
- checkMethod(methods[8], "::TestMethods::crazyTypes",
- "crazyTypes",
- [("Void",
- [("::TestMethods::crazyTypes::arg1", "arg1", "LongOrNullArraySequenceOrNull", False, False),
- ("::TestMethods::crazyTypes::arg2", "arg2", "BooleanOrNullArrayArrayOrNull", False, False)])])
- checkMethod(methods[9], "::TestMethods::getObject",
- "getObject", [("Object", [])])
- checkMethod(methods[10], "::TestMethods::setObject",
- "setObject",
- [("Void",
- [("::TestMethods::setObject::arg1", "arg1", "Object", False, False)])])
- checkMethod(methods[11], "::TestMethods::setAny",
- "setAny",
- [("Void",
- [("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
- checkMethod(methods[12], "::TestMethods::doFloats",
- "doFloats",
- [("Float",
- [("::TestMethods::doFloats::arg1", "arg1", "Float", False, False)])])
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A {
- [GetterInfallible] void foo();
- };
- """)
- results = parser.finish()
- except Exception, x:
- threw = True
- harness.ok(threw, "Should not allow [GetterInfallible] on methods")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface A {
- [SetterInfallible] void foo();
- };
- """)
- results = parser.finish()
- except Exception, x:
- threw = True
- harness.ok(threw, "Should not allow [SetterInfallible] on methods")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py b/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py
deleted file mode 100644
index 3366b9fbbbd..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_equivalency.py
+++ /dev/null
@@ -1,126 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestNullableEquivalency1 {
- attribute long a;
- attribute long? b;
- };
-
- interface TestNullableEquivalency2 {
- attribute ArrayBuffer a;
- attribute ArrayBuffer? b;
- };
-
- /* Can't have dictionary-valued attributes, so can't test that here */
-
- enum TestNullableEquivalency4Enum {
- "Foo",
- "Bar"
- };
-
- interface TestNullableEquivalency4 {
- attribute TestNullableEquivalency4Enum a;
- attribute TestNullableEquivalency4Enum? b;
- };
-
- interface TestNullableEquivalency5 {
- attribute TestNullableEquivalency4 a;
- attribute TestNullableEquivalency4? b;
- };
-
- interface TestNullableEquivalency6 {
- attribute boolean a;
- attribute boolean? b;
- };
-
- interface TestNullableEquivalency7 {
- attribute DOMString a;
- attribute DOMString? b;
- };
-
- /* Not implemented. */
- /*interface TestNullableEquivalency8 {
- attribute float a;
- attribute float? b;
- };*/
-
- interface TestNullableEquivalency8 {
- attribute double a;
- attribute double? b;
- };
-
- interface TestNullableEquivalency9 {
- attribute object a;
- attribute object? b;
- };
-
- interface TestNullableEquivalency10 {
- attribute double[] a;
- attribute double[]? b;
- };
-
- interface TestNullableEquivalency11 {
- attribute TestNullableEquivalency9[] a;
- attribute TestNullableEquivalency9[]? b;
- };
- """)
-
- for decl in parser.finish():
- if decl.isInterface():
- checkEquivalent(decl, harness)
-
-def checkEquivalent(iface, harness):
- type1 = iface.members[0].type
- type2 = iface.members[1].type
-
- harness.check(type1.nullable(), False, 'attr1 should not be nullable')
- harness.check(type2.nullable(), True, 'attr2 should be nullable')
-
- # We don't know about type1, but type2, the nullable type, definitely
- # shouldn't be builtin.
- harness.check(type2.builtin, False, 'attr2 should not be builtin')
-
- # Ensure that all attributes of type2 match those in type1, except for:
- # - names on an ignore list,
- # - names beginning with '_',
- # - functions which throw when called with no args, and
- # - class-level non-callables ("static variables").
- #
- # Yes, this is an ugly, fragile hack. But it finds bugs...
- for attr in dir(type1):
- if attr.startswith('_') or \
- attr in ['nullable', 'builtin', 'filename', 'location',
- 'inner', 'QName'] or \
- (hasattr(type(type1), attr) and not callable(getattr(type1, attr))):
- continue
-
- a1 = getattr(type1, attr)
-
- if callable(a1):
- try:
- v1 = a1()
- except:
- # Can't call a1 with no args, so skip this attriute.
- continue
-
- try:
- a2 = getattr(type2, attr)
- except:
- harness.ok(False, 'Missing %s attribute on type %s in %s' % (attr, type2, iface))
- continue
-
- if not callable(a2):
- harness.ok(False, "%s attribute on type %s in %s wasn't callable" % (attr, type2, iface))
- continue
-
- v2 = a2()
- harness.check(v2, v1, '%s method return value' % attr)
- else:
- try:
- a2 = getattr(type2, attr)
- except:
- harness.ok(False, 'Missing %s attribute on type %s in %s' % (attr, type2, iface))
- continue
-
- harness.check(a2, a1, '%s attribute should match' % attr)
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py b/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py
deleted file mode 100644
index 961ff825e9f..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_nullable_void.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface NullableVoid {
- void? foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py b/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py
deleted file mode 100644
index 1dcdc7fb8a5..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_optional_constraints.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface OptionalConstraints1 {
- void foo(optional byte arg1, byte arg2);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py b/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py
deleted file mode 100644
index 59d9be54e53..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_overload.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface TestOverloads {
- void basic();
- void basic(long arg1);
- boolean abitharder(TestOverloads foo);
- boolean abitharder(boolean foo);
- void abitharder(ArrayBuffer? foo);
- };
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestOverloads interface parsed without error.")
- harness.check(len(results), 1, "Should be one production.")
- iface = results[0]
- harness.ok(isinstance(iface, WebIDL.IDLInterface),
- "Should be an IDLInterface")
- harness.check(iface.identifier.QName(), "::TestOverloads", "Interface has the right QName")
- harness.check(iface.identifier.name, "TestOverloads", "Interface has the right name")
- harness.check(len(iface.members), 2, "Expect %s members" % 2)
-
- member = iface.members[0]
- harness.check(member.identifier.QName(), "::TestOverloads::basic", "Method has the right QName")
- harness.check(member.identifier.name, "basic", "Method has the right name")
- harness.check(member.hasOverloads(), True, "Method has overloads")
-
- signatures = member.signatures()
- harness.check(len(signatures), 2, "Method should have 2 signatures")
-
- (retval, argumentSet) = signatures[0]
-
- harness.check(str(retval), "Void", "Expect a void retval")
- harness.check(len(argumentSet), 0, "Expect an empty argument set")
-
- (retval, argumentSet) = signatures[1]
- harness.check(str(retval), "Void", "Expect a void retval")
- harness.check(len(argumentSet), 1, "Expect an argument set with one argument")
-
- argument = argumentSet[0]
- harness.ok(isinstance(argument, WebIDL.IDLArgument),
- "Should be an IDLArgument")
- harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1", "Argument has the right QName")
- harness.check(argument.identifier.name, "arg1", "Argument has the right name")
- harness.check(str(argument.type), "Long", "Argument has the right type")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py b/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py
deleted file mode 100644
index d3184c00731..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_sanity.py
+++ /dev/null
@@ -1,7 +0,0 @@
-def WebIDLTest(parser, harness):
- parser.parse("")
- parser.finish()
- harness.ok(True, "Parsing nothing doesn't throw.")
- parser.parse("interface Foo {};")
- parser.finish()
- harness.ok(True, "Parsing a silly interface doesn't throw.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py b/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py
deleted file mode 100644
index 5ea1743d36a..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_special_method_signature_mismatch.py
+++ /dev/null
@@ -1,294 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch1 {
- getter long long foo(long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch2 {
- getter void foo(unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch3 {
- getter boolean foo(unsigned long index, boolean extraArg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch4 {
- getter boolean foo(unsigned long... index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch5 {
- getter boolean foo(optional unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch6 {
- getter boolean foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch7 {
- deleter long long foo(long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch9 {
- deleter boolean foo(unsigned long index, boolean extraArg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch10 {
- deleter boolean foo(unsigned long... index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch11 {
- deleter boolean foo(optional unsigned long index);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch12 {
- deleter boolean foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch13 {
- setter long long foo(long index, long long value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch15 {
- setter boolean foo(unsigned long index, boolean value, long long extraArg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch16 {
- setter boolean foo(unsigned long index, boolean... value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch17 {
- setter boolean foo(unsigned long index, optional boolean value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch18 {
- setter boolean foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch20 {
- creator long long foo(long index, long long value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch22 {
- creator boolean foo(unsigned long index, boolean value, long long extraArg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch23 {
- creator boolean foo(unsigned long index, boolean... value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch24 {
- creator boolean foo(unsigned long index, optional boolean value);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodSignatureMismatch25 {
- creator boolean foo();
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py b/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py
deleted file mode 100644
index 695cfe4f250..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- interface SpecialMethods {
- getter long long (unsigned long index);
- setter long long (unsigned long index, long long value);
- creator long long (unsigned long index, long long value);
- deleter long long (unsigned long index);
- getter boolean (DOMString name);
- setter boolean (DOMString name, boolean value);
- creator boolean (DOMString name, boolean value);
- deleter boolean (DOMString name);
- };
-
- interface SpecialMethodsCombination {
- getter deleter long long (unsigned long index);
- setter creator long long (unsigned long index, long long value);
- getter deleter boolean (DOMString name);
- setter creator boolean (DOMString name, boolean value);
- };
- """)
-
- results = parser.finish()
-
- def checkMethod(method, QName, name,
- static=False, getter=False, setter=False, creator=False,
- deleter=False, legacycaller=False, stringifier=False):
- harness.ok(isinstance(method, WebIDL.IDLMethod),
- "Should be an IDLMethod")
- harness.check(method.identifier.QName(), QName, "Method has the right QName")
- harness.check(method.identifier.name, name, "Method has the right name")
- harness.check(method.isStatic(), static, "Method has the correct static value")
- harness.check(method.isGetter(), getter, "Method has the correct getter value")
- harness.check(method.isSetter(), setter, "Method has the correct setter value")
- harness.check(method.isCreator(), creator, "Method has the correct creator value")
- harness.check(method.isDeleter(), deleter, "Method has the correct deleter value")
- harness.check(method.isLegacycaller(), legacycaller, "Method has the correct legacycaller value")
- harness.check(method.isStringifier(), stringifier, "Method has the correct stringifier value")
-
- harness.check(len(results), 2, "Expect 2 interfaces")
-
- iface = results[0]
- harness.check(len(iface.members), 8, "Expect 8 members")
-
- checkMethod(iface.members[0], "::SpecialMethods::__indexedgetter", "__indexedgetter",
- getter=True)
- checkMethod(iface.members[1], "::SpecialMethods::__indexedsetter", "__indexedsetter",
- setter=True)
- checkMethod(iface.members[2], "::SpecialMethods::__indexedcreator", "__indexedcreator",
- creator=True)
- checkMethod(iface.members[3], "::SpecialMethods::__indexeddeleter", "__indexeddeleter",
- deleter=True)
- checkMethod(iface.members[4], "::SpecialMethods::__namedgetter", "__namedgetter",
- getter=True)
- checkMethod(iface.members[5], "::SpecialMethods::__namedsetter", "__namedsetter",
- setter=True)
- checkMethod(iface.members[6], "::SpecialMethods::__namedcreator", "__namedcreator",
- creator=True)
- checkMethod(iface.members[7], "::SpecialMethods::__nameddeleter", "__nameddeleter",
- deleter=True)
-
- iface = results[1]
- harness.check(len(iface.members), 4, "Expect 4 members")
-
- checkMethod(iface.members[0], "::SpecialMethodsCombination::__indexedgetterdeleter",
- "__indexedgetterdeleter", getter=True, deleter=True)
- checkMethod(iface.members[1], "::SpecialMethodsCombination::__indexedsettercreator",
- "__indexedsettercreator", setter=True, creator=True)
- checkMethod(iface.members[2], "::SpecialMethodsCombination::__namedgetterdeleter",
- "__namedgetterdeleter", getter=True, deleter=True)
- checkMethod(iface.members[3], "::SpecialMethodsCombination::__namedsettercreator",
- "__namedsettercreator", setter=True, creator=True)
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py b/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py
deleted file mode 100644
index 42e2c5bb71b..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_special_methods_uniqueness.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodUniqueness1 {
- getter deleter boolean (DOMString name);
- getter boolean (DOMString name);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodUniqueness1 {
- deleter boolean (DOMString name);
- getter deleter boolean (DOMString name);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodUniqueness1 {
- setter creator boolean (DOMString name);
- creator boolean (DOMString name);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- parser.parse("""
- interface SpecialMethodUniqueness1 {
- setter boolean (DOMString name);
- creator setter boolean (DOMString name);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py b/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py
deleted file mode 100644
index 3d0e5ca479f..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_treatNonCallableAsNull.py
+++ /dev/null
@@ -1,56 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- callback Function = any(any... arguments);
-
- interface TestTreatNonCallableAsNull1 {
- [TreatNonCallableAsNull] attribute Function? onfoo;
- attribute Function? onbar;
- };
- """)
-
- results = parser.finish()
-
- iface = results[1]
- attr = iface.members[0]
- harness.check(attr.type.treatNonCallableAsNull(), True, "Got the expected value")
- attr = iface.members[1]
- harness.check(attr.type.treatNonCallableAsNull(), False, "Got the expected value")
-
- parser = parser.reset()
-
- threw = False
- try:
- parser.parse("""
- callback Function = any(any... arguments);
-
- interface TestTreatNonCallableAsNull2 {
- [TreatNonCallableAsNull] attribute Function onfoo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- parser = parser.reset()
-
- threw = False
- try:
- parser.parse("""
- callback Function = any(any... arguments);
-
- [TreatNonCallableAsNull]
- interface TestTreatNonCallableAsNull3 {
- attribute Function onfoo;
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py b/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py
deleted file mode 100644
index 9d2f3b3c2ce..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_typedef.py
+++ /dev/null
@@ -1,76 +0,0 @@
-def WebIDLTest(parser, harness):
- parser.parse("""
- typedef long mylong;
- typedef long? mynullablelong;
- interface Foo {
- const mylong X = 5;
- const mynullablelong Y = 7;
- const mynullablelong Z = null;
- void foo(mylong arg);
- };
- """)
-
- results = parser.finish()
-
- harness.check(results[2].members[1].type.name, "Long",
- "Should expand typedefs")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- typedef long? mynullablelong;
- interface Foo {
- void foo(mynullablelong? Y);
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on nullable inside nullable arg.")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- typedef long? mynullablelong;
- interface Foo {
- const mynullablelong? X = 5;
- };
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown on nullable inside nullable const.")
-
- parser = parser.reset()
- threw = False
- try:
- parser.parse("""
- interface Foo {
- const mynullablelong? X = 5;
- };
- typedef long? mynullablelong;
- """)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Should have thrown on nullable inside nullable const typedef "
- "after interface.")
-
- parser = parser.reset()
- parser.parse("""
- interface Foo {
- const mylong X = 5;
- };
- typedef long mylong;
- """)
-
- results = parser.finish()
-
- harness.check(results[0].members[0].type.name, "Long",
- "Should expand typedefs that come before interface")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_union.py b/src/components/script/dom/bindings/codegen/parser/tests/test_union.py
deleted file mode 100644
index 68c2bcade8c..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_union.py
+++ /dev/null
@@ -1,169 +0,0 @@
-import WebIDL
-import itertools
-import string
-
-# We'd like to use itertools.chain but it's 2.6 or higher.
-def chain(*iterables):
- # chain('ABC', 'DEF') --> A B C D E F
- for it in iterables:
- for element in it:
- yield element
-
-# We'd like to use itertools.combinations but it's 2.6 or higher.
-def combinations(iterable, r):
- # combinations('ABCD', 2) --> AB AC AD BC BD CD
- # combinations(range(4), 3) --> 012 013 023 123
- pool = tuple(iterable)
- n = len(pool)
- if r > n:
- return
- indices = range(r)
- yield tuple(pool[i] for i in indices)
- while True:
- for i in reversed(range(r)):
- if indices[i] != i + n - r:
- break
- else:
- return
- indices[i] += 1
- for j in range(i+1, r):
- indices[j] = indices[j-1] + 1
- yield tuple(pool[i] for i in indices)
-
-# We'd like to use itertools.combinations_with_replacement but it's 2.7 or
-# higher.
-def combinations_with_replacement(iterable, r):
- # combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC
- pool = tuple(iterable)
- n = len(pool)
- if not n and r:
- return
- indices = [0] * r
- yield tuple(pool[i] for i in indices)
- while True:
- for i in reversed(range(r)):
- if indices[i] != n - 1:
- break
- else:
- return
- indices[i:] = [indices[i] + 1] * (r - i)
- yield tuple(pool[i] for i in indices)
-
-def WebIDLTest(parser, harness):
- types = ["float",
- "double",
- "short",
- "unsigned short",
- "long",
- "unsigned long",
- "long long",
- "unsigned long long",
- "boolean",
- "byte",
- "octet",
- "DOMString",
- #"sequence<float>",
- "object",
- "ArrayBuffer",
- #"Date",
- "TestInterface1",
- "TestInterface2"]
-
- testPre = """
- interface TestInterface1 {
- };
- interface TestInterface2 {
- };
- """
-
- interface = testPre + """
- interface PrepareForTest {
- """
- for (i, type) in enumerate(types):
- interface += string.Template("""
- readonly attribute ${type} attr${i};
- """).substitute(i=i, type=type)
- interface += """
- };
- """
-
- parser.parse(interface)
- results = parser.finish()
-
- iface = results[2]
-
- parser = parser.reset()
-
- def typesAreDistinguishable(t):
- return all(u[0].isDistinguishableFrom(u[1]) for u in combinations(t, 2))
- def typesAreNotDistinguishable(t):
- return any(not u[0].isDistinguishableFrom(u[1]) for u in combinations(t, 2))
- def unionTypeName(t):
- if len(t) > 2:
- t[0:2] = [unionTypeName(t[0:2])]
- return "(" + " or ".join(t) + ")"
-
- # typeCombinations is an iterable of tuples containing the name of the type
- # as a string and the parsed IDL type.
- def unionTypes(typeCombinations, predicate):
- for c in typeCombinations:
- if predicate(t[1] for t in c):
- yield unionTypeName([t[0] for t in c])
-
- # We limit invalid union types with a union member type to the subset of 3
- # types with one invalid combination.
- # typeCombinations is an iterable of tuples containing the name of the type
- # as a string and the parsed IDL type.
- def invalidUnionWithUnion(typeCombinations):
- for c in typeCombinations:
- if (typesAreNotDistinguishable((c[0][1], c[1][1])) and
- typesAreDistinguishable((c[1][1], c[2][1])) and
- typesAreDistinguishable((c[0][1], c[2][1]))):
- yield unionTypeName([t[0] for t in c])
-
- # Create a list of tuples containing the name of the type as a string and
- # the parsed IDL type.
- types = zip(types, (a.type for a in iface.members))
-
- validUnionTypes = chain(unionTypes(combinations(types, 2), typesAreDistinguishable),
- unionTypes(combinations(types, 3), typesAreDistinguishable))
- invalidUnionTypes = chain(unionTypes(combinations_with_replacement(types, 2), typesAreNotDistinguishable),
- invalidUnionWithUnion(combinations(types, 3)))
- interface = testPre + """
- interface TestUnion {
- """
- for (i, type) in enumerate(validUnionTypes):
- interface += string.Template("""
- void method${i}(${type} arg);
- ${type} returnMethod${i}();
- attribute ${type} attr${i};
- void arrayMethod${i}(${type}[] arg);
- ${type}[] arrayReturnMethod${i}();
- attribute ${type}[] arrayAttr${i};
- void optionalMethod${i}(${type}? arg);
- """).substitute(i=i, type=type)
- interface += """
- };
- """
- parser.parse(interface)
- results = parser.finish()
-
- parser = parser.reset()
-
- for invalid in invalidUnionTypes:
- interface = testPre + string.Template("""
- interface TestUnion {
- void method(${type} arg);
- };
- """).substitute(type=invalid)
-
- threw = False
- try:
- parser.parse(interface)
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- parser = parser.reset()
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py b/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py
deleted file mode 100644
index e34cadab470..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_union_any.py
+++ /dev/null
@@ -1,14 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface AnyNotInUnion {
- void foo((any or DOMString) arg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py b/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py
deleted file mode 100644
index 08430a94a2e..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_union_nullable.py
+++ /dev/null
@@ -1,53 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- parser.parse("""
- interface OneNullableInUnion {
- void foo((object? or DOMString?) arg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "Two nullable member types of a union should have thrown.")
-
- parser.reset()
- threw = False
-
- try:
- parser.parse("""
- interface NullableInNullableUnion {
- void foo((object? or DOMString)? arg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "A nullable union type with a nullable member type should have "
- "thrown.")
-
- parser.reset()
- threw = False
-
- try:
- parser.parse("""
- interface NullableInUnionNullableUnionHelper {
- };
- interface NullableInUnionNullableUnion {
- void foo(((object? or DOMString) or NullableInUnionNullableUnionHelper)? arg);
- };
- """)
-
- results = parser.finish()
- except:
- threw = True
-
- harness.ok(threw,
- "A nullable union type with a nullable member type should have "
- "thrown.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py b/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py
deleted file mode 100644
index d9a78db2043..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_callback.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import WebIDL
-
-def WebIDLTest(parser, harness):
- parser.parse("""
- callback TestVariadicCallback = any(any... arguments);
- """)
-
- results = parser.finish()
-
- harness.ok(True, "TestVariadicCallback callback parsed without error.")
diff --git a/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py b/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py
deleted file mode 100644
index 9cba22c5842..00000000000
--- a/src/components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py
+++ /dev/null
@@ -1,39 +0,0 @@
-def WebIDLTest(parser, harness):
- threw = False
- try:
- results = parser.parse("""
- interface VariadicConstraints1 {
- void foo(byte... arg1, byte arg2);
- };
- """)
-
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- results = parser.parse("""
- interface VariadicConstraints2 {
- void foo(byte... arg1, optional byte arg2);
- };
- """)
-
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")
-
- threw = False
- try:
- results = parser.parse("""
- interface VariadicConstraints3 {
- void foo(optional byte... arg1);
- };
- """)
-
- except:
- threw = True
-
- harness.ok(threw, "Should have thrown.")