| throw new Error("Bad assertion"); |
| for (let i = 0; i < 1000; i++) |
| let constructors = [Error, String, RegExp, function() {}, class C {}]; |
| for (let constructor of constructors) { |
| let proxy = new Proxy(constructor, {}); |
| assert(new constructor instanceof proxy); |
| let proxy = new Proxy(function(){ called = true; }, {}); |
| assert(new proxy instanceof proxy); |
| get: function(target, prop) { |
| if (prop === "prototype") |
| let proxy = new Proxy(function(){ called = true; }, handler); |
| assert(!(new proxy instanceof proxy)); |