| var numberOfGetPrototypeOfCalls = 0; |
| var doBadThings = function() { }; |
| Bar.prototype = new Proxy( |
| numberOfGetPrototypeOfCalls++; |
| // Break some watchpoints. |
| for (var i = 0; i < 5; ++i) |
| var _ = p instanceof Foo; |
| for (var i = 0; i < 10000; ++i) { |
| var result = foo({f:42}, new Bar()); |
| throw "Error: bad result in loop: " + result; |
| if (numberOfGetPrototypeOfCalls != 10000 * 5) |
| throw "Error: did not call getPrototypeOf() the right number of times"; |
| var didCallGetter = false; |
| doBadThings = function() { |
| globalO.__defineGetter__("f", function() { |
| var result = foo(globalO, new Bar()); |
| throw "Error: bad result at end: " + result; |
| throw "Error: did not call getter"; |
| if (numberOfGetPrototypeOfCalls != 10001 * 5) |
| throw "Error: did not call getPrototypeOf() the right number of times at end"; |