Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/set/target-property-is-accessor-not-configurable-set-is-undefined.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 9.5.9
5 description: >
6 [[Set]] ( P, V, Receiver)
7
8 Throws a TypeError when target property is an accessor not configurable and
9 and set is undefined.
10 info: |
11 14. If targetDesc is not undefined, then
12 b. If IsAccessorDescriptor(targetDesc) and targetDesc.[[Configurable]] is false, then
13 i. If targetDesc.[[Set]] is undefined, throw a TypeError exception.
14
15 ---*/
16
17 var target = {};
18 var handler = {
19 set: function(t, prop, value, receiver) {
20 return true;
21 }
22 };
23 var p = new Proxy(target, handler);
24
25 Object.defineProperty(target, 'attr', {
26 configurable: false,
27 set: undefined
28 });
29
30 assert.throws(TypeError, function() {
31 p.attr = 'bar';
32 });
33
34 assert.throws(TypeError, function() {
35 p['attr'] = 'bar';
36 });