On Wed, Jun 17, 2015 at 9:31 AM, Yusuke SUZUKI <utatane....@gmail.com>
wrote:

> On Thu, Jun 18, 2015 at 1:18 AM, Mark S. Miller <erig...@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 <ing...@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
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to