1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/basic/bug703157.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +// Define a test object 1.5 +var test = {x:1,y:2}; 1.6 + 1.7 +// Put the object into dictionary mode by deleting 1.8 +// a property that was not the last one added. 1.9 +delete test.x; 1.10 + 1.11 +// Define a an accessor property with a setter that 1.12 +// itself calls Object.defineProperty 1.13 +Object.defineProperty(test, "foo", { 1.14 + get: function() { return 1; }, 1.15 + set: function(v) { 1.16 + Object.defineProperty(this, "foo", { value: v }); 1.17 + // Prints the correct object descriptor 1.18 + assertEq(this.foo, 33); 1.19 + }, 1.20 + configurable: true 1.21 +}); 1.22 + 1.23 +// Add another property, so generateOwnShape does not replace the foo property. 1.24 +test.other = 0; 1.25 + 1.26 +// This line prints 1, as expected 1.27 +assertEq(test.foo, 1); 1.28 + 1.29 +// Now set the property. This calls the setter method above. 1.30 +// And the setter method prints the expected value and property descriptor. 1.31 +test.foo = 33; 1.32 + 1.33 +// Finally read the newly set value. 1.34 +assertEq(test.foo, 33); 1.35 + 1.36 +// Check that enumeration order is correct. 1.37 +var arr = []; 1.38 +for (var x in test) arr.push(x); 1.39 +assertEq("" + arr, "y,other");