Questions on Map and Set based on SpiderMonkey implementation

David Bruant bruant.d at gmail.com
Sun Jan 22 09:52:46 PST 2012


Hi,

SpiderMonkey implementation landed today. I was looking over the commit
[1] and had a question.
There is a test:

assertEq(Object.prototype.toString.call(new Map), "[object Map]");

I can't see anything about it neither in the latest spec draft nor in
the wiki proposal. Is it how Object.prototype.toString should behave. I
assume yes, but since there is no mention somewhere, it's probably worth
discussing it.
Likewise for Set.

Also, what is the benefit of Map.prototype being a map and Set.prototype
being a set? This is the kind of things that are true for all object
types and apparently, it has bitten (Date.prototype and
WeakMap.prototype offer a communication channel for potential attackers)
more than being helpful.

David

[1] https://hg.mozilla.org/mozilla-central/rev/6a5e20a0f741


More information about the es-discuss mailing list