15.2.3.6-4-591.js (1760B)
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-591 6 description: > 7 ES5 Attributes - Fail to update value of property of 8 [[Proptotype]] internal property (Object.create) 9 includes: [propertyHelper.js] 10 ---*/ 11 12 var appointment = {}; 13 14 var data1 = 1001; 15 Object.defineProperty(appointment, "startTime", { 16 get: function() { 17 return data1; 18 }, 19 enumerable: false, 20 configurable: false 21 }); 22 var data2 = "NAME"; 23 Object.defineProperty(appointment, "name", { 24 get: function() { 25 return data2; 26 }, 27 enumerable: false, 28 configurable: true 29 }); 30 31 var meeting = Object.create(appointment); 32 var data3 = "In-person meeting"; 33 Object.defineProperty(meeting, "conferenceCall", { 34 get: function() { 35 return data3; 36 }, 37 enumerable: false, 38 configurable: false 39 }); 40 41 var teamMeeting = Object.create(meeting); 42 43 verifyNotWritable(teamMeeting, "name", "nocheck"); 44 verifyNotWritable(teamMeeting, "startTime", "nocheck"); 45 verifyNotWritable(teamMeeting, "conferenceCall", "nocheck"); 46 47 try { 48 teamMeeting.name = "IE Team Meeting"; 49 } catch (e) { 50 assert(e instanceof TypeError); 51 } 52 53 try { 54 var dateObj = new Date("10/31/2010 08:00"); 55 teamMeeting.startTime = dateObj; 56 } catch (e) { 57 assert(e instanceof TypeError); 58 } 59 60 try { 61 teamMeeting.conferenceCall = "4255551212"; 62 } catch (e) { 63 assert(e instanceof TypeError); 64 } 65 66 67 assert(!teamMeeting.hasOwnProperty("name")); 68 assert(!teamMeeting.hasOwnProperty("startTime")); 69 assert(!teamMeeting.hasOwnProperty('conferenceCall')); 70 71 assert.sameValue(teamMeeting.name, "NAME"); 72 assert.sameValue(teamMeeting.startTime, 1001); 73 assert.sameValue(teamMeeting.conferenceCall, "In-person meeting"); 74 75 reportCompare(0, 0);