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

Side by Side Diff: test/mjsunit/harmony/proxy/proxy-getPrototypeOf.js

Issue 1482283002: [runtime] [proxy] implementing [[Get]] trap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: position of static Created 5 years 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-get-prototype-of.js ('k') | no next file » | 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 = { target: 1 };
8 target.__proto__ = {};
9 var handler = { handler: 1 };
10 var proxy = new Proxy(target, handler);
11
12 assertSame(Object.getPrototypeOf(proxy), target.__proto__ );
13
14 target.__proto__ = [];
15 assertSame(Object.getPrototypeOf(proxy), target.__proto__);
16
17 handler.getPrototypeOf = function() {
18 return 1;
19 }
20 assertThrows(function() { Object.getPrototypeOf(proxy) }, TypeError);
21
22 var target_prototype = {a:1, b:2};
23 handler.getPrototypeOf = function() {
24 return target_prototype ;
25 }
26 assertSame(Object.getPrototypeOf(proxy), target_prototype);
27
28 // Test with proxy target:
29 var proxy2 = new Proxy(proxy, {});
30 assertSame(Object.getPrototypeOf(proxy2), target_prototype);
31
32 // Test with Proxy handler:
33 // TODO(neis,cbruni): Uncomment once the get trap works again.
34 // var proxy3_prototype = {};
35 // var handler_proxy = new Proxy({
36 // getPrototypeOf: function() { return proxy3_prototype }
37 // }, {});
38 // var proxy3 = new Proxy(target, handler_proxy);
39 // assertSame(Object.getPrototypeOf(proxy3), target_prototype);
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/proxies-get-prototype-of.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698