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

Unified Diff: test/mjsunit/es6/instanceof-proxies.js

Issue 1542583003: [proxies] Limit recursive proxy prototype lookups to 100'000 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding constant and test Created 5 years 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/prototype.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/instanceof-proxies.js
diff --git a/test/mjsunit/es6/instanceof-proxies.js b/test/mjsunit/es6/instanceof-proxies.js
index 2b40873310ff0919a3ff079f145547af1eb813ec..cc720ad8fea2359e21b9a38d8863ca00c924c664 100644
--- a/test/mjsunit/es6/instanceof-proxies.js
+++ b/test/mjsunit/es6/instanceof-proxies.js
@@ -7,7 +7,7 @@
// Test instanceof with proxies.
-function TestInstanceOfWithProxies() {
+(function TestInstanceOfWithProxies() {
function foo(x) {
return x instanceof Array;
}
@@ -47,6 +47,16 @@ function TestInstanceOfWithProxies() {
assertTrue(foo_catch(o));
handler.getPrototypeOf = function(target) { return Array.prototype; }
assertFalse(foo_catch(o));
-}
+})();
-TestInstanceOfWithProxies();
+
+(function testInstanceOfWithRecursiveProxy() {
+ // Make sure we gracefully deal with recursive proxies.
+ var proxy = new Proxy({},{});
+ proxy.__proto__ = proxy;
+ // instanceof will cause an inifinite prototype walk.
+ assertThrows(() => { proxy instanceof Object }, RangeError);
+
+ var proxy2 = new Proxy({}, {getPrototypeOf() { return proxy2 }});
+ assertThrows(() => { proxy instanceof Object }, RangeError);
+})();
« no previous file with comments | « src/prototype.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698