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.

michael@0 1 def WebIDLTest(parser, harness):
michael@0 2 threw = False
michael@0 3 try:
michael@0 4 parser.parse("""
michael@0 5 interface I {
michael@0 6 [PutForwards=B] readonly attribute long A;
michael@0 7 };
michael@0 8 """)
michael@0 9
michael@0 10 results = parser.finish()
michael@0 11 except:
michael@0 12 threw = True
michael@0 13
michael@0 14 harness.ok(threw, "Should have thrown.")
michael@0 15
michael@0 16 parser = parser.reset();
michael@0 17 threw = False
michael@0 18 try:
michael@0 19 parser.parse("""
michael@0 20 interface I {
michael@0 21 [PutForwards=B] readonly attribute J A;
michael@0 22 };
michael@0 23 interface J {
michael@0 24 };
michael@0 25 """)
michael@0 26
michael@0 27 results = parser.finish()
michael@0 28 except:
michael@0 29 threw = True
michael@0 30
michael@0 31 harness.ok(threw, "Should have thrown.")
michael@0 32
michael@0 33 parser = parser.reset();
michael@0 34 threw = False
michael@0 35 try:
michael@0 36 parser.parse("""
michael@0 37 interface I {
michael@0 38 [PutForwards=B] attribute J A;
michael@0 39 };
michael@0 40 interface J {
michael@0 41 attribute long B;
michael@0 42 };
michael@0 43 """)
michael@0 44
michael@0 45 results = parser.finish()
michael@0 46 except:
michael@0 47 threw = True
michael@0 48
michael@0 49 harness.ok(threw, "Should have thrown.")
michael@0 50
michael@0 51 parser = parser.reset();
michael@0 52 threw = False
michael@0 53 try:
michael@0 54 parser.parse("""
michael@0 55 interface I {
michael@0 56 [PutForwards=B] static readonly attribute J A;
michael@0 57 };
michael@0 58 interface J {
michael@0 59 attribute long B;
michael@0 60 };
michael@0 61 """)
michael@0 62
michael@0 63 results = parser.finish()
michael@0 64 except:
michael@0 65 threw = True
michael@0 66
michael@0 67 harness.ok(threw, "Should have thrown.")
michael@0 68
michael@0 69 parser = parser.reset();
michael@0 70 threw = False
michael@0 71 try:
michael@0 72 parser.parse("""
michael@0 73 callback interface I {
michael@0 74 [PutForwards=B] readonly attribute J A;
michael@0 75 };
michael@0 76 interface J {
michael@0 77 attribute long B;
michael@0 78 };
michael@0 79 """)
michael@0 80
michael@0 81 results = parser.finish()
michael@0 82 except:
michael@0 83 threw = True
michael@0 84
michael@0 85 harness.ok(threw, "Should have thrown.")
michael@0 86
michael@0 87 parser = parser.reset();
michael@0 88 threw = False
michael@0 89 try:
michael@0 90 parser.parse("""
michael@0 91 interface I {
michael@0 92 [PutForwards=C] readonly attribute J A;
michael@0 93 [PutForwards=C] readonly attribute J B;
michael@0 94 };
michael@0 95 interface J {
michael@0 96 [PutForwards=D] readonly attribute K C;
michael@0 97 };
michael@0 98 interface K {
michael@0 99 [PutForwards=A] readonly attribute I D;
michael@0 100 };
michael@0 101 """)
michael@0 102
michael@0 103 results = parser.finish()
michael@0 104 except:
michael@0 105 threw = True
michael@0 106
michael@0 107 harness.ok(threw, "Should have thrown.")

mercurial