Debian Codegraph @

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