Debian Codegraph @

js/src/tests/test262/built-ins/Proxy/get/not-same-value-configurable-false-writable-false-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 Throws if proxy return has not the same value for a non-writable,
7 non-configurable property
8 info: |
9 [[Get]] (P, Receiver)
10
11 13. If targetDesc is not undefined, then
12 a. If IsDataDescriptor(targetDesc) and targetDesc.[[Configurable]] is
13 false and targetDesc.[[Writable]] is false, then
14 i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a
15 TypeError exception.
16 features: [Proxy]
17 ---*/
18
19 var target = {};
20 var p = new Proxy(target, {
21 get: function() {
22 return 2;
23 }
24 });
25
26 Object.defineProperty(target, 'attr', {
27 configurable: false,
28 writable: false,
29 value: 1
30 });
31
32 assert.throws(TypeError, function() {
33 p.attr;
34 });
35
36 assert.throws(TypeError, function() {
37 p['attr'];
38 });
39
40 reportCompare(0, 0);