Closed
Bug 1083752
Opened 10 years ago
Closed 10 years ago
Calling Map/Set/WeakMap() (without `new`) should throw
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: medikoo+mozilla.org, Assigned: evilpies)
References
Details
(Keywords: addon-compat, dev-doc-complete, site-compat)
Attachments
(1 file)
4.73 KB,
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20141016030201
Steps to reproduce:
Just run:
Set();
Actual results:
New set instance was returned
Expected results:
If understand ES6 spec correctly, it should throw with TypeError
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Calling Set() (without `new`) should throw → Calling Map/Set/WeakMap() (without `new`) should throw
Comment 3•10 years ago
|
||
The same error occurs on Map and WeakMap.
I think it's time to do this. We landed the warning for this in 38 with bug 1108930.
Attachment #8636833 -
Flags: review?(jwalden+bmo)
Comment 5•10 years ago
|
||
Comment on attachment 8636833 [details] [diff] [review]
Throw when calling Map/Set/WeakMap/
Review of attachment 8636833 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/builtin/MapObject.cpp
@@ +1237,5 @@
> MapObject::construct(JSContext* cx, unsigned argc, Value* vp)
> {
> Rooted<MapObject*> obj(cx, MapObject::create(cx));
> if (!obj)
> return false;
Mind moving this down below the ThrowIfNotConstructing call?
@@ +1902,5 @@
> SetObject::construct(JSContext* cx, unsigned argc, Value* vp)
> {
> Rooted<SetObject*> obj(cx, SetObject::create(cx));
> if (!obj)
> return false;
Likewise.
::: js/src/jsweakmap.cpp
@@ +513,5 @@
> {
> CallArgs args = CallArgsFromVp(argc, vp);
> RootedObject obj(cx, NewBuiltinClassInstance(cx, &WeakMapObject::class_));
> if (!obj)
> return false;
Move the obj bits down below ThrowIfNotConstructing as well.
Attachment #8636833 -
Flags: review?(jwalden+bmo) → review+
Comment 7•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox42:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Comment 8•9 years ago
|
||
Developer release notes:
https://developer.mozilla.org/en-US/Firefox/Releases/42#JavaScript
Reference compat updates:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Browser_compatibility
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap#Browser_compatibility
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#Browser_compatibility
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•