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 var BUGNUMBER = 918879;
2 var summary = 'String.prototype.codePointAt';
4 print(BUGNUMBER + ": " + summary);
6 // Tests taken from:
7 // https://github.com/mathiasbynens/String.prototype.codePointAt/blob/master/tests/tests.js
8 assertEq(String.prototype.codePointAt.length, 1);
9 assertEq(String.prototype.propertyIsEnumerable('codePointAt'), false);
11 // String that starts with a BMP symbol
12 assertEq('abc\uD834\uDF06def'.codePointAt(''), 0x61);
13 assertEq('abc\uD834\uDF06def'.codePointAt('_'), 0x61);
14 assertEq('abc\uD834\uDF06def'.codePointAt(), 0x61);
15 assertEq('abc\uD834\uDF06def'.codePointAt(-Infinity), undefined);
16 assertEq('abc\uD834\uDF06def'.codePointAt(-1), undefined);
17 assertEq('abc\uD834\uDF06def'.codePointAt(-0), 0x61);
18 assertEq('abc\uD834\uDF06def'.codePointAt(0), 0x61);
19 assertEq('abc\uD834\uDF06def'.codePointAt(3), 0x1D306);
20 assertEq('abc\uD834\uDF06def'.codePointAt(4), 0xDF06);
21 assertEq('abc\uD834\uDF06def'.codePointAt(5), 0x64);
22 assertEq('abc\uD834\uDF06def'.codePointAt(42), undefined);
23 assertEq('abc\uD834\uDF06def'.codePointAt(Infinity), undefined);
24 assertEq('abc\uD834\uDF06def'.codePointAt(Infinity), undefined);
25 assertEq('abc\uD834\uDF06def'.codePointAt(NaN), 0x61);
26 assertEq('abc\uD834\uDF06def'.codePointAt(false), 0x61);
27 assertEq('abc\uD834\uDF06def'.codePointAt(null), 0x61);
28 assertEq('abc\uD834\uDF06def'.codePointAt(undefined), 0x61);
30 // String that starts with an astral symbol
31 assertEq('\uD834\uDF06def'.codePointAt(''), 0x1D306);
32 assertEq('\uD834\uDF06def'.codePointAt('1'), 0xDF06);
33 assertEq('\uD834\uDF06def'.codePointAt('_'), 0x1D306);
34 assertEq('\uD834\uDF06def'.codePointAt(), 0x1D306);
35 assertEq('\uD834\uDF06def'.codePointAt(-1), undefined);
36 assertEq('\uD834\uDF06def'.codePointAt(-0), 0x1D306);
37 assertEq('\uD834\uDF06def'.codePointAt(0), 0x1D306);
38 assertEq('\uD834\uDF06def'.codePointAt(1), 0xDF06);
39 assertEq('\uD834\uDF06def'.codePointAt(42), undefined);
40 assertEq('\uD834\uDF06def'.codePointAt(false), 0x1D306);
41 assertEq('\uD834\uDF06def'.codePointAt(null), 0x1D306);
42 assertEq('\uD834\uDF06def'.codePointAt(undefined), 0x1D306);
44 // Lone high surrogates
45 assertEq('\uD834abc'.codePointAt(''), 0xD834);
46 assertEq('\uD834abc'.codePointAt('_'), 0xD834);
47 assertEq('\uD834abc'.codePointAt(), 0xD834);
48 assertEq('\uD834abc'.codePointAt(-1), undefined);
49 assertEq('\uD834abc'.codePointAt(-0), 0xD834);
50 assertEq('\uD834abc'.codePointAt(0), 0xD834);
51 assertEq('\uD834abc'.codePointAt(false), 0xD834);
52 assertEq('\uD834abc'.codePointAt(NaN), 0xD834);
53 assertEq('\uD834abc'.codePointAt(null), 0xD834);
54 assertEq('\uD834abc'.codePointAt(undefined), 0xD834);
56 // Lone low surrogates
57 assertEq('\uDF06abc'.codePointAt(''), 0xDF06);
58 assertEq('\uDF06abc'.codePointAt('_'), 0xDF06);
59 assertEq('\uDF06abc'.codePointAt(), 0xDF06);
60 assertEq('\uDF06abc'.codePointAt(-1), undefined);
61 assertEq('\uDF06abc'.codePointAt(-0), 0xDF06);
62 assertEq('\uDF06abc'.codePointAt(0), 0xDF06);
63 assertEq('\uDF06abc'.codePointAt(false), 0xDF06);
64 assertEq('\uDF06abc'.codePointAt(NaN), 0xDF06);
65 assertEq('\uDF06abc'.codePointAt(null), 0xDF06);
66 assertEq('\uDF06abc'.codePointAt(undefined), 0xDF06);
68 (function() { String.prototype.codePointAt.call(undefined); }, TypeError);
69 assertThrowsInstanceOf(function() { String.prototype.codePointAt.call(undefined, 4); }, TypeError);
70 assertThrowsInstanceOf(function() { String.prototype.codePointAt.call(null); }, TypeError);
71 assertThrowsInstanceOf(function() { String.prototype.codePointAt.call(null, 4); }, TypeError);
72 assertEq(String.prototype.codePointAt.call(42, 0), 0x34);
73 assertEq(String.prototype.codePointAt.call(42, 1), 0x32);
74 assertEq(String.prototype.codePointAt.call({ 'toString': function() { return 'abc'; } }, 2), 0x63);
76 assertThrowsInstanceOf(function() { String.prototype.codePointAt.apply(undefined); }, TypeError);
77 assertThrowsInstanceOf(function() { String.prototype.codePointAt.apply(undefined, [4]); }, TypeError);
78 assertThrowsInstanceOf(function() { String.prototype.codePointAt.apply(null); }, TypeError);
79 assertThrowsInstanceOf(function() { String.prototype.codePointAt.apply(null, [4]); }, TypeError);
80 assertEq(String.prototype.codePointAt.apply(42, [0]), 0x34);
81 assertEq(String.prototype.codePointAt.apply(42, [1]), 0x32);
82 assertEq(String.prototype.codePointAt.apply({ 'toString': function() { return 'abc'; } }, [2]), 0x63);
84 reportCompare(0, 0, "ok");