Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_cereactions.py
blob2aa4da40c821592737cac932cbfaf89ea32419f4
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 threw = False
6 try:
7 parser.parse(
8 """
9 interface Foo {
10 [CEReactions(DOMString a)] undefined foo(boolean arg2);
12 """
15 parser.finish()
16 except WebIDL.WebIDLError:
17 threw = True
19 harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
21 parser = parser.reset()
22 threw = False
23 try:
24 parser.parse(
25 """
26 interface Foo {
27 [CEReactions(DOMString b)] readonly attribute boolean bar;
29 """
32 parser.finish()
33 except WebIDL.WebIDLError:
34 threw = True
36 harness.ok(threw, "Should have thrown for [CEReactions] with an argument")
38 parser = parser.reset()
39 threw = False
40 try:
41 parser.parse(
42 """
43 interface Foo {
44 [CEReactions] attribute boolean bar;
46 """
49 parser.finish()
50 except Exception as e:
51 harness.ok(
52 False,
53 "Shouldn't have thrown for [CEReactions] used on writable attribute. %s"
54 % e,
56 threw = True
58 parser = parser.reset()
59 threw = False
60 try:
61 parser.parse(
62 """
63 interface Foo {
64 [CEReactions] undefined foo(boolean arg2);
66 """
69 parser.finish()
70 except Exception as e:
71 harness.ok(
72 False,
73 "Shouldn't have thrown for [CEReactions] used on regular operations. %s"
74 % e,
76 threw = True
78 parser = parser.reset()
79 threw = False
80 try:
81 parser.parse(
82 """
83 interface Foo {
84 [CEReactions] readonly attribute boolean A;
86 """
89 parser.finish()
90 except WebIDL.WebIDLError:
91 threw = True
93 harness.ok(
94 threw, "Should have thrown for [CEReactions] used on a readonly attribute"
97 parser = parser.reset()
98 threw = False
99 try:
100 parser.parse(
102 [CEReactions]
103 interface Foo {
108 parser.finish()
109 except WebIDL.WebIDLError:
110 threw = True
112 harness.ok(threw, "Should have thrown for [CEReactions] used on a interface")
114 parser = parser.reset()
115 threw = False
116 try:
117 parser.parse(
119 interface Foo {
120 [CEReactions] getter any(DOMString name);
124 parser.finish()
125 except WebIDL.WebIDLError:
126 threw = True
128 harness.ok(threw, "Should have thrown for [CEReactions] used on a named getter")
130 parser = parser.reset()
131 threw = False
132 try:
133 parser.parse(
135 interface Foo {
136 [CEReactions] legacycaller double compute(double x);
140 parser.finish()
141 except WebIDL.WebIDLError:
142 threw = True
144 harness.ok(threw, "Should have thrown for [CEReactions] used on a legacycaller")
146 parser = parser.reset()
147 threw = False
148 try:
149 parser.parse(
151 interface Foo {
152 [CEReactions] stringifier DOMString ();
156 parser.finish()
157 except WebIDL.WebIDLError:
158 threw = True
160 harness.ok(threw, "Should have thrown for [CEReactions] used on a stringifier")