michael@0: // A proxy on the prototype chain of the global should not observe anything at michael@0: // all about lazy resolution of globals. michael@0: michael@0: var global = this; michael@0: var status = "pass"; michael@0: michael@0: // This is a little tricky. There are two proxies. michael@0: // 1. handler is a proxy that fails the test if you try to call a method on it. michael@0: var metaHandler = { michael@0: get: _ => { status = "SMASH"; }, michael@0: has: _ => { status = "SMASH"; }, michael@0: invoke: _ => { status = "SMASH"; } michael@0: }; michael@0: var handler = new Proxy({}, metaHandler); michael@0: michael@0: // 2. Then we create a proxy using 'handler' as its handler. This means the test michael@0: // will fail if *any* method of the handler is called, not just get/has/invoke. michael@0: var angryProxy = new Proxy(Object.create(null), handler); michael@0: this.__proto__ = angryProxy; michael@0: Object.prototype.__proto__ = angryProxy; michael@0: michael@0: // Trip the alarm once, to make sure the proxies are working. michael@0: this.nonExistingProperty; michael@0: assertEq(status, "SMASH"); michael@0: michael@0: // OK. Reset the status and run the actual test. michael@0: status = "pass"; michael@0: Map; michael@0: ArrayBuffer; michael@0: Date; michael@0: assertEq(status, "pass");