15.2.3.6-4-571.js (669B)
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: 15.2.3.6-4-571 6 description: > 7 ES5 Attributes - [[Get]] attribute is a function which involves 8 'this' object into statement(s) 9 ---*/ 10 11 var obj = { 12 len: 2010 13 }; 14 var getFunc = function() { 15 return this; 16 }; 17 18 Object.defineProperty(obj, "prop", { 19 get: getFunc 20 }); 21 22 var desc = Object.getOwnPropertyDescriptor(obj, "prop"); 23 24 assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); 25 assert.sameValue(obj.prop, obj, 'obj.prop'); 26 assert.sameValue(desc.get, getFunc, 'desc.get'); 27 28 reportCompare(0, 0);