1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/test262/ch08/8.6/8.6.2/S8.6.2_A8.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,22 @@ 1.4 +// Copyright 2011 Google Inc. All rights reserved. 1.5 +// This code is governed by the BSD license found in the LICENSE file. 1.6 + 1.7 +/** 1.8 + * @path ch08/8.6/8.6.2/S8.6.2_A8.js 1.9 + * @description It should not be possible to change the [[Prototype]] 1.10 + * of a non-extensible object 1.11 + */ 1.12 + 1.13 +var x = Object.preventExtensions({}); 1.14 +var y = {}; 1.15 +try { 1.16 + x.__proto__ = y; 1.17 +} catch (err) { 1.18 + // As far as this test is concerned, we allow the above assignment 1.19 + // to fail. This failure does violate the spec and should probably 1.20 + // be tested separately. 1.21 +} 1.22 +if (Object.getPrototypeOf(x) !== Object.prototype) { 1.23 + $ERROR("Prototype of non-extensible object mutated"); 1.24 +} 1.25 +