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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * Date: 24 September 2001
8 *
9 * SUMMARY: Try assigning arr.length = new Number(n)
10 * From correspondence with Igor Bukanov <igor@icesoft.no>
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=101488
12 *
13 * Without the "new" keyword, assigning arr.length = Number(n) worked.
14 * But with it, Rhino was giving an error "Inappropriate array length"
15 * and SpiderMonkey was exiting without giving any error or return value -
16 *
17 * Comments on the Rhino code by igor@icesoft.no:
18 *
19 * jsSet_length requires that the new length value should be an instance
20 * of Number. But according to Ecma 15.4.5.1, item 12-13, an error should
21 * be thrown only if ToUint32(length_value) != ToNumber(length_value)
22 */
23 //-----------------------------------------------------------------------------
24 var UBound = 0;
25 var BUGNUMBER = 101488;
26 var summary = 'Try assigning arr.length = new Number(n)';
27 var status = '';
28 var statusitems = [];
29 var actual = '';
30 var actualvalues = [];
31 var expect= '';
32 var expectedvalues = [];
33 var arr = [];
36 status = inSection(1);
37 arr = Array();
38 tryThis('arr.length = new Number(1);');
39 actual = arr.length;
40 expect = 1;
41 addThis();
43 status = inSection(2);
44 arr = Array(5);
45 tryThis('arr.length = new Number(1);');
46 actual = arr.length;
47 expect = 1;
48 addThis();
50 status = inSection(3);
51 arr = Array();
52 tryThis('arr.length = new Number(17);');
53 actual = arr.length;
54 expect = 17;
55 addThis();
57 status = inSection(4);
58 arr = Array(5);
59 tryThis('arr.length = new Number(17);');
60 actual = arr.length;
61 expect = 17;
62 addThis();
65 /*
66 * Also try the above with the "new" keyword before Array().
67 * Array() and new Array() should be equivalent, by ECMA 15.4.1.1
68 */
69 status = inSection(5);
70 arr = new Array();
71 tryThis('arr.length = new Number(1);');
72 actual = arr.length;
73 expect = 1;
74 addThis();
76 status = inSection(6);
77 arr = new Array(5);
78 tryThis('arr.length = new Number(1);');
79 actual = arr.length;
80 expect = 1;
81 addThis();
83 arr = new Array();
84 tryThis('arr.length = new Number(17);');
85 actual = arr.length;
86 expect = 17;
87 addThis();
89 status = inSection(7);
90 arr = new Array(5);
91 tryThis('arr.length = new Number(17);');
92 actual = arr.length;
93 expect = 17;
94 addThis();
98 //-----------------------------------------------------------------------------
99 test();
100 //-----------------------------------------------------------------------------
104 function tryThis(s)
105 {
106 try
107 {
108 eval(s);
109 }
110 catch(e)
111 {
112 // keep going
113 }
114 }
117 function addThis()
118 {
119 statusitems[UBound] = status;
120 actualvalues[UBound] = actual;
121 expectedvalues[UBound] = expect;
122 UBound++;
123 }
126 function test()
127 {
128 enterFunc ('test');
129 printBugNumber(BUGNUMBER);
130 printStatus (summary);
132 for (var i=0; i<UBound; i++)
133 {
134 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
135 }
137 exitFunc ('test');
138 }