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 TestArrayBuffer {
6 attribute ArrayBuffer bufferAttr;
7 void bufferMethod(ArrayBuffer arg1, ArrayBuffer? arg2, ArrayBuffer[] arg3, sequence<ArrayBuffer> arg4);
9 attribute ArrayBufferView viewAttr;
10 void viewMethod(ArrayBufferView arg1, ArrayBufferView? arg2, ArrayBufferView[] arg3, sequence<ArrayBufferView> arg4);
12 attribute Int8Array int8ArrayAttr;
13 void int8ArrayMethod(Int8Array arg1, Int8Array? arg2, Int8Array[] arg3, sequence<Int8Array> arg4);
15 attribute Uint8Array uint8ArrayAttr;
16 void uint8ArrayMethod(Uint8Array arg1, Uint8Array? arg2, Uint8Array[] arg3, sequence<Uint8Array> arg4);
18 attribute Uint8ClampedArray uint8ClampedArrayAttr;
19 void uint8ClampedArrayMethod(Uint8ClampedArray arg1, Uint8ClampedArray? arg2, Uint8ClampedArray[] arg3, sequence<Uint8ClampedArray> arg4);
21 attribute Int16Array int16ArrayAttr;
22 void int16ArrayMethod(Int16Array arg1, Int16Array? arg2, Int16Array[] arg3, sequence<Int16Array> arg4);
24 attribute Uint16Array uint16ArrayAttr;
25 void uint16ArrayMethod(Uint16Array arg1, Uint16Array? arg2, Uint16Array[] arg3, sequence<Uint16Array> arg4);
27 attribute Int32Array int32ArrayAttr;
28 void int32ArrayMethod(Int32Array arg1, Int32Array? arg2, Int32Array[] arg3, sequence<Int32Array> arg4);
30 attribute Uint32Array uint32ArrayAttr;
31 void uint32ArrayMethod(Uint32Array arg1, Uint32Array? arg2, Uint32Array[] arg3, sequence<Uint32Array> arg4);
33 attribute Float32Array float32ArrayAttr;
34 void float32ArrayMethod(Float32Array arg1, Float32Array? arg2, Float32Array[] arg3, sequence<Float32Array> arg4);
36 attribute Float64Array float64ArrayAttr;
37 void float64ArrayMethod(Float64Array arg1, Float64Array? arg2, Float64Array[] arg3, sequence<Float64Array> arg4);
38 };
39 """)
41 results = parser.finish()
43 iface = results[0]
45 harness.ok(True, "TestArrayBuffer interface parsed without error")
46 harness.check(len(iface.members), 22, "Interface should have twenty two members")
48 members = iface.members
50 def checkStuff(attr, method, t):
51 harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Expect an IDLAttribute")
52 harness.ok(isinstance(method, WebIDL.IDLMethod), "Expect an IDLMethod")
54 harness.check(str(attr.type), t, "Expect an ArrayBuffer type")
55 harness.ok(attr.type.isSpiderMonkeyInterface(), "Should test as a js interface")
57 (retType, arguments) = method.signatures()[0]
58 harness.ok(retType.isVoid(), "Should have a void return type")
59 harness.check(len(arguments), 4, "Expect 4 arguments")
61 harness.check(str(arguments[0].type), t, "Expect an ArrayBuffer type")
62 harness.ok(arguments[0].type.isSpiderMonkeyInterface(), "Should test as a js interface")
64 harness.check(str(arguments[1].type), t + "OrNull", "Expect an ArrayBuffer type")
65 harness.ok(arguments[1].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
67 harness.check(str(arguments[2].type), t + "Array", "Expect an ArrayBuffer type")
68 harness.ok(arguments[2].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
70 harness.check(str(arguments[3].type), t + "Sequence", "Expect an ArrayBuffer type")
71 harness.ok(arguments[3].type.inner.isSpiderMonkeyInterface(), "Should test as a js interface")
74 checkStuff(members[0], members[1], "ArrayBuffer")
75 checkStuff(members[2], members[3], "ArrayBufferView")
76 checkStuff(members[4], members[5], "Int8Array")
77 checkStuff(members[6], members[7], "Uint8Array")
78 checkStuff(members[8], members[9], "Uint8ClampedArray")
79 checkStuff(members[10], members[11], "Int16Array")
80 checkStuff(members[12], members[13], "Uint16Array")
81 checkStuff(members[14], members[15], "Int32Array")
82 checkStuff(members[16], members[17], "Uint32Array")
83 checkStuff(members[18], members[19], "Float32Array")
84 checkStuff(members[20], members[21], "Float64Array")