Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/defineProperty/targetdesc-configurable-desc-not-configurable-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 configurable and trap result is true (honoring the realm of
9 the current execution context).
10 info: |
11 [[DefineOwnProperty]] (P, Desc)
12
13 ...
14 20. Else targetDesc is not undefined,
15 b. If settingConfigFalse is true and targetDesc.[[Configurable]] is
16 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 Object.defineProperty(target, 'prop', {
30 value: 1,
31 configurable: true
32 });
33
34 assert.throws(TypeError, function() {
35 Object.defineProperty(p, 'prop', {
36 value: 1,
37 configurable: false
38 });
39 });