1
0
Fork 0
firefox/dom/bindings/parser/tests/test_constructor_global.py
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

72 lines
1.7 KiB
Python

import WebIDL
def WebIDLTest(parser, harness):
threw = False
try:
parser.parse(
"""
[Global=TestConstructorGlobal, Exposed=TestConstructorGlobal]
interface TestConstructorGlobal {
constructor();
};
"""
)
parser.finish()
except WebIDL.WebIDLError:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
[Global=TestLegacyFactoryFunctionGlobal, Exposed=TestLegacyFactoryFunctionGlobal,
LegacyFactoryFunction=FooBar]
interface TestLegacyFactoryFunctionGlobal {
};
"""
)
parser.finish()
except WebIDL.WebIDLError:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
[LegacyFactoryFunction=FooBar, Global=TestLegacyFactoryFunctionGlobal,
Exposed=TestLegacyFactoryFunctionGlobal]
interface TestLegacyFactoryFunctionGlobal {
};
"""
)
parser.finish()
except WebIDL.WebIDLError:
threw = True
harness.ok(threw, "Should have thrown.")
parser = parser.reset()
threw = False
try:
parser.parse(
"""
[Global=TestHTMLConstructorGlobal, Exposed=TestHTMLConstructorGlobal]
interface TestHTMLConstructorGlobal {
[HTMLConstructor] constructor();
};
"""
)
parser.finish()
except WebIDL.WebIDLError:
threw = True
harness.ok(threw, "Should have thrown.")