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 // This file was written by Andy Wingo <wingo@igalia.com> and originally
2 // contributed to V8 as generators-objects.js, available here:
3 //
4 // http://code.google.com/p/v8/source/browse/branches/bleeding_edge/test/mjsunit/harmony/generators-objects.js
6 // Test aspects of the generator runtime.
8 // Test the properties and prototype of a generator object.
9 function TestGeneratorObject() {
10 function* g() { yield 1; }
12 var iter = g();
13 assertEq(Object.getPrototypeOf(iter), g.prototype);
14 assertTrue(iter instanceof g);
15 assertEq(String(iter), "[object Generator]");
16 assertDeepEq(Object.getOwnPropertyNames(iter), []);
17 assertNotEq(g(), iter);
19 // g() is the same as new g().
20 iter = new g();
21 assertEq(Object.getPrototypeOf(iter), g.prototype);
22 assertTrue(iter instanceof g);
23 assertEq(String(iter), "[object Generator]");
24 assertDeepEq(Object.getOwnPropertyNames(iter), []);
25 assertNotEq(new g(), iter);
26 }
27 TestGeneratorObject();
30 // Test the methods of generator objects.
31 function TestGeneratorObjectMethods() {
32 function* g() { yield 1; }
33 var iter = g();
35 function TestNonGenerator(non_generator) {
36 assertThrowsInstanceOf(function() { iter.next.call(non_generator); }, TypeError);
37 assertThrowsInstanceOf(function() { iter.next.call(non_generator, 1); }, TypeError);
38 assertThrowsInstanceOf(function() { iter.throw.call(non_generator, 1); }, TypeError);
39 assertThrowsInstanceOf(function() { iter.close.call(non_generator); }, TypeError);
40 }
42 TestNonGenerator(1);
43 TestNonGenerator({});
44 TestNonGenerator(function(){});
45 TestNonGenerator(g);
46 TestNonGenerator(g.prototype);
47 }
48 TestGeneratorObjectMethods();
51 if (typeof reportCompare == "function")
52 reportCompare(true, true);