testDirectProxyGetInherited3.js (464B)
1 // Recursion through the get hook works; runaway recursion is checked. 2 3 load(libdir + "asserts.js"); 4 5 var hits = 0, limit = 10; 6 var proto = new Proxy({}, { 7 get(t, id, r) { 8 assertEq(r, obj); 9 if (hits++ >= limit) 10 return "ding"; 11 return obj[id]; 12 } 13 }); 14 15 var obj = Object.create(proto); 16 assertEq(obj.prop, "ding"); 17 18 hits = 0; 19 limit = Infinity; 20 assertThrowsInstanceOf(() => obj.prop, InternalError); 21 assertEq(hits > 10, true);