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/. */
7 /**
8 File Name: 15.2.1.1.js
9 ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
10 Object(value)
11 Description: When Object is called as a function rather than as a
12 constructor, the following steps are taken:
14 1. If value is null or undefined, create and return a
15 new object with no properties other than internal
16 properties exactly as if the object constructor
17 had been called on that same value (15.2.2.1).
18 2. Return ToObject (value), whose rules are:
20 undefined generate a runtime error
21 null generate a runtime error
22 boolean create a new Boolean object whose default
23 value is the value of the boolean.
24 number Create a new Number object whose default
25 value is the value of the number.
26 string Create a new String object whose default
27 value is the value of the string.
28 object Return the input argument (no conversion).
30 Author: christine@netscape.com
31 Date: 17 july 1997
32 */
34 var SECTION = "15.2.1.1";
35 var VERSION = "ECMA_1";
36 startTest();
37 var TITLE = "Object( value )";
39 writeHeaderToLog( SECTION + " "+ TITLE);
42 var NULL_OBJECT = Object(null);
44 new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() );
45 new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) );
47 var UNDEFINED_OBJECT = Object( void 0 );
49 new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() );
50 new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) );
52 new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
53 new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
54 new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
56 new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
57 new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
58 new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
60 new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
61 new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
62 new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
64 new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
65 new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
66 new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
68 new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
69 new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
70 new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
72 new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
73 new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
74 new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
76 new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
77 new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
78 new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
80 new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
81 new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
82 new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
84 new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
85 new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
86 new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
88 new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
89 new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
90 new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
92 new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
93 new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
94 new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
96 new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
97 new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
98 new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
100 new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
101 new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
102 new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
104 new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
105 new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
106 new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
108 new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
109 new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
110 // new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
112 test();