dom/bindings/parser/tests/test_global_extended_attr.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 def WebIDLTest(parser, harness):
     2     parser.parse("""
     3       [Global]
     4       interface Foo : Bar {
     5         getter any(DOMString name);
     6       };
     7       interface Bar {};
     8     """)
    10     results = parser.finish()
    12     harness.ok(results[0].isOnGlobalProtoChain(),
    13                "[Global] interface should be on global's proto chain")
    14     harness.ok(results[1].isOnGlobalProtoChain(),
    15                "[Global] interface should be on global's proto chain")
    17     parser = parser.reset()
    18     threw = False
    19     try:
    20         parser.parse("""
    21           [Global]
    22           interface Foo {
    23             getter any(DOMString name);
    24             setter void(DOMString name, any arg);
    25           };
    26         """)
    27         results = parser.finish()
    28     except:
    29         threw = True
    31     harness.ok(threw,
    32                "Should have thrown for [Global] used on an interface with a "
    33                "named setter")
    35     parser = parser.reset()
    36     threw = False
    37     try:
    38         parser.parse("""
    39           [Global]
    40           interface Foo {
    41             getter any(DOMString name);
    42             creator void(DOMString name, any arg);
    43           };
    44         """)
    45         results = parser.finish()
    46     except:
    47         threw = True
    49     harness.ok(threw,
    50                "Should have thrown for [Global] used on an interface with a "
    51                "named creator")
    53     parser = parser.reset()
    54     threw = False
    55     try:
    56         parser.parse("""
    57           [Global]
    58           interface Foo {
    59             getter any(DOMString name);
    60             deleter void(DOMString name);
    61           };
    62         """)
    63         results = parser.finish()
    64     except:
    65         threw = True
    67     harness.ok(threw,
    68                "Should have thrown for [Global] used on an interface with a "
    69                "named deleter")
    71     parser = parser.reset()
    72     threw = False
    73     try:
    74         parser.parse("""
    75           [Global, OverrideBuiltins]
    76           interface Foo {
    77           };
    78         """)
    79         results = parser.finish()
    80     except:
    81         threw = True
    83     harness.ok(threw,
    84                "Should have thrown for [Global] used on an interface with a "
    85                "[OverrideBuiltins]")
    87     parser = parser.reset()
    88     threw = False
    89     try:
    90         parser.parse("""
    91           [Global]
    92           interface Foo : Bar {
    93           };
    94           [OverrideBuiltins]
    95           interface Bar {
    96           };
    97         """)
    98         results = parser.finish()
    99     except:
   100         threw = True
   102     harness.ok(threw,
   103                "Should have thrown for [Global] used on an interface with an "
   104                "[OverrideBuiltins] ancestor")
   106     parser = parser.reset()
   107     threw = False
   108     try:
   109         parser.parse("""
   110           [Global]
   111           interface Foo {
   112           };
   113           interface Bar : Foo {
   114           };
   115         """)
   116         results = parser.finish()
   117     except:
   118         threw = True
   120     harness.ok(threw,
   121                "Should have thrown for [Global] used on an interface with a "
   122                "descendant")

mercurial