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 // |reftest| skip -- obsolete test
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 //-----------------------------------------------------------------------------
9 var UBound = 0;
10 var BUGNUMBER = 99663;
11 var summary = 'Regression test for Bugzilla bug 99663';
12 /*
13 * This testcase expects error messages containing
14 * the phrase 'read-only' or something similar -
15 */
16 var READONLY = /read\s*-?\s*only/;
17 var READONLY_TRUE = 'a "read-only" error';
18 var READONLY_FALSE = 'Error: ';
19 var FAILURE = 'NO ERROR WAS GENERATED!';
20 var status = '';
21 var actual = '';
22 var expect= '';
23 var statusitems = [];
24 var expectedvalues = [];
25 var actualvalues = [];
28 /*
29 * These MUST be compiled in JS1.2 or less for the test to work - see above
30 */
31 function f1()
32 {
33 with (it)
34 {
35 for (rdonly in this);
36 }
37 }
40 function f2()
41 {
42 for (it.rdonly in this);
43 }
46 function f3(s)
47 {
48 for (it[s] in this);
49 }
53 /*
54 * Begin testing by capturing actual vs. expected values.
55 * Initialize to FAILURE; this will get reset if all goes well -
56 */
57 actual = FAILURE;
58 try
59 {
60 f1();
61 }
62 catch(e)
63 {
64 actual = readOnly(e.message);
65 }
66 expect= READONLY_TRUE;
67 status = 'Section 1 of test - got ' + actual;
68 addThis();
71 actual = FAILURE;
72 try
73 {
74 f2();
75 }
76 catch(e)
77 {
78 actual = readOnly(e.message);
79 }
80 expect= READONLY_TRUE;
81 status = 'Section 2 of test - got ' + actual;
82 addThis();
85 actual = FAILURE;
86 try
87 {
88 f3('rdonly');
89 }
90 catch(e)
91 {
92 actual = readOnly(e.message);
93 }
94 expect= READONLY_TRUE;
95 status = 'Section 3 of test - got ' + actual;
96 addThis();
100 //-----------------------------------------------------------------------------
101 test();
102 //-----------------------------------------------------------------------------
106 function readOnly(msg)
107 {
108 if (msg.match(READONLY))
109 return READONLY_TRUE;
110 return READONLY_FALSE + msg;
111 }
114 function addThis()
115 {
116 statusitems[UBound] = status;
117 actualvalues[UBound] = actual;
118 expectedvalues[UBound] = expect;
119 UBound++;
120 }
123 function test()
124 {
125 print ('Bug Number ' + bug);
126 print ('STATUS: ' + summary);
128 for (var i=0; i<UBound; i++)
129 {
130 writeTestCaseResult(expectedvalues[i], actualvalues[i], statusitems[i]);
131 }
132 }