Index: test/mjsunit/harmony/proxies-apply.js |
diff --git a/test/mjsunit/harmony/proxies-apply.js b/test/mjsunit/harmony/proxies-apply.js |
index 4ddffe73b80e985f4f83feb2736ec6c8372f6c1c..dae362ac6173619fbb00fa916f2227506d24789e 100644 |
--- a/test/mjsunit/harmony/proxies-apply.js |
+++ b/test/mjsunit/harmony/proxies-apply.js |
@@ -87,3 +87,36 @@ |
assertTrue(called_target); |
assertTrue(called_handler); |
})(); |
+ |
+ |
+(function testCallProxyNonCallableTarget() { |
+ var values = [NaN, 1.5, 100, /RegExp/, "string", {}, [], Symbol(), |
+ new Map(), new Set(), new WeakMap(), new WeakSet()]; |
+ values.forEach(target => { |
+ target = Object(target); |
+ var proxy = new Proxy(target, { apply() { assertUnreachable(); } }); |
+ assertThrows(() => { proxy(); }, TypeError); |
+ assertThrows(() => { ({ proxy }).proxy(); }, TypeError); |
+ assertThrows(() => { Reflect.apply(proxy, null, []); }, TypeError); |
+ assertThrows(() => { Reflect.apply(proxy, { proxy }, []); }, TypeError); |
+ assertThrows(() => { |
+ Function.prototype.call.apply(proxy, [null]); |
+ }, TypeError); |
+ assertThrows(() => { |
+ Function.prototype.apply.apply(proxy, [null, []]); |
+ }, TypeError); |
+ |
+ var proxy_to_proxy = new Proxy(proxy, { apply() { assertUnreachable(); } }); |
+ assertThrows(() => { proxy_to_proxy(); }, TypeError); |
+ assertThrows(() => { ({ proxy_to_proxy }).proxy_to_proxy(); }, TypeError); |
+ assertThrows(() => { Reflect.apply(proxy_to_proxy, null, []); }, TypeError); |
+ assertThrows(() => { Reflect.apply(proxy_to_proxy, { proxy }, []); }, |
+ TypeError); |
+ assertThrows(() => { |
+ Function.prototype.call.apply(proxy_to_proxy, [null]); |
+ }, TypeError); |
+ assertThrows(() => { |
+ Function.prototype.apply.apply(proxy_to_proxy, [null, []]); |
+ }, TypeError); |
+ }); |
+})(); |