Sat, 03 Jan 2015 20:18:00 +0100
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 | import WebIDL |
michael@0 | 2 | |
michael@0 | 3 | def WebIDLTest(parser, harness): |
michael@0 | 4 | parser.parse(""" |
michael@0 | 5 | interface TestConsts { |
michael@0 | 6 | const byte zero = 0; |
michael@0 | 7 | const byte b = -1; |
michael@0 | 8 | const octet o = 2; |
michael@0 | 9 | const short s = -3; |
michael@0 | 10 | const unsigned short us = 0x4; |
michael@0 | 11 | const long l = -0X5; |
michael@0 | 12 | const unsigned long ul = 6; |
michael@0 | 13 | const unsigned long long ull = 7; |
michael@0 | 14 | const long long ll = -010; |
michael@0 | 15 | const boolean t = true; |
michael@0 | 16 | const boolean f = false; |
michael@0 | 17 | const boolean? n = null; |
michael@0 | 18 | const boolean? nt = true; |
michael@0 | 19 | const boolean? nf = false; |
michael@0 | 20 | }; |
michael@0 | 21 | """) |
michael@0 | 22 | |
michael@0 | 23 | results = parser.finish() |
michael@0 | 24 | |
michael@0 | 25 | harness.ok(True, "TestConsts interface parsed without error.") |
michael@0 | 26 | harness.check(len(results), 1, "Should be one production.") |
michael@0 | 27 | iface = results[0] |
michael@0 | 28 | harness.ok(isinstance(iface, WebIDL.IDLInterface), |
michael@0 | 29 | "Should be an IDLInterface") |
michael@0 | 30 | harness.check(iface.identifier.QName(), "::TestConsts", "Interface has the right QName") |
michael@0 | 31 | harness.check(iface.identifier.name, "TestConsts", "Interface has the right name") |
michael@0 | 32 | harness.check(len(iface.members), 14, "Expect 14 members") |
michael@0 | 33 | |
michael@0 | 34 | consts = iface.members |
michael@0 | 35 | |
michael@0 | 36 | def checkConst(const, QName, name, type, value): |
michael@0 | 37 | harness.ok(isinstance(const, WebIDL.IDLConst), |
michael@0 | 38 | "Should be an IDLConst") |
michael@0 | 39 | harness.ok(const.isConst(), "Const is a const") |
michael@0 | 40 | harness.ok(not const.isAttr(), "Const is not an attr") |
michael@0 | 41 | harness.ok(not const.isMethod(), "Const is not a method") |
michael@0 | 42 | harness.check(const.identifier.QName(), QName, "Const has the right QName") |
michael@0 | 43 | harness.check(const.identifier.name, name, "Const has the right name") |
michael@0 | 44 | harness.check(str(const.type), type, "Const has the right type") |
michael@0 | 45 | harness.ok(const.type.isPrimitive(), "All consts should be primitive") |
michael@0 | 46 | harness.check(str(const.value.type), str(const.type), |
michael@0 | 47 | "Const's value has the same type as the type") |
michael@0 | 48 | harness.check(const.value.value, value, "Const value has the right value.") |
michael@0 | 49 | |
michael@0 | 50 | checkConst(consts[0], "::TestConsts::zero", "zero", "Byte", 0) |
michael@0 | 51 | checkConst(consts[1], "::TestConsts::b", "b", "Byte", -1) |
michael@0 | 52 | checkConst(consts[2], "::TestConsts::o", "o", "Octet", 2) |
michael@0 | 53 | checkConst(consts[3], "::TestConsts::s", "s", "Short", -3) |
michael@0 | 54 | checkConst(consts[4], "::TestConsts::us", "us", "UnsignedShort", 4) |
michael@0 | 55 | checkConst(consts[5], "::TestConsts::l", "l", "Long", -5) |
michael@0 | 56 | checkConst(consts[6], "::TestConsts::ul", "ul", "UnsignedLong", 6) |
michael@0 | 57 | checkConst(consts[7], "::TestConsts::ull", "ull", "UnsignedLongLong", 7) |
michael@0 | 58 | checkConst(consts[8], "::TestConsts::ll", "ll", "LongLong", -8) |
michael@0 | 59 | checkConst(consts[9], "::TestConsts::t", "t", "Boolean", True) |
michael@0 | 60 | checkConst(consts[10], "::TestConsts::f", "f", "Boolean", False) |
michael@0 | 61 | checkConst(consts[11], "::TestConsts::n", "n", "BooleanOrNull", None) |
michael@0 | 62 | checkConst(consts[12], "::TestConsts::nt", "nt", "BooleanOrNull", True) |
michael@0 | 63 | checkConst(consts[13], "::TestConsts::nf", "nf", "BooleanOrNull", False) |
michael@0 | 64 |