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

Side by Side Diff: test/mjsunit/strong/load-proxy.js

Issue 1417063011: [runtime] support new Proxy() instead of Proxy.create and install getPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removing unreachable code Created 5 years, 1 month 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/regress/regress-crbug-506956.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
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 --strong-mode 5 // Flags: --harmony-proxies --strong-mode
6 6
7 // Forwarding proxies adapted from proposal definition 7 // Forwarding proxies adapted from proposal definition
8 function handlerMaker1(obj) { 8 function handlerMaker1(obj) {
9 return { 9 return {
10 getPropertyDescriptor: function(name) { 10 getPropertyDescriptor: function(name) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 result[name] = Object.getOwnPropertyDescriptor(obj, name); 43 result[name] = Object.getOwnPropertyDescriptor(obj, name);
44 }); 44 });
45 return result; 45 return result;
46 } 46 }
47 // As long as obj is not frozen, the proxy won't allow itself to be fixed 47 // As long as obj is not frozen, the proxy won't allow itself to be fixed
48 return undefined; // will cause a TypeError to be thrown 48 return undefined; // will cause a TypeError to be thrown
49 } 49 }
50 }; 50 };
51 } 51 }
52 var baseObj = {}; 52 var baseObj = {};
53 var proxy1 = Proxy.create(handlerMaker1(baseObj)); 53 var proxy1 = new Proxy({}, handlerMaker1(baseObj));
54 var proxy2 = Proxy.create(handlerMaker2(baseObj)); 54 var proxy2 = new Proxy({}, handlerMaker2(baseObj));
55 var childObj1 = { __proto__: proxy1 }; 55 var childObj1 = { __proto__: proxy1 };
56 var childObj2 = { __proto__: proxy2 }; 56 var childObj2 = { __proto__: proxy2 };
57 var childObjAccessor1 = { set foo(_){}, set "1"(_){}, __proto__: proxy1 }; 57 var childObjAccessor1 = { set foo(_){}, set "1"(_){}, __proto__: proxy1 };
58 var childObjAccessor2 = { set foo(_){}, set "1"(_){}, __proto__: proxy2 }; 58 var childObjAccessor2 = { set foo(_){}, set "1"(_){}, __proto__: proxy2 };
59 59
60 (function() { 60 (function() {
61 "use strong"; 61 "use strong";
62 // TODO(conradw): These asserts are sanity checking V8's proxy implementation. 62 // TODO(conradw): These asserts are sanity checking V8's proxy implementation.
63 // Strong mode semantics for ES6 proxies still need to be explored. 63 // Strong mode semantics for ES6 proxies still need to be explored.
64 assertDoesNotThrow(function(){proxy1.foo}); 64 assertDoesNotThrow(function(){proxy1.foo});
(...skipping 26 matching lines...) Expand all
91 // assertThrows(function(){childObjAccessor1[1]}, TypeError); 91 // assertThrows(function(){childObjAccessor1[1]}, TypeError);
92 // 92 //
93 // Object.freeze(proxy2); 93 // Object.freeze(proxy2);
94 // assertThrows(function(){proxy2.foo}, TypeError); 94 // assertThrows(function(){proxy2.foo}, TypeError);
95 // assertThrows(function(){proxy2[1]}, TypeError); 95 // assertThrows(function(){proxy2[1]}, TypeError);
96 // assertThrows(function(){childObj2.foo}, TypeError); 96 // assertThrows(function(){childObj2.foo}, TypeError);
97 // assertThrows(function(){childObj2[1]}, TypeError); 97 // assertThrows(function(){childObj2[1]}, TypeError);
98 // assertThrows(function(){childObjAccessor2.foo}, TypeError); 98 // assertThrows(function(){childObjAccessor2.foo}, TypeError);
99 // assertThrows(function(){childObjAccessor2[1]}, TypeError); 99 // assertThrows(function(){childObjAccessor2[1]}, TypeError);
100 })(); 100 })();
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-crbug-506956.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698