Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_extended_attributes.py
blob96c8ee9acbbeabce6f8db67a2ce0086316d29070
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 parser.parse(
6 """
7 [LegacyNoInterfaceObject]
8 interface TestExtendedAttr {
9 [LegacyUnforgeable] readonly attribute byte b;
11 """
14 parser.finish()
16 parser = parser.reset()
17 parser.parse(
18 """
19 [Pref="foo.bar",Pref=flop]
20 interface TestExtendedAttr {
21 [Pref="foo.bar"] attribute byte b;
23 """
26 parser.finish()
28 parser = parser.reset()
29 parser.parse(
30 """
31 interface TestLegacyLenientThis {
32 [LegacyLenientThis] attribute byte b;
34 """
37 results = parser.finish()
38 harness.ok(
39 results[0].members[0].hasLegacyLenientThis(), "Should have a lenient this"
42 parser = parser.reset()
43 threw = False
44 try:
45 parser.parse(
46 """
47 interface TestLegacyLenientThis2 {
48 [LegacyLenientThis=something] attribute byte b;
50 """
52 parser.finish()
53 except WebIDL.WebIDLError:
54 threw = True
56 harness.ok(threw, "[LegacyLenientThis] must take no arguments")
58 parser = parser.reset()
59 parser.parse(
60 """
61 interface TestClamp {
62 undefined testClamp([Clamp] long foo);
63 undefined testNotClamp(long foo);
65 """
68 results = parser.finish()
69 # Pull out the first argument out of the arglist of the first (and
70 # only) signature.
71 harness.ok(
72 results[0].members[0].signatures()[0][1][0].type.hasClamp(), "Should be clamped"
74 harness.ok(
75 not results[0].members[1].signatures()[0][1][0].type.hasClamp(),
76 "Should not be clamped",
79 parser = parser.reset()
80 threw = False
81 try:
82 parser.parse(
83 """
84 interface TestClamp2 {
85 undefined testClamp([Clamp=something] long foo);
87 """
89 parser.finish()
90 except WebIDL.WebIDLError:
91 threw = True
93 harness.ok(threw, "[Clamp] must take no arguments")
95 parser = parser.reset()
96 parser.parse(
97 """
98 interface TestEnforceRange {
99 undefined testEnforceRange([EnforceRange] long foo);
100 undefined testNotEnforceRange(long foo);
105 results = parser.finish()
106 # Pull out the first argument out of the arglist of the first (and
107 # only) signature.
108 harness.ok(
109 results[0].members[0].signatures()[0][1][0].type.hasEnforceRange(),
110 "Should be enforceRange",
112 harness.ok(
113 not results[0].members[1].signatures()[0][1][0].type.hasEnforceRange(),
114 "Should not be enforceRange",
117 parser = parser.reset()
118 threw = False
119 try:
120 parser.parse(
122 interface TestEnforceRange2 {
123 undefined testEnforceRange([EnforceRange=something] long foo);
127 parser.finish()
128 except WebIDL.WebIDLError:
129 threw = True
131 harness.ok(threw, "[EnforceRange] must take no arguments")