Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_constructor_global.py
blob387698d9dd54603eee23fc7dbcf8d19e77367b29
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 threw = False
6 try:
7 parser.parse(
8 """
9 [Global=TestConstructorGlobal, Exposed=TestConstructorGlobal]
10 interface TestConstructorGlobal {
11 constructor();
13 """
16 parser.finish()
17 except WebIDL.WebIDLError:
18 threw = True
20 harness.ok(threw, "Should have thrown.")
22 parser = parser.reset()
23 threw = False
24 try:
25 parser.parse(
26 """
27 [Global=TestLegacyFactoryFunctionGlobal, Exposed=TestLegacyFactoryFunctionGlobal,
28 LegacyFactoryFunction=FooBar]
29 interface TestLegacyFactoryFunctionGlobal {
31 """
33 parser.finish()
34 except WebIDL.WebIDLError:
35 threw = True
37 harness.ok(threw, "Should have thrown.")
39 parser = parser.reset()
40 threw = False
41 try:
42 parser.parse(
43 """
44 [LegacyFactoryFunction=FooBar, Global=TestLegacyFactoryFunctionGlobal,
45 Exposed=TestLegacyFactoryFunctionGlobal]
46 interface TestLegacyFactoryFunctionGlobal {
48 """
50 parser.finish()
51 except WebIDL.WebIDLError:
52 threw = True
54 harness.ok(threw, "Should have thrown.")
56 parser = parser.reset()
57 threw = False
58 try:
59 parser.parse(
60 """
61 [Global=TestHTMLConstructorGlobal, Exposed=TestHTMLConstructorGlobal]
62 interface TestHTMLConstructorGlobal {
63 [HTMLConstructor] constructor();
65 """
68 parser.finish()
69 except WebIDL.WebIDLError:
70 threw = True
72 harness.ok(threw, "Should have thrown.")