js/src/tests/test262/ch08/8.7/S8.7_A1.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * Multiple Variables should Referring to a Single Object
     6  *
     7  * @path ch08/8.7/S8.7_A1.js
     8  * @description Create object and refers to the other object, modify a property in the original object.
     9  *  We now see that that change is represented in both variables
    10  */
    12 //////////////////////////////////////////////////////////////////////////////
    13 //CHECK#
    14 // Set obj to an empty object
    15 //
    16 var obj = new Object();
    17 // objRef now refers to the other object
    18 //
    19 var objRef = obj;
    20 // Modify a property in the original object
    21 objRef.oneProperty = -1;
    22 obj.oneProperty = true;
    23 // We now see that that change is represented in both variables
    24 // (Since they both refer to the same object)
    25 if(objRef.oneProperty !== true){
    26   $ERROR('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty));
    27 };
    28 //
    29 //////////////////////////////////////////////////////////////////////////////

mercurial