Whitelist WeakSet

Tom Van Cutsem tomvc.be at gmail.com
Wed Sep 26 11:46:04 PDT 2012

2012/9/25 David Bruant <bruant.d at gmail.com>

> In this last paragraph, I've demonstrated a way for the whitelist to be
> a proxy to a weakmap without ever needing to leak private names. It all
> rely on the internal [[has]] of weakset instances to be a private name
> known to no one. Being a private name is just for spec economy since the
> name will never be visible to any client code.

Thanks for your worked-out example. I understand where you're going, but I
still feel it introduces too much complexity for a questionable use case.
Your proposal implicitly assumes that built-in functions such as [[has]]
are represented as private names. That's not how built-in methods currently
work. Also, you mention that it's just for spec economy, but that's not
really true: if the WeakSet is a proxy and [[has]] is a private name, the
proxy's unknownPrivateName trap would need to be called.

Besides, I repeat, this isn't the first case where objects can't be
transparently proxied. Consider the following transcript (tested in Firefox
nightly 18.01a, with support for direct proxies):

var e = document.createElement("div")
var e2 = document.createElement("ul")
e.appendChild(e2) // works fine
var e3 = new Proxy(e2, {})
Exception... "Could not convert JavaScript argument arg 0 ..."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120926/78990b13/attachment-0001.html>

More information about the es-discuss mailing list