[META] Symbols as WeakMap property keys
Categories
(Core :: JavaScript Engine, enhancement, P3)
Tracking
()
People
(Reporter: yulia, Unassigned)
References
(Depends on 2 open bugs, Blocks 1 open bug, )
Details
(4 keywords, Whiteboard: [DocArea=JS])
Currently at stage 2
Reporter | ||
Updated•2 years ago
|
Updated•11 months ago
|
Comment 2•3 months ago
|
||
I have the following test code:
const map = new WeakMap();
const key = Symbol();
map.set(key, 42);
It throws error:
Uncaught
TypeError
:WeakMap
keySymbol()
must be an object or an unregistered symbol
However, it works fine on both Chrome and Safari, which means there can be compatibility issue arises from it, and the behavior here is inconsistent with this error message, which is very confusing.
(In reply to Xidorn Quan [:xidorn] UTC+11 from comment #2)
However, it works fine on both Chrome and Safari, which means there can be compatibility issue arises from it, and the behavior here is inconsistent with this error message, which is very confusing.
Have you turned on the pref "javascript.options.experimental.symbols_as_weakmap_keys" ?
It is still off by default.
Comment 4•3 months ago
|
||
(In reply to Yoshi Cheng-Hao Huang [:allstars.chh][:allstarschh][:yoshi] from comment #3)
Have you turned on the pref "javascript.options.experimental.symbols_as_weakmap_keys" ?
It is still off by default.
No. Should there be a bug tracking this pref change? Also should we have the error thrown adapt to the availability of this feature, and potentially even mention the tracking bug?
Updated•1 month ago
|
Description
•