OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-proxies | |
6 | |
7 // Check basic call to trap. | 5 // Check basic call to trap. |
8 | 6 |
9 var g_target, g_name, g_desc; | 7 var g_target, g_name, g_desc; |
10 var handler = { | 8 var handler = { |
11 defineProperty: function(target, name, desc) { | 9 defineProperty: function(target, name, desc) { |
12 g_target = target; | 10 g_target = target; |
13 g_name = name; | 11 g_name = name; |
14 g_desc = desc; | 12 g_desc = desc; |
15 return true; | 13 return true; |
16 } | 14 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Step 16a: Trap returns true for non-compatible property descriptor. | 73 // Step 16a: Trap returns true for non-compatible property descriptor. |
76 Object.defineProperty(target, "foo", | 74 Object.defineProperty(target, "foo", |
77 {value: 1, writable: false, configurable: false}); | 75 {value: 1, writable: false, configurable: false}); |
78 assertThrows("Object.defineProperty(proxy, 'foo', {value: 2})", TypeError); | 76 assertThrows("Object.defineProperty(proxy, 'foo', {value: 2})", TypeError); |
79 | 77 |
80 // Step 16b: Trap returns true for overwriting a configurable property | 78 // Step 16b: Trap returns true for overwriting a configurable property |
81 // with a non-configurable descriptor. | 79 // with a non-configurable descriptor. |
82 target.bar = "baz"; | 80 target.bar = "baz"; |
83 assertThrows("Object.defineProperty(proxy, 'bar', {configurable: false})", | 81 assertThrows("Object.defineProperty(proxy, 'bar', {configurable: false})", |
84 TypeError); | 82 TypeError); |
OLD | NEW |