aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/parser/tests/test_interface.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/codegen/parser/tests/test_interface.py')
-rw-r--r--components/script/dom/bindings/codegen/parser/tests/test_interface.py179
1 files changed, 72 insertions, 107 deletions
diff --git a/components/script/dom/bindings/codegen/parser/tests/test_interface.py b/components/script/dom/bindings/codegen/parser/tests/test_interface.py
index e8ed67b54b3..47db3ae4cc9 100644
--- a/components/script/dom/bindings/codegen/parser/tests/test_interface.py
+++ b/components/script/dom/bindings/codegen/parser/tests/test_interface.py
@@ -84,100 +84,6 @@ def WebIDLTest(parser, harness):
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 {};
""")
@@ -189,12 +95,12 @@ def WebIDLTest(parser, harness):
parser = parser.reset()
parser.parse("""
- [Constructor(long arg)]
interface A {
+ constructor();
+ constructor(long arg);
readonly attribute boolean x;
void foo();
};
- [Constructor]
partial interface A {
readonly attribute boolean y;
void foo(long arg);
@@ -219,13 +125,13 @@ def WebIDLTest(parser, harness):
parser = parser.reset()
parser.parse("""
- [Constructor]
partial interface A {
readonly attribute boolean y;
void foo(long arg);
};
- [Constructor(long arg)]
interface A {
+ constructor();
+ constructor(long arg);
readonly attribute boolean x;
void foo();
};
@@ -376,30 +282,89 @@ def WebIDLTest(parser, harness):
"Should not allow unknown extended attributes on interfaces")
parser = parser.reset()
+ parser.parse("""
+ [Global, Exposed=Window] interface Window {};
+ [Exposed=Window, LegacyWindowAlias=A]
+ interface B {};
+ [Exposed=Window, LegacyWindowAlias=(C, D)]
+ interface E {};
+ """);
+ results = parser.finish();
+ harness.check(results[1].legacyWindowAliases, ["A"],
+ "Should support a single identifier")
+ harness.check(results[2].legacyWindowAliases, ["C", "D"],
+ "Should support an identifier list")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse("""
+ [LegacyWindowAlias]
+ interface A {};
+ """)
+ results = parser.finish()
+ except:
+ threw = True
+ harness.ok(threw,
+ "Should not allow [LegacyWindowAlias] with no value")
+
+ parser = parser.reset()
threw = False
try:
parser.parse("""
+ [Exposed=Worker, LegacyWindowAlias=B]
+ interface A {};
+ """)
+ results = parser.finish()
+ except:
+ threw = True
+ harness.ok(threw,
+ "Should not allow [LegacyWindowAlias] without Window exposure")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse("""
+ [Global, Exposed=Window] interface Window {};
+ [Exposed=Window]
+ interface A {};
+ [Exposed=Window, LegacyWindowAlias=A]
interface B {};
- [ArrayClass]
- interface A : B {
- };
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
- "Should not allow [ArrayClass] on interfaces with parents")
+ "Should not allow [LegacyWindowAlias] to conflict with other identifiers")
parser = parser.reset()
threw = False
try:
parser.parse("""
- [ArrayClass]
- interface A {
- };
+ [Global, Exposed=Window] interface Window {};
+ [Exposed=Window, LegacyWindowAlias=A]
+ interface B {};
+ [Exposed=Window]
+ interface A {};
""")
results = parser.finish()
except:
threw = True
- harness.ok(not threw,
- "Should allow [ArrayClass] on interfaces without parents")
+ harness.ok(threw,
+ "Should not allow [LegacyWindowAlias] to conflict with other identifiers")
+
+ parser = parser.reset()
+ threw = False
+ try:
+ parser.parse("""
+ [Global, Exposed=Window] interface Window {};
+ [Exposed=Window, LegacyWindowAlias=A]
+ interface B {};
+ [Exposed=Window, LegacyWindowAlias=A]
+ interface C {};
+ """)
+ results = parser.finish()
+ except:
+ threw = True
+ harness.ok(threw,
+ "Should not allow [LegacyWindowAlias] to conflict with other identifiers")