Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_lenientSetter.py
blob9059255594f5a5684d169550210b12baa4cd79e4
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import WebIDL
8 def should_throw(parser, harness, message, code):
9 parser = parser.reset()
10 threw = False
11 try:
12 parser.parse(code)
13 parser.finish()
14 except WebIDL.WebIDLError:
15 threw = True
17 harness.ok(threw, "Should have thrown: %s" % message)
20 def WebIDLTest(parser, harness):
21 # The [LegacyLenientSetter] extended attribute MUST take no arguments.
22 should_throw(
23 parser,
24 harness,
25 "no arguments",
26 """
27 interface I {
28 [LegacyLenientSetter=X] readonly attribute long A;
30 """,
33 # An attribute with the [LegacyLenientSetter] extended attribute MUST NOT
34 # also be declared with the [PutForwards] extended attribute.
35 should_throw(
36 parser,
37 harness,
38 "PutForwards",
39 """
40 interface I {
41 [PutForwards=B, LegacyLenientSetter] readonly attribute J A;
43 interface J {
44 attribute long B;
46 """,
49 # An attribute with the [LegacyLenientSetter] extended attribute MUST NOT
50 # also be declared with the [Replaceable] extended attribute.
51 should_throw(
52 parser,
53 harness,
54 "Replaceable",
55 """
56 interface I {
57 [Replaceable, LegacyLenientSetter] readonly attribute J A;
59 """,
62 # The [LegacyLenientSetter] extended attribute MUST NOT be used on an
63 # attribute that is not read only.
64 should_throw(
65 parser,
66 harness,
67 "writable attribute",
68 """
69 interface I {
70 [LegacyLenientSetter] attribute long A;
72 """,
75 # The [LegacyLenientSetter] extended attribute MUST NOT be used on a
76 # static attribute.
77 should_throw(
78 parser,
79 harness,
80 "static attribute",
81 """
82 interface I {
83 [LegacyLenientSetter] static readonly attribute long A;
85 """,