tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/defineProperty/targetdesc-undefined-target-is-not-extensible-realm.js
raw symbols SCIP| 1 | // Copyright (C) 2016 the V8 project authors. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | /*--- |
| 4 | esid: sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc |
| 5 | es6id: 9.5.6 |
| 6 | description: > |
| 7 | Throw a TypeError exception if Desc is not configurable and target is not |
| 8 | extensible, and trap result is true (honoring the realm of the current |
| 9 | execution context). |
| 10 | info: | |
| 11 | [[DefineOwnProperty]] (P, Desc) |
| 12 | |
| 13 | ... |
| 14 | 19. If targetDesc is undefined, then |
| 15 | a. If extensibleTarget is false, throw a TypeError exception. |
| 16 | ... |
| 17 | features: [cross-realm] |
| 18 | ---*/ |
| 19 | |
| 20 | var OProxy = $262.createRealm().global.Proxy; |
| 21 | var target = Object.create(null); |
| 22 | var p = new OProxy(target, { |
| 23 | defineProperty: function() { |
| 24 | return true; |
| 25 | } |
| 26 | }); |
| 27 | |
| 28 | Object.preventExtensions(target); |
| 29 | |
| 30 | assert.throws(TypeError, function() { |
| 31 | p.prop = null; |
| 32 | }); |