mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Create a top-level "third_party" directory
This directory now contains third_party software that is vendored into the Servo source tree. The idea is that it would eventually hold webrender and other crates from mozilla-central as well with a standard patch management approach for each.
This commit is contained in:
parent
7412e28349
commit
8be014ee46
148 changed files with 10 additions and 7 deletions
128
third_party/WebIDL/tests/test_conditional_dictionary_member.py
vendored
Normal file
128
third_party/WebIDL/tests/test_conditional_dictionary_member.py
vendored
Normal file
|
@ -0,0 +1,128 @@
|
|||
def WebIDLTest(parser, harness):
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary Dict {
|
||||
any foo;
|
||||
[ChromeOnly] any bar;
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
harness.check(len(results), 1, "Should have a dictionary")
|
||||
members = results[0].members
|
||||
harness.check(len(members), 2, "Should have two members")
|
||||
# Note that members are ordered lexicographically, so "bar" comes
|
||||
# before "foo".
|
||||
harness.ok(
|
||||
members[0].getExtendedAttribute("ChromeOnly"), "First member is not ChromeOnly"
|
||||
)
|
||||
harness.ok(
|
||||
not members[1].getExtendedAttribute("ChromeOnly"), "Second member is ChromeOnly"
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary Dict {
|
||||
any foo;
|
||||
any bar;
|
||||
};
|
||||
|
||||
interface Iface {
|
||||
[Constant, Cached] readonly attribute Dict dict;
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
harness.check(len(results), 2, "Should have a dictionary and an interface")
|
||||
|
||||
parser = parser.reset()
|
||||
exception = None
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary Dict {
|
||||
any foo;
|
||||
[ChromeOnly] any bar;
|
||||
};
|
||||
|
||||
interface Iface {
|
||||
[Constant, Cached] readonly attribute Dict dict;
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
harness.ok(exception, "Should have thrown.")
|
||||
harness.check(
|
||||
exception.message,
|
||||
"[Cached] and [StoreInSlot] must not be used on an attribute "
|
||||
"whose type contains a [ChromeOnly] dictionary member",
|
||||
"Should have thrown the right exception",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
exception = None
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary ParentDict {
|
||||
[ChromeOnly] any bar;
|
||||
};
|
||||
|
||||
dictionary Dict : ParentDict {
|
||||
any foo;
|
||||
};
|
||||
|
||||
interface Iface {
|
||||
[Constant, Cached] readonly attribute Dict dict;
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
harness.ok(exception, "Should have thrown (2).")
|
||||
harness.check(
|
||||
exception.message,
|
||||
"[Cached] and [StoreInSlot] must not be used on an attribute "
|
||||
"whose type contains a [ChromeOnly] dictionary member",
|
||||
"Should have thrown the right exception (2)",
|
||||
)
|
||||
|
||||
parser = parser.reset()
|
||||
exception = None
|
||||
try:
|
||||
parser.parse(
|
||||
"""
|
||||
dictionary GrandParentDict {
|
||||
[ChromeOnly] any baz;
|
||||
};
|
||||
|
||||
dictionary ParentDict : GrandParentDict {
|
||||
any bar;
|
||||
};
|
||||
|
||||
dictionary Dict : ParentDict {
|
||||
any foo;
|
||||
};
|
||||
|
||||
interface Iface {
|
||||
[Constant, Cached] readonly attribute Dict dict;
|
||||
};
|
||||
"""
|
||||
)
|
||||
results = parser.finish()
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
harness.ok(exception, "Should have thrown (3).")
|
||||
harness.check(
|
||||
exception.message,
|
||||
"[Cached] and [StoreInSlot] must not be used on an attribute "
|
||||
"whose type contains a [ChromeOnly] dictionary member",
|
||||
"Should have thrown the right exception (3)",
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue