Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/get/accessor-get-is-undefined-throws.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.8
5 description: >
6 [[Get]] (P, Receiver)
7
8 if trap result is not undefined, then proxy must report the same value for a
9 non-configurable accessor property with an undefined get.
10 info: |
11 13. If targetDesc is not undefined, then
12 b. If IsAccessorDescriptor(targetDesc) and targetDesc.[[Configurable]]
13 is false and targetDesc.[[Get]] is undefined, then
14 i. If trapResult is not undefined, throw a TypeError exception.
15
16 ---*/
17
18 var target = {};
19 var p = new Proxy(target, {
20 get: function() {
21 return 2;
22 }
23 });
24
25 Object.defineProperty(target, 'attr', {
26 configurable: false,
27 get: undefined
28 });
29
30 assert.throws(TypeError, function() {
31 p.attr;
32 });
33
34 assert.throws(TypeError, function() {
35 p['attr'];
36 });