8.14.4-8-b_2-strict.js (547B)
1 'use strict'; 2 // Copyright (c) 2012 Ecma International. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 es5id: 8.14.4-8-b_2 7 description: Non-writable property on a prototype written to in strict mode. 8 flags: [onlyStrict] 9 ---*/ 10 11 function foo() {}; 12 Object.defineProperty(foo.prototype, "bar", {value: "unwritable"}); 13 14 var o = new foo(); 15 assert.throws(TypeError, function() { 16 o.bar = "overridden"; 17 }); 18 assert.sameValue(o.bar, "unwritable", 'o.bar'); 19 20 reportCompare(0, 0);