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

@@ -120,7 +120,7 @@ def WebIDLTest(parser, harness):
};
""")
results = parser.finish()
except Exception, x:
except Exception as x:
threw = True
harness.ok(not threw, "Should allow integer to float type corecion")
@@ -133,7 +133,7 @@ def WebIDLTest(parser, harness):
};
""")
results = parser.finish()
except Exception, x:
except Exception as x:
threw = True
harness.ok(threw, "Should not allow [GetterThrows] on methods")
@@ -146,7 +146,7 @@ def WebIDLTest(parser, harness):
};
""")
results = parser.finish()
except Exception, x:
except Exception as x:
threw = True
harness.ok(threw, "Should not allow [SetterThrows] on methods")
@@ -159,7 +159,7 @@ def WebIDLTest(parser, harness):
};
""")
results = parser.finish()
except Exception, x:
except Exception as x:
threw = True
harness.ok(threw, "Should spell [Throws] correctly on methods")
@@ -172,6 +172,85 @@ def WebIDLTest(parser, harness):
};
""")
results = parser.finish()
except Exception, x:
except Exception as x:
threw = True
harness.ok(threw, "Should not allow __noSuchMethod__ methods")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
[Throws, LenientFloat]
void foo(float myFloat);
[Throws]
void foo();
};
""")
results = parser.finish()
except Exception as x:
threw = True
harness.ok(not threw, "Should allow LenientFloat to be only in a specific overload")
parser = parser.reset()
parser.parse("""
interface A {
[Throws]
void foo();
[Throws, LenientFloat]
void foo(float myFloat);
};
""")
results = parser.finish()
iface = results[0]
methods = iface.members
lenientFloat = methods[0].getExtendedAttribute("LenientFloat")
harness.ok(lenientFloat is not None, "LenientFloat in overloads must be added to the method")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
[Throws, LenientFloat]
void foo(float myFloat);
[Throws]
void foo(float myFloat, float yourFloat);
};
""")
results = parser.finish()
except Exception as x:
threw = True
harness.ok(threw, "Should prevent overloads from getting different restricted float behavior")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
[Throws]
void foo(float myFloat, float yourFloat);
[Throws, LenientFloat]
void foo(float myFloat);
};
""")
results = parser.finish()
except Exception as x:
threw = True
harness.ok(threw, "Should prevent overloads from getting different restricted float behavior (2)")
parser = parser.reset()
threw = False
try:
parser.parse("""
interface A {
[Throws, LenientFloat]
void foo(float myFloat);
[Throws, LenientFloat]
void foo(short myShort);
};
""")
results = parser.finish()
except Exception as x:
threw = True
harness.ok(threw, "Should prevent overloads from getting redundant [LenientFloat]")