8.12.5-3-b_1.js (1005B)
1 // Copyright (c) 2012 Ecma International. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 es5id: 8.12.5-3-b_1 6 description: > 7 Changing the value of a data property should not affect it's 8 non-value property descriptor attributes. 9 ---*/ 10 11 var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); 12 var newDesc; 13 14 Array.prototype.reduce = function () {;}; 15 newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); 16 var descArray = [origDesc, newDesc]; 17 18 for (var j in descArray) { //Ensure no attributes are magically added to newDesc 19 for (var i in descArray[j]) { 20 if (i==="value") { 21 assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]'); 22 } 23 else { 24 assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]'); 25 } 26 } 27 } 28 29 reportCompare(0, 0);