js/src/tests/ecma_5/Object/proto-property-change-writability-set.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:3cbc8672468e
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 * Contributors:
5 * Gary Kwong
6 * Jeff Walden
7 * Jason Orendorff
8 */
9
10 //-----------------------------------------------------------------------------
11 var BUGNUMBER = 713944;
12 var summary =
13 "Don't assert anything about a shape from the property cache until it's " +
14 "known the cache entry matches";
15
16 print(BUGNUMBER + ": " + summary);
17
18 /**************
19 * BEGIN TEST *
20 **************/
21
22 var accDesc = { set: function() {} };
23 var dataDesc = { value: 3 };
24
25 function f()
26 {
27 propertyIsEnumerable = {};
28 }
29 function g()
30 {
31 propertyIsEnumerable = {};
32 }
33
34 Object.defineProperty(Object.prototype, "propertyIsEnumerable", accDesc);
35 f();
36 Object.defineProperty(Object.prototype, "propertyIsEnumerable", dataDesc);
37 assertEq(propertyIsEnumerable, 3);
38 f();
39 assertEq(propertyIsEnumerable, 3);
40 g();
41 assertEq(propertyIsEnumerable, 3);
42
43
44
45 var a = { p1: 1, p2: 2 };
46 var b = Object.create(a);
47 Object.defineProperty(a, "p1", {set: function () {}});
48 for (var i = 0; i < 2; i++)
49 {
50 b.p1 = {};
51 Object.defineProperty(a, "p1", {value: 3});
52 }
53 assertEq(b.p1, 3);
54 assertEq(a.p1, 3);
55
56 reportCompare(true, true);

mercurial