dom/bindings/parser/tests/test_putForwards.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     threw = False
     3     try:
     4         parser.parse("""
     5             interface I {
     6               [PutForwards=B] readonly attribute long A;
     7             };
     8         """)
    10         results = parser.finish()
    11     except:
    12         threw = True
    14     harness.ok(threw, "Should have thrown.")
    16     parser = parser.reset();
    17     threw = False
    18     try:
    19         parser.parse("""
    20             interface I {
    21               [PutForwards=B] readonly attribute J A;
    22             };
    23             interface J {
    24             };
    25         """)
    27         results = parser.finish()
    28     except:
    29         threw = True
    31     harness.ok(threw, "Should have thrown.")
    33     parser = parser.reset();
    34     threw = False
    35     try:
    36         parser.parse("""
    37             interface I {
    38               [PutForwards=B] attribute J A;
    39             };
    40             interface J {
    41               attribute long B;
    42             };
    43         """)
    45         results = parser.finish()
    46     except:
    47         threw = True
    49     harness.ok(threw, "Should have thrown.")
    51     parser = parser.reset();
    52     threw = False
    53     try:
    54         parser.parse("""
    55             interface I {
    56               [PutForwards=B] static readonly attribute J A;
    57             };
    58             interface J {
    59               attribute long B;
    60             };
    61         """)
    63         results = parser.finish()
    64     except:
    65         threw = True
    67     harness.ok(threw, "Should have thrown.")
    69     parser = parser.reset();
    70     threw = False
    71     try:
    72         parser.parse("""
    73             callback interface I {
    74               [PutForwards=B] readonly attribute J A;
    75             };
    76             interface J {
    77               attribute long B;
    78             };
    79         """)
    81         results = parser.finish()
    82     except:
    83         threw = True
    85     harness.ok(threw, "Should have thrown.")
    87     parser = parser.reset();
    88     threw = False
    89     try:
    90         parser.parse("""
    91             interface I {
    92               [PutForwards=C] readonly attribute J A;
    93               [PutForwards=C] readonly attribute J B;
    94             };
    95             interface J {
    96               [PutForwards=D] readonly attribute K C;
    97             };
    98             interface K {
    99               [PutForwards=A] readonly attribute I D;
   100             };
   101         """)
   103         results = parser.finish()
   104     except:
   105         threw = True
   107     harness.ok(threw, "Should have thrown.")

mercurial