d at domenic.me (2015-07-07T01:41:16.941Z)
> On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller <erights at google.com>
> wrote:
>
>> [+Allen]
>>
>> Can registered Symbols be used as keys in WeakMaps? If so, we have a
>> fatal unauthorized communications channel that we need to fix in the spec
>> asap!
It turns out the spec is fine. https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set step 5 says
> If Type(*key*) is not Object, throw a *TypeError* exception.
as I hoped and expected. The reason I was alarmed is that I got the
following behavior on v8/iojs:
```
> var w = new WeakMap();
undefined
> var r = Symbol.for('foo');
undefined
> w.set(r, true);
{}
> w.get(r)
true
```
I will file a v8 bug. Please someone, add a test for this to test262.
On Wed, Jun 17, 2015 at 9:31 AM, Yusuke SUZUKI <utatane.tea at gmail.com> wrote: > On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller <erights at google.com> > wrote: > >> [+Allen] >> >> Can registered Symbols be used as keys in WeakMaps? If so, we have a >> fatal unauthorized communications channel that we need to fix in the spec >> asap! >> >> >> > Why do registered Symbols appear? (oops, maybe I missed some context...) > User exposed WeakMap only accepts objects as a key. > On Wed, Jun 17, 2015 at 10:00 AM, Benjamin Gruenbaum <inglor at gmail.com> wrote: > Aren't WeakMap keys only objects? > > It turns out the spec is fine < https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.set> step 5 says If Type <https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-data-types-and-values> (*key*) is not Object, throw a *TypeError* exception. as I hoped and expected. The reason I was alarmed is that I got the following behavior on v8/iojs: > var w = new WeakMap(); undefined > var r = Symbol.for('foo'); undefined > w.set(r, true); {} > w.get(r) true I will file a v8 bug. Please someone, add a test for this to test262. -- Cheers, --MarkM -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150617/59aa75a6/attachment.html>