1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_5/Object/proto-property-change-writability-set.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/licenses/publicdomain/ 1.7 + * Contributors: 1.8 + * Gary Kwong 1.9 + * Jeff Walden 1.10 + * Jason Orendorff 1.11 + */ 1.12 + 1.13 +//----------------------------------------------------------------------------- 1.14 +var BUGNUMBER = 713944; 1.15 +var summary = 1.16 + "Don't assert anything about a shape from the property cache until it's " + 1.17 + "known the cache entry matches"; 1.18 + 1.19 +print(BUGNUMBER + ": " + summary); 1.20 + 1.21 +/************** 1.22 + * BEGIN TEST * 1.23 + **************/ 1.24 + 1.25 +var accDesc = { set: function() {} }; 1.26 +var dataDesc = { value: 3 }; 1.27 + 1.28 +function f() 1.29 +{ 1.30 + propertyIsEnumerable = {}; 1.31 +} 1.32 +function g() 1.33 +{ 1.34 + propertyIsEnumerable = {}; 1.35 +} 1.36 + 1.37 +Object.defineProperty(Object.prototype, "propertyIsEnumerable", accDesc); 1.38 +f(); 1.39 +Object.defineProperty(Object.prototype, "propertyIsEnumerable", dataDesc); 1.40 +assertEq(propertyIsEnumerable, 3); 1.41 +f(); 1.42 +assertEq(propertyIsEnumerable, 3); 1.43 +g(); 1.44 +assertEq(propertyIsEnumerable, 3); 1.45 + 1.46 + 1.47 + 1.48 +var a = { p1: 1, p2: 2 }; 1.49 +var b = Object.create(a); 1.50 +Object.defineProperty(a, "p1", {set: function () {}}); 1.51 +for (var i = 0; i < 2; i++) 1.52 +{ 1.53 + b.p1 = {}; 1.54 + Object.defineProperty(a, "p1", {value: 3}); 1.55 +} 1.56 +assertEq(b.p1, 3); 1.57 +assertEq(a.p1, 3); 1.58 + 1.59 +reportCompare(true, true);