diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-extensible.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-extensible.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-extensible.js b/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-extensible.js new file mode 100644 index 0000000000..f0bb8212c7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/prototype/__proto__/set-non-extensible.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.prototype.__proto__ +es6id: B.2.2.1 +description: Called on an non-extensible object +info: | + [...] + 4. Let status be ? O.[[SetPrototypeOf]](proto). + 5. If status is false, throw a TypeError exception. + + 9.1.2.1 OrdinarySetPrototypeOf + + [...] + 2. Let extensible be the value of the [[Extensible]] internal slot of O. + 3. Let current be the value of the [[Prototype]] internal slot of O. + 4. If SameValue(V, current) is true, return true. + 5. If extensible is false, return false. +features: [__proto__] +---*/ + +var proto = {}; +var subject = Object.create(proto); + +Object.preventExtensions(subject); + +subject.__proto__ = proto; + +assert.throws(TypeError, function() { + subject.__proto__ = {}; +}); + +assert.sameValue(Object.getPrototypeOf(subject), proto); + +reportCompare(0, 0); |