Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1350)

Side by Side Diff: test/mjsunit/harmony/proxies-keys.js

Issue 1815773002: Remove runtime flags for Proxy and Reflect (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | test/mjsunit/harmony/proxies-object-assign.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --harmony-proxies
6
7 var target = {
8 target: 1
9 };
10 target.__proto__ = {
11 target_proto: 2
12 };
13
14 var handler = {
15 ownKeys: function(target) {
16 return ["foo", "bar", Symbol("baz"), "non-enum", "not-found"];
17 },
18 getOwnPropertyDescriptor: function(target, name) {
19 if (name == "non-enum") return {configurable: true};
20 if (name == "not-found") return undefined;
21 return {enumerable: true, configurable: true};
22 }
23 }
24
25 var proxy = new Proxy(target, handler);
26
27 // Object.keys() ignores symbols and non-enumerable keys.
28 assertEquals(["foo", "bar"], Object.keys(proxy));
29
30 // Edge case: no properties left after filtering.
31 handler.getOwnPropertyDescriptor = undefined;
32 assertEquals([], Object.keys(proxy));
33
34 // Throwing shouldn't crash.
35 handler.getOwnPropertyDescriptor = function() { throw new Number(1); };
36 assertThrows("Object.keys(proxy)", Number);
37
38 // Fall through to target if there is no trap.
39 handler.ownKeys = undefined;
40 assertEquals(["target"], Object.keys(proxy));
41 assertEquals(["target"], Object.keys(target));
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/proxies-json.js ('k') | test/mjsunit/harmony/proxies-object-assign.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698