mirror of
https://github.com/servo/servo
synced 2026-04-28 18:37:39 +02:00
Sync WebIDL.py with gecko
This commit is contained in:
@@ -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]")
|
||||
|
||||
Reference in New Issue
Block a user