Catch-all proposal based on proxies
Mark S. Miller
erights at google.com
Thu Dec 10 16:44:09 PST 2009
On Thu, Dec 10, 2009 at 4:42 PM, Mark S. Miller <erights at google.com> wrote:
> On Wed, Dec 9, 2009 at 11:26 PM, Mike Samuel <mikesamuel at gmail.com> wrote:
>> On the climbing the meta, I'd like to understand how this might
>> interact with other proposals.
>> get - already can execute arbitrary code due to getters
>> set - already can execute arbitrary code due to setters
>> in - cannot for non host objects
>> delete - cannot for non host objects
>> enumerate - cannot for non host objects
> By the currently proposed taxonomy at <
> all the above are base-level operations. The list at <
> explains that all the above can cause user code to execute whereas the last
> three, as you point out, currently cannot.
>> hasOwnProperty - cannot for non host objects
>> Incidentally, is Object.prototype.hasOwnProperty(myProxy)
>> O(myProxyHandler.keys().length) for proxies? This seems bad since a
>> for (in) loop that filters out non-own properties would be O(n**2) on
>> top of the loop body.
> By the current taxonomy, Object.prototype.hasOwnProperty(myProxy) is
> meta-level and always returns false on a trapping proxy, revealing that it
> does not actually have any own properties.
> Arrg! That should be Object.prototype.hasOwnProperty.call(myProxy, name).
aProxy.hasOwnProperty(name) will of course trap as you'd expect, and so is
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss