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

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: move bit test for MIPS/MIPS64 ports, too 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 | « src/x64/builtins-x64.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 assertThrows(() => {
103 Function.prototype.call.apply(proxy, [null]);
104 }, TypeError);
105 assertThrows(() => {
106 Function.prototype.apply.apply(proxy, [null, []]);
107 }, TypeError);
108
109 var proxy_to_proxy = new Proxy(proxy, { apply() { assertUnreachable(); } });
110 assertThrows(() => { proxy_to_proxy(); }, TypeError);
111 assertThrows(() => { ({ proxy_to_proxy }).proxy_to_proxy(); }, TypeError);
112 assertThrows(() => { Reflect.apply(proxy_to_proxy, null, []); }, TypeError);
113 assertThrows(() => { Reflect.apply(proxy_to_proxy, { proxy }, []); },
114 TypeError);
115 assertThrows(() => {
116 Function.prototype.call.apply(proxy_to_proxy, [null]);
117 }, TypeError);
118 assertThrows(() => {
119 Function.prototype.apply.apply(proxy_to_proxy, [null, []]);
120 }, TypeError);
121 });
122 })();
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698