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 File Name: toString_1.js
10 ECMA Section: Object.toString()
11 Description:
13 This checks the ToString value of Object objects under JavaScript 1.2.
15 In JavaScript 1.2, Object.toString()
17 Author: christine@netscape.com
18 Date: 12 november 1997
19 */
21 var SECTION = "JS1_2";
22 var VERSION = "JS1_2";
23 startTest();
24 var TITLE = "Object.toString()";
26 writeHeaderToLog( SECTION + " "+ TITLE);
28 var o = new Object();
30 new TestCase( SECTION,
31 "var o = new Object(); o.toString()",
32 "{}",
33 o.toString() );
35 o = {};
37 new TestCase( SECTION,
38 "o = {}; o.toString()",
39 "{}",
40 o.toString() );
42 o = { name:"object", length:0, value:"hello" }
44 new TestCase( SECTION,
45 "o = { name:\"object\", length:0, value:\"hello\" }; o.toString()",
46 true,
47 checkObjectToString(o.toString(), ['name:"object"', 'length:0',
48 'value:"hello"']));
50 o = { name:"object", length:0, value:"hello",
51 toString:new Function( "return this.value+''" ) }
53 new TestCase( SECTION,
54 "o = { name:\"object\", length:0, value:\"hello\", "+
55 "toString:new Function( \"return this.value+''\" ) }; o.toString()",
56 "hello",
57 o.toString() );
61 test();
63 /**
64 * checkObjectToString
65 *
66 * In JS1.2, Object.prototype.toString returns a representation of the
67 * object's properties as a string. However, the order of the properties
68 * in the resulting string is not specified. This function compares the
69 * resulting string with an array of strings to make sure that the
70 * resulting string is some permutation of the strings in the array.
71 */
72 function checkObjectToString(s, a) {
73 var m = /^\{(.*)\}$/(s);
74 if (!m)
75 return false; // should begin and end with curly brackets
76 var a2 = m[1].split(", ");
77 if (a.length != a2.length)
78 return false; // should be same length
79 a.sort();
80 a2.sort();
81 for (var i=0; i < a.length; i++) {
82 if (a[i] != a2[i])
83 return false; // should have identical elements
84 }
85 return true;
86 }