Sync WebIDL.py with gecko

This commit is contained in:
Kagami Sascha Rosylight
2019-07-11 13:16:10 +09:00
parent 5fdc7c0d2c
commit 56f31c85ef
35 changed files with 727 additions and 221 deletions

View File

@@ -374,3 +374,89 @@ def WebIDLTest(parser, harness):
threw = True
harness.ok(threw,
"Should not allow unknown extended attributes on interfaces")
parser = parser.reset()
parser.parse("""
[Global] 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] interface Window {};
interface A {};
[Exposed=Window, LegacyWindowAlias=A]
interface B {};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should not allow [LegacyWindowAlias] to conflict with other identifiers")
parser = parser.reset()
threw = False
try:
parser.parse("""
[Global] interface Window {};
[Exposed=Window, LegacyWindowAlias=A]
interface B {};
interface A {};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should not allow [LegacyWindowAlias] to conflict with other identifiers")
parser = parser.reset()
threw = False
try:
parser.parse("""
[Global] 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")