Closed
Bug 1180294
Opened 10 years ago
Closed 10 years ago
Map/Set/WeakMap/WeakSet should throw a TypeError when called without a new target
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 1083752
People
(Reporter: leonardo.balter, Unassigned)
Details
If Map/Set/WeakMap/WeakSet are called without a new target they should throw a TypeError.
Currently it's possible to call directly:
- Map()
- Set()
- WeakMap()
- ~WeakSet()~ // currently not implemented on my SpiderMonkey build (JavaScript-C42.0a1)
They need to have a new target when called in order to not throw a TypeError:
- new Map()
- new Set()
- ...
Refs:
- 23.1.1.1 item 1
- 23.2.1.1 item 1
- 23.3.1.1 item 1
- 23.4.1.1 item 1
Comment 1•10 years ago
|
||
WeakSet() already throws.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
| Reporter | ||
Comment 2•10 years ago
|
||
WeakSet() throws only because it's not even a function yet.
It should throw (when it's implemented) because a new target is not defined.
Current error: `TypeError: WeakSet is not a function`
The other bug didn't have any reference to Map, WeakMap and WeakSet. I added a comment there to not let the issue persist on the other collections Objects.
Comment 3•10 years ago
|
||
Thanks for reporting. I changed the bug summary of the other bug before duping though. You might be confused by the weird error message for WeakSet(). new WeakSet already works.
| Reporter | ||
Comment 4•10 years ago
|
||
> new WeakSet already works.
oops, that was my bad. It works for sure.
I didn't notice the change on the bug summary before. Thanks!
Comment 5•10 years ago
|
||
No worries. Thanks again for helping out.
You need to log in
before you can comment on or make changes to this bug.
Description
•