1f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// Copyright 2010 the V8 project authors. All rights reserved. 2f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// Redistribution and use in source and binary forms, with or without 3f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// modification, are permitted provided that the following conditions are 4f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// met: 5f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// 6f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// * Redistributions of source code must retain the above copyright 7f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// notice, this list of conditions and the following disclaimer. 8f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// * Redistributions in binary form must reproduce the above 9f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// copyright notice, this list of conditions and the following 10f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// disclaimer in the documentation and/or other materials provided 11f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// with the distribution. 12f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// * Neither the name of Google Inc. nor the names of its 13f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// contributors may be used to endorse or promote products derived 14f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// from this software without specific prior written permission. 15f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// 16f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke 28f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// This regression test is used to ensure that Object.defineProperty 29f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// can't be called with an empty property descriptor on a non-configurable 30f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// existing property and override the existing property. 31f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke// See: http://code.google.com/p/v8/issues/detail?id=712 32f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke 33f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarkevar obj = {}; 34f7060e27768c550ace7ec48ad8c093466db52dfaLeon ClarkeObject.defineProperty(obj, "x", { get: function() { return "42"; }, 35f7060e27768c550ace7ec48ad8c093466db52dfaLeon Clarke configurable: false }); 36f7060e27768c550ace7ec48ad8c093466db52dfaLeon ClarkeassertEquals(obj.x, "42"); 37f7060e27768c550ace7ec48ad8c093466db52dfaLeon ClarkeObject.defineProperty(obj, 'x', {}); 38f7060e27768c550ace7ec48ad8c093466db52dfaLeon ClarkeassertEquals(obj.x, "42"); 39