Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | function foo(){} |
| 6 | Object.defineProperty(foo, "prototype", { value: 2 }); |
| 7 | assertEquals(2, foo.prototype); |
| 8 | |
| 9 | function bar(){} |
| 10 | Object.defineProperty(bar, "prototype", { value: 2, writable: false }); |
| 11 | assertEquals(2, bar.prototype); |
| 12 | assertThrows(function() { "use strict"; bar.prototype = 10; }, TypeError); |
| 13 | assertEquals(false, Object.getOwnPropertyDescriptor(bar,"prototype").writable); |