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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | File Name: 15.2.1.2.js |
michael@0 | 9 | ECMA Section: 15.2.1.2 The Object Constructor Called as a Function: |
michael@0 | 10 | Object(value) |
michael@0 | 11 | Description: When Object is called as a function rather than as a |
michael@0 | 12 | constructor, the following steps are taken: |
michael@0 | 13 | |
michael@0 | 14 | 1. If value is null or undefined, create and return a |
michael@0 | 15 | new object with no proerties other than internal |
michael@0 | 16 | properties exactly as if the object constructor |
michael@0 | 17 | had been called on that same value (15.2.2.1). |
michael@0 | 18 | 2. Return ToObject (value), whose rules are: |
michael@0 | 19 | |
michael@0 | 20 | undefined generate a runtime error |
michael@0 | 21 | null generate a runtime error |
michael@0 | 22 | boolean create a new Boolean object whose default |
michael@0 | 23 | value is the value of the boolean. |
michael@0 | 24 | number Create a new Number object whose default |
michael@0 | 25 | value is the value of the number. |
michael@0 | 26 | string Create a new String object whose default |
michael@0 | 27 | value is the value of the string. |
michael@0 | 28 | object Return the input argument (no conversion). |
michael@0 | 29 | |
michael@0 | 30 | Author: christine@netscape.com |
michael@0 | 31 | Date: 17 july 1997 |
michael@0 | 32 | */ |
michael@0 | 33 | |
michael@0 | 34 | var SECTION = "15.2.1.2"; |
michael@0 | 35 | var VERSION = "ECMA_1"; |
michael@0 | 36 | startTest(); |
michael@0 | 37 | var TITLE = "Object()"; |
michael@0 | 38 | |
michael@0 | 39 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 40 | |
michael@0 | 41 | var MYOB = Object(); |
michael@0 | 42 | |
michael@0 | 43 | new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() ); |
michael@0 | 44 | new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) ); |
michael@0 | 45 | new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") ); |
michael@0 | 46 | |
michael@0 | 47 | test(); |