Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/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 ---*/
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 writable: false,
28 value: 1
29 });
30
31 assert.throws(TypeError, function() {
32 p.attr;
33 });
34
35 assert.throws(TypeError, function() {
36 p['attr'];
37 });