|
1 // Copyright 2011 Google Inc. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * @path ch08/8.6/8.6.2/S8.6.2_A8.js |
|
6 * @description It should not be possible to change the [[Prototype]] |
|
7 * of a non-extensible object |
|
8 */ |
|
9 |
|
10 var x = Object.preventExtensions({}); |
|
11 var y = {}; |
|
12 try { |
|
13 x.__proto__ = y; |
|
14 } catch (err) { |
|
15 // As far as this test is concerned, we allow the above assignment |
|
16 // to fail. This failure does violate the spec and should probably |
|
17 // be tested separately. |
|
18 } |
|
19 if (Object.getPrototypeOf(x) !== Object.prototype) { |
|
20 $ERROR("Prototype of non-extensible object mutated"); |
|
21 } |
|
22 |