Proxies as prototypes
Yes. That would be bugzilla.mozilla.org/show_bug.cgi?id=914314 I think.
Correct, that's a known bug. Jason and Eric (CC'd) are working on fixes to our MOP and Proxy implementation and I'd guess that this'll be fixed soon-ish. As pointed out in the bug, you can work around it by also implementing a [[Has]] handler.
Thanks David and Till!
I’ve only recently become fully aware of how much work that is, because proxies expose so much of the MOP (especially when it comes to getting and setting properties). With a proxy that logs when traps are triggered, you can see that auto-expansion in the Firefox console already triggers ownKeys
, which is nice.
I’m looking forward to Reflect
being available in Firefox: bugzilla.mozilla.org/show_bug.cgi?id=987514, bugzilla.mozilla.org/show_bug.cgi?id=987514
As you probably know, this is a polyfill: tvcutsem/harmony-reflect
I’d expect the following code to log
GET bla
, but it currently doesn’t in Firefox. That’s because the Firefox implementation of proxies isn’t finished yet, right?var proto = new Proxy({}, { get: function(target, propertyKey, receiver) { console.log('GET '+propertyKey); return target[propertyKey]; } }); var obj = Object.create(proto); obj.bla;