tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_constructor_no_interface_object.py (1084B)


      1 import WebIDL
      2 
      3 
      4 def WebIDLTest(parser, harness):
      5    threw = False
      6    try:
      7        parser.parse(
      8            """
      9            [LegacyNoInterfaceObject]
     10            interface TestConstructorLegacyNoInterfaceObject {
     11              constructor();
     12            };
     13        """
     14        )
     15 
     16        parser.finish()
     17    except WebIDL.WebIDLError:
     18        threw = True
     19 
     20    harness.ok(threw, "Should have thrown.")
     21 
     22    parser = parser.reset()
     23 
     24    parser.parse(
     25        """
     26        [LegacyNoInterfaceObject, LegacyFactoryFunction=FooBar]
     27        interface TestLegacyFactoryFunctionLegacyNoInterfaceObject {
     28        };
     29    """
     30    )
     31 
     32    # Test HTMLConstructor and LegacyNoInterfaceObject
     33    parser = parser.reset()
     34 
     35    threw = False
     36    try:
     37        parser.parse(
     38            """
     39            [LegacyNoInterfaceObject]
     40            interface TestHTMLConstructorLegacyNoInterfaceObject {
     41              [HTMLConstructor] constructor();
     42            };
     43        """
     44        )
     45 
     46        parser.finish()
     47    except WebIDL.WebIDLError:
     48        threw = True
     49 
     50    harness.ok(threw, "Should have thrown.")