Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/defineProperty/targetdesc-undefined-target-is-not-extensible-realm.js

raw
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 description: >
6 Throw a TypeError exception if Desc is not configurable and target is not
7 extensible, and trap result is true (honoring the realm of the current
8 execution context).
9 info: |
10 [[DefineOwnProperty]] (P, Desc)
11
12 ...
13 19. If targetDesc is undefined, then
14 a. If extensibleTarget is false, throw a TypeError exception.
15 ...
16 features: [cross-realm, Proxy]
17 ---*/
18
19 var OProxy = $262.createRealm().global.Proxy;
20 var target = Object.create(null);
21 var p = new OProxy(target, {
22 defineProperty: function() {
23 return true;
24 }
25 });
26
27 Object.preventExtensions(target);
28
29 assert.throws(TypeError, function() {
30 p.prop = null;
31 });
32
33 reportCompare(0, 0);