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 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 var BUGNUMBER = 614608;
7 var summary = "String.prototype.split tests";
9 print(BUGNUMBER + ": " + summary);
11 /**************
12 * BEGIN TEST *
13 **************/
15 function assertEqArr(a1, a2) {
16 assertEq(a1.length, a2.length);
18 for(var i=0; i<a1.length; i++) {
19 assertEq(a1[i], a2[i]);
20 }
21 }
23 var order = "";
24 var o1 = { toString: function() { order += "b"; return "-"; }};
25 var o2 = { valueOf: function() { order += "a"; return 1; }};
26 var res = "xyz-xyz".split(o1, o2);
28 assertEq(order, "ab");
29 assertEqArr(res, ["xyz"]);
31 assertEqArr("".split(/.?/), []);
32 assertEqArr("abc".split(/\b/), ["abc"]);
34 assertEqArr("abc".split(/((()))./, 2), ["",""]);
35 assertEqArr("abc".split(/((((()))))./, 9), ["","","","","","","","",""]);
37 // from ES5 15.5.4.14
38 assertEqArr("ab".split(/a*?/), ["a", "b"]);
39 assertEqArr("ab".split(/a*/), ["", "b"]);
40 assertEqArr("A<B>bold</B>and<CODE>coded</CODE>".split(/<(\/)?([^<>]+)>/),
41 ["A", undefined, "B", "bold", "/", "B", "and", undefined,
42 "CODE", "coded", "/", "CODE", ""]);
44 if (typeof reportCompare === "function")
45 reportCompare(true, true);
47 print("All tests passed!");