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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
+})();
« 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