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.
1 import WebIDL
3 def WebIDLTest(parser, harness):
4 parser.parse("""
5 interface TestOverloads {
6 void basic();
7 void basic(long arg1);
8 boolean abitharder(TestOverloads foo);
9 boolean abitharder(boolean foo);
10 void abitharder(ArrayBuffer? foo);
11 void withVariadics(long... numbers);
12 void withVariadics(TestOverloads iface);
13 void withVariadics(long num, TestOverloads iface);
14 void optionalTest();
15 void optionalTest(optional long num1, long num2);
16 };
17 """)
19 results = parser.finish()
21 harness.ok(True, "TestOverloads interface parsed without error.")
22 harness.check(len(results), 1, "Should be one production.")
23 iface = results[0]
24 harness.ok(isinstance(iface, WebIDL.IDLInterface),
25 "Should be an IDLInterface")
26 harness.check(iface.identifier.QName(), "::TestOverloads", "Interface has the right QName")
27 harness.check(iface.identifier.name, "TestOverloads", "Interface has the right name")
28 harness.check(len(iface.members), 4, "Expect %s members" % 4)
30 member = iface.members[0]
31 harness.check(member.identifier.QName(), "::TestOverloads::basic", "Method has the right QName")
32 harness.check(member.identifier.name, "basic", "Method has the right name")
33 harness.check(member.hasOverloads(), True, "Method has overloads")
35 signatures = member.signatures()
36 harness.check(len(signatures), 2, "Method should have 2 signatures")
38 (retval, argumentSet) = signatures[0]
40 harness.check(str(retval), "Void", "Expect a void retval")
41 harness.check(len(argumentSet), 0, "Expect an empty argument set")
43 (retval, argumentSet) = signatures[1]
44 harness.check(str(retval), "Void", "Expect a void retval")
45 harness.check(len(argumentSet), 1, "Expect an argument set with one argument")
47 argument = argumentSet[0]
48 harness.ok(isinstance(argument, WebIDL.IDLArgument),
49 "Should be an IDLArgument")
50 harness.check(argument.identifier.QName(), "::TestOverloads::basic::arg1", "Argument has the right QName")
51 harness.check(argument.identifier.name, "arg1", "Argument has the right name")
52 harness.check(str(argument.type), "Long", "Argument has the right type")
54 member = iface.members[3]
55 harness.check(len(member.overloadsForArgCount(0)), 1,
56 "Only one overload for no args")
57 harness.check(len(member.overloadsForArgCount(1)), 0,
58 "No overloads for one arg")
59 harness.check(len(member.overloadsForArgCount(2)), 1,
60 "Only one overload for two args")