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

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

Issue 1752133004: [proxies] throw TypeError in [[Call]] if is_callable Map bit is unset (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« src/runtime/runtime-proxy.cc ('K') | « src/runtime/runtime-proxy.cc ('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 --harmony-reflect 5 // Flags: --harmony-proxies --harmony-reflect
6 6
7 (function testNonCallable() { 7 (function testNonCallable() {
8 var proxy = new Proxy({},{}); 8 var proxy = new Proxy({},{});
9 assertThrows(function(){ proxy() }, TypeError); 9 assertThrows(function(){ proxy() }, TypeError);
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 called_handler = true; 80 called_handler = true;
81 } 81 }
82 } 82 }
83 var proxy = new Proxy(target, handler); 83 var proxy = new Proxy(target, handler);
84 assertFalse(called_target); 84 assertFalse(called_target);
85 assertFalse(called_handler); 85 assertFalse(called_handler);
86 Reflect.apply(proxy, {rec:1}, [1,2]); 86 Reflect.apply(proxy, {rec:1}, [1,2]);
87 assertTrue(called_target); 87 assertTrue(called_target);
88 assertTrue(called_handler); 88 assertTrue(called_handler);
89 })(); 89 })();
90
91
92 (function testCallProxyNonCallableTarget() {
93 var values = [NaN, 1.5, 100, /RegExp/, "string", {}, [], Symbol(),
94 new Map(), new Set(), new WeakMap(), new WeakSet()];
95 values.forEach(target => {
96 target = Object(target);
97 var proxy = new Proxy(target, { apply() { assertUnreachable(); } });
98 assertThrows(() => { proxy(); }, TypeError);
99 assertThrows(() => { ({ proxy }).proxy(); }, TypeError);
100 assertThrows(() => { Reflect.apply(proxy, null, []); }, TypeError);
101 assertThrows(() => { Reflect.apply(proxy, { proxy }, []); }, TypeError);
102
103 var proxy_to_proxy = new Proxy(proxy, { apply() { assertUnreachable(); } });
104 assertThrows(() => { proxy_to_proxy(); }, TypeError);
105 assertThrows(() => { ({ proxy_to_proxy }).proxy_to_proxy(); }, TypeError);
106 assertThrows(() => { Reflect.apply(proxy_to_proxy, null, []); }, TypeError);
107 assertThrows(() => { Reflect.apply(proxy_to_proxy, { proxy }, []); },
108 TypeError);
109 });
110 })();
Camillo Bruni 2016/03/02 17:41:03 silly that we forgot this case :)
OLDNEW
« src/runtime/runtime-proxy.cc ('K') | « src/runtime/runtime-proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698