js/src/tests/ecma_5/Object/object-toString-01.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

michael@0 1 /*
michael@0 2 * Any copyright is dedicated to the Public Domain.
michael@0 3 * http://creativecommons.org/licenses/publicdomain/
michael@0 4 * Contributor:
michael@0 5 * Jeff Walden <jwalden+code@mit.edu>
michael@0 6 */
michael@0 7
michael@0 8 var gTestfile = 'object-toString-01.js';
michael@0 9 //-----------------------------------------------------------------------------
michael@0 10 var BUGNUMBER = 575522;
michael@0 11 var summary = '({}).toString.call(null) == "[object Null]", ' +
michael@0 12 '({}).toString.call(undefined) == "[object Undefined]", ';
michael@0 13
michael@0 14 print(BUGNUMBER + ": " + summary);
michael@0 15
michael@0 16 /**************
michael@0 17 * BEGIN TEST *
michael@0 18 **************/
michael@0 19
michael@0 20 var toString = Object.prototype.toString;
michael@0 21
michael@0 22 assertEq(toString.call(null), "[object Null]");
michael@0 23 assertEq(toString.call(undefined), "[object Undefined]");
michael@0 24
michael@0 25 assertEq(toString.call(true), "[object Boolean]");
michael@0 26 assertEq(toString.call(false), "[object Boolean]");
michael@0 27
michael@0 28 assertEq(toString.call(0), "[object Number]");
michael@0 29 assertEq(toString.call(-0), "[object Number]");
michael@0 30 assertEq(toString.call(1), "[object Number]");
michael@0 31 assertEq(toString.call(-1), "[object Number]");
michael@0 32 assertEq(toString.call(NaN), "[object Number]");
michael@0 33 assertEq(toString.call(Infinity), "[object Number]");
michael@0 34 assertEq(toString.call(-Infinity), "[object Number]");
michael@0 35
michael@0 36 assertEq(toString.call("foopy"), "[object String]");
michael@0 37
michael@0 38 assertEq(toString.call({}), "[object Object]");
michael@0 39
michael@0 40
michael@0 41 /******************************************************************************/
michael@0 42
michael@0 43 if (typeof reportCompare === "function")
michael@0 44 reportCompare(true, true);
michael@0 45
michael@0 46 print("All tests passed!");

mercurial