dom/bindings/parser/tests/test_special_method_signature_mismatch.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 SpecialMethodSignatureMismatch1 {
     6               getter long long foo(long index);
     7             };
     8         """)
    10         results = parser.finish()
    11     except:
    12         threw = True
    14     harness.ok(threw, "Should have thrown.")
    16     threw = False
    17     try:
    18         parser.parse("""
    19             interface SpecialMethodSignatureMismatch2 {
    20               getter void foo(unsigned long index);
    21             };
    22         """)
    24         results = parser.finish()
    25     except:
    26         threw = True
    28     harness.ok(threw, "Should have thrown.")
    30     threw = False
    31     try:
    32         parser.parse("""
    33             interface SpecialMethodSignatureMismatch3 {
    34               getter boolean foo(unsigned long index, boolean extraArg);
    35             };
    36         """)
    38         results = parser.finish()
    39     except:
    40         threw = True
    42     harness.ok(threw, "Should have thrown.")
    44     threw = False
    45     try:
    46         parser.parse("""
    47             interface SpecialMethodSignatureMismatch4 {
    48               getter boolean foo(unsigned long... index);
    49             };
    50         """)
    52         results = parser.finish()
    53     except:
    54         threw = True
    56     harness.ok(threw, "Should have thrown.")
    58     threw = False
    59     try:
    60         parser.parse("""
    61             interface SpecialMethodSignatureMismatch5 {
    62               getter boolean foo(optional unsigned long index);
    63             };
    64         """)
    66         results = parser.finish()
    67     except:
    68         threw = True
    70     harness.ok(threw, "Should have thrown.")
    72     threw = False
    73     try:
    74         parser.parse("""
    75             interface SpecialMethodSignatureMismatch6 {
    76               getter boolean foo();
    77             };
    78         """)
    80         results = parser.finish()
    81     except:
    82         threw = True
    84     harness.ok(threw, "Should have thrown.")
    86     threw = False
    87     try:
    88         parser.parse("""
    89             interface SpecialMethodSignatureMismatch7 {
    90               deleter long long foo(long index);
    91             };
    92         """)
    94         results = parser.finish()
    95     except:
    96         threw = True
    98     harness.ok(threw, "Should have thrown.")
   100     threw = False
   101     try:
   102         parser.parse("""
   103             interface SpecialMethodSignatureMismatch9 {
   104               deleter boolean foo(unsigned long index, boolean extraArg);
   105             };
   106         """)
   108         results = parser.finish()
   109     except:
   110         threw = True
   112     harness.ok(threw, "Should have thrown.")
   114     threw = False
   115     try:
   116         parser.parse("""
   117             interface SpecialMethodSignatureMismatch10 {
   118               deleter boolean foo(unsigned long... index);
   119             };
   120         """)
   122         results = parser.finish()
   123     except:
   124         threw = True
   126     harness.ok(threw, "Should have thrown.")
   128     threw = False
   129     try:
   130         parser.parse("""
   131             interface SpecialMethodSignatureMismatch11 {
   132               deleter boolean foo(optional unsigned long index);
   133             };
   134         """)
   136         results = parser.finish()
   137     except:
   138         threw = True
   140     harness.ok(threw, "Should have thrown.")
   142     threw = False
   143     try:
   144         parser.parse("""
   145             interface SpecialMethodSignatureMismatch12 {
   146               deleter boolean foo();
   147             };
   148         """)
   150         results = parser.finish()
   151     except:
   152         threw = True
   154     harness.ok(threw, "Should have thrown.")
   156     threw = False
   157     try:
   158         parser.parse("""
   159             interface SpecialMethodSignatureMismatch13 {
   160               setter long long foo(long index, long long value);
   161             };
   162         """)
   164         results = parser.finish()
   165     except:
   166         threw = True
   168     harness.ok(threw, "Should have thrown.")
   170     threw = False
   171     try:
   172         parser.parse("""
   173             interface SpecialMethodSignatureMismatch15 {
   174               setter boolean foo(unsigned long index, boolean value, long long extraArg);
   175             };
   176         """)
   178         results = parser.finish()
   179     except:
   180         threw = True
   182     harness.ok(threw, "Should have thrown.")
   184     threw = False
   185     try:
   186         parser.parse("""
   187             interface SpecialMethodSignatureMismatch16 {
   188               setter boolean foo(unsigned long index, boolean... value);
   189             };
   190         """)
   192         results = parser.finish()
   193     except:
   194         threw = True
   196     harness.ok(threw, "Should have thrown.")
   198     threw = False
   199     try:
   200         parser.parse("""
   201             interface SpecialMethodSignatureMismatch17 {
   202               setter boolean foo(unsigned long index, optional boolean value);
   203             };
   204         """)
   206         results = parser.finish()
   207     except:
   208         threw = True
   210     harness.ok(threw, "Should have thrown.")
   212     threw = False
   213     try:
   214         parser.parse("""
   215             interface SpecialMethodSignatureMismatch18 {
   216               setter boolean foo();
   217             };
   218         """)
   220         results = parser.finish()
   221     except:
   222         threw = True
   224     harness.ok(threw, "Should have thrown.")
   226     threw = False
   227     try:
   228         parser.parse("""
   229             interface SpecialMethodSignatureMismatch20 {
   230               creator long long foo(long index, long long value);
   231             };
   232         """)
   234         results = parser.finish()
   235     except:
   236         threw = True
   238     harness.ok(threw, "Should have thrown.")
   240     threw = False
   241     try:
   242         parser.parse("""
   243             interface SpecialMethodSignatureMismatch22 {
   244               creator boolean foo(unsigned long index, boolean value, long long extraArg);
   245             };
   246         """)
   248         results = parser.finish()
   249     except:
   250         threw = True
   252     harness.ok(threw, "Should have thrown.")
   254     threw = False
   255     try:
   256         parser.parse("""
   257             interface SpecialMethodSignatureMismatch23 {
   258               creator boolean foo(unsigned long index, boolean... value);
   259             };
   260         """)
   262         results = parser.finish()
   263     except:
   264         threw = True
   266     harness.ok(threw, "Should have thrown.")
   268     threw = False
   269     try:
   270         parser.parse("""
   271             interface SpecialMethodSignatureMismatch24 {
   272               creator boolean foo(unsigned long index, optional boolean value);
   273             };
   274         """)
   276         results = parser.finish()
   277     except:
   278         threw = True
   280     harness.ok(threw, "Should have thrown.")
   282     threw = False
   283     try:
   284         parser.parse("""
   285             interface SpecialMethodSignatureMismatch25 {
   286               creator boolean foo();
   287             };
   288         """)
   290         results = parser.finish()
   291     except:
   292         threw = True
   294     harness.ok(threw, "Should have thrown.")

mercurial