Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/defineProperty/targetdesc-undefined-not-configurable-descriptor-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 property
7 descriptor is undefined, and trap result is true (honoring the realm of the
8 current execution context).
9 info: |
10 [[DefineOwnProperty]] (P, Desc)
11
12 ...
13 19. If targetDesc is undefined, then
14 ...
15 b. If settingConfigFalse is true, throw a TypeError exception.
16 ...
17 features: [cross-realm, Proxy]
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 assert.throws(TypeError, function() {
29 Object.defineProperty(p, 'prop', {
30 configurable: false
31 });
32 });
33
34 reportCompare(0, 0);