Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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.2.js
9 ECMA Section: 15.2.1.2 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 proerties 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.2";
35 var VERSION = "ECMA_1";
36 startTest();
37 var TITLE = "Object()";
39 writeHeaderToLog( SECTION + " "+ TITLE);
41 var MYOB = Object();
43 new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
44 new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
45 new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
47 test();