tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.2.2.1_A1_T5.js (1516B)


      1 // Copyright 2009 the Sputnik authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    When the Object constructor is called with no arguments the following steps are taken:
      7    (The argument value was not supplied or its type was Null or Undefined.)
      8    i)	Create a new native ECMAScript object.
      9    ii) 	The [[Prototype]] property of the newly constructed object is set to the Object prototype object.
     10    iii) 	The [[Class]] property of the newly constructed object is set to "Object".
     11    iv) 	The newly constructed object has no [[Value]] property.
     12    v) 	Return the newly created native object
     13 es5id: 15.2.2.1_A1_T5
     14 description: >
     15    Creating new Object(x), where x is "undefined", and checking it
     16    properties
     17 ---*/
     18 
     19 var obj = new Object(x);
     20 
     21 assert.notSameValue(obj, undefined, 'The value of obj is expected to not equal ``undefined``');
     22 assert.sameValue(obj.constructor, Object, 'The value of obj.constructor is expected to equal the value of Object');
     23 
     24 assert(
     25  !!Object.prototype.isPrototypeOf(obj),
     26  'The value of !!Object.prototype.isPrototypeOf(obj) is expected to be true'
     27 );
     28 
     29 var to_string_result = '[object ' + 'Object' + ']';
     30 assert.sameValue(obj.toString(), to_string_result, 'obj.toString() returns to_string_result');
     31 
     32 assert.sameValue(
     33  obj.valueOf().toString(),
     34  to_string_result.toString(),
     35  'obj.valueOf().toString() must return the same value returned by to_string_result.toString()'
     36 );
     37 
     38 var x;
     39 
     40 reportCompare(0, 0);