4 def WebIDLTest(parser
, harness
):
5 def parseWithNode(test
):
9 interface Document : Node {};
10 interface Element : Node {};
11 interface HTMLElement : Element {};
16 def parseFrozenArrayAttribute(innerType
):
19 interface ReflectedAttribute {
20 [Frozen, ReflectedHTMLAttributeReturningFrozenArray]
21 attribute sequence<%s>? reflectedHTMLAttribute;
27 results
= parser
.finish()
29 harness
.check(len(results
), 5, "Should know about one thing")
31 isinstance(results
[4], WebIDL
.IDLInterface
), "Should have an interface here"
33 members
= results
[4].members
34 harness
.check(len(members
), 1, "Should have one member")
35 harness
.ok(members
[0].isAttr(), "Should have attribute")
37 members
[0].getExtendedAttribute(
38 "ReflectedHTMLAttributeReturningFrozenArray"
41 "Should have extended attribute",
44 parseFrozenArrayAttribute("Element")
46 parser
= parser
.reset()
47 parseFrozenArrayAttribute("HTMLElement")
49 parser
= parser
.reset()
54 interface ReflectedAttribute {
55 [ReflectedHTMLAttributeReturningFrozenArray]
56 attribute Element? reflectedHTMLAttribute;
62 except WebIDL
.WebIDLError
:
66 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
67 "should only be used on attributes with a sequence<*Element> type.",
70 parser
= parser
.reset()
75 interface ReflectedAttribute {
76 [Frozen, ReflectedHTMLAttributeReturningFrozenArray]
77 attribute sequence<long> reflectedHTMLAttribute;
83 except WebIDL
.WebIDLError
:
87 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
88 "should only be used on attributes with a sequence<*Element> type.",
91 parser
= parser
.reset()
96 interface ReflectedAttribute {
97 [Frozen, ReflectedHTMLAttributeReturningFrozenArray]
98 attribute sequence<Document> reflectedHTMLAttribute;
104 except WebIDL
.WebIDLError
:
108 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
109 "should only be used on attributes with a sequence<*Element> type.",
112 parser
= parser
.reset()
117 interface ReflectedAttribute {
118 [ReflectedHTMLAttributeReturningFrozenArray]
119 sequence<Element>? reflectedHTMLAttribute();
125 except WebIDL
.WebIDLError
:
129 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
130 "should only be used on attributes with a sequence<*Element> type.",
133 parser
= parser
.reset()
138 interface ReflectedAttribute {
139 [Frozen, ReflectedHTMLAttributeReturningFrozenArray, Cached, Pure]
140 attribute sequence<Element>? reflectedHTMLAttribute;
146 except WebIDL
.WebIDLError
:
150 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
151 "should not be used together with [Cached].",
154 parser
= parser
.reset()
159 interface ReflectedAttribute {
160 [Frozen, ReflectedHTMLAttributeReturningFrozenArray, StoreInSlot, Pure]
161 attribute sequence<Element>? reflectedHTMLAttribute;
167 except WebIDL
.WebIDLError
:
171 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
172 "should not be used together with [Cached].",
175 parser
= parser
.reset()
180 interface ReflectedAttributeBase {
181 [Frozen, ReflectedHTMLAttributeReturningFrozenArray]
182 attribute sequence<Element>? reflectedHTMLAttributeBase;
184 interface ReflectedAttribute : ReflectedAttributeBase {
185 [Frozen, ReflectedHTMLAttributeReturningFrozenArray]
186 attribute sequence<Element>? reflectedHTMLAttribute;
192 except WebIDL
.WebIDLError
:
196 "Should have thrown because [ReflectedHTMLAttributeReturningFrozenArray] "
197 "should not be used on the attribute of an interface that inherits from "
198 "an interface that also has an attribute with "
199 "[ReflectedHTMLAttributeReturningFrozenArray].",