Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_global_extended_attr.py
blob9d52747a1dabccd56ad0e5833ad1703fac3b74e6
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 parser.parse(
6 """
7 [Global=Foo, Exposed=Foo]
8 interface Foo : Bar {
9 getter any(DOMString name);
11 [Exposed=Foo]
12 interface Bar {};
13 """
16 results = parser.finish()
18 harness.ok(
19 results[0].isOnGlobalProtoChain(),
20 "[Global] interface should be on global's proto chain",
22 harness.ok(
23 results[1].isOnGlobalProtoChain(),
24 "[Global] interface should be on global's proto chain",
27 parser = parser.reset()
28 threw = False
29 try:
30 parser.parse(
31 """
32 [Global=Foo, Exposed=Foo]
33 interface Foo {
34 getter any(DOMString name);
35 setter undefined(DOMString name, any arg);
37 """
39 parser.finish()
40 except WebIDL.WebIDLError:
41 threw = True
43 harness.ok(
44 threw,
45 "Should have thrown for [Global] used on an interface with a " "named setter",
48 parser = parser.reset()
49 threw = False
50 try:
51 parser.parse(
52 """
53 [Global=Foo, Exposed=Foo]
54 interface Foo {
55 getter any(DOMString name);
56 deleter undefined(DOMString name);
58 """
60 parser.finish()
61 except WebIDL.WebIDLError:
62 threw = True
64 harness.ok(
65 threw,
66 "Should have thrown for [Global] used on an interface with a " "named deleter",
69 parser = parser.reset()
70 threw = False
71 try:
72 parser.parse(
73 """
74 [Global=Foo, LegacyOverrideBuiltIns, Exposed=Foo]
75 interface Foo {
77 """
79 parser.finish()
80 except WebIDL.WebIDLError:
81 threw = True
83 harness.ok(
84 threw,
85 "Should have thrown for [Global] used on an interface with a "
86 "[LegacyOverrideBuiltIns]",
89 parser = parser.reset()
90 threw = False
91 try:
92 parser.parse(
93 """
94 [Global=Foo, Exposed=Foo]
95 interface Foo : Bar {
97 [LegacyOverrideBuiltIns, Exposed=Foo]
98 interface Bar {
102 parser.finish()
103 except WebIDL.WebIDLError:
104 threw = True
106 harness.ok(
107 threw,
108 "Should have thrown for [Global] used on an interface with an "
109 "[LegacyOverrideBuiltIns] ancestor",
112 parser = parser.reset()
113 threw = False
114 try:
115 parser.parse(
117 [Global=Foo, Exposed=Foo]
118 interface Foo {
120 [Exposed=Foo]
121 interface Bar : Foo {
125 parser.finish()
126 except WebIDL.WebIDLError:
127 threw = True
129 harness.ok(
130 threw,
131 "Should have thrown for [Global] used on an interface with a " "descendant",
134 parser = parser.reset()
135 threw = False
136 try:
137 parser.parse(
139 [Global, Exposed=Foo]
140 interface Foo {
144 parser.finish()
145 except WebIDL.WebIDLError:
146 threw = True
148 harness.ok(
149 threw,
150 "Should have thrown for [Global] without a right hand side value",