Closed Bug 1092538 Opened 10 years ago Closed 10 years ago

Ignore `null` iterable in Map, Set, WeakMap and WeakSet constructors

Categories

(Core :: JavaScript: Standard Library, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: anba, Assigned: arai)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file)

`null` iterable argument has to be ignored.

Simple tests:
---
new Map(null);
new Set(null);
new WeakMap(null); // but see bug 1092537
new WeakSet(null);
---

Expected: No TypeError thrown
Actual: TypeError thrown for Map, Set and WeakSet
Ignoring `null` in addition to `undefined` was added in ES6 draft rev14.
Keywords: dev-doc-needed
Whiteboard: [DocArea=JS]
Depends on: 1101704
Comment on attachment 8530324 [details] [diff] [review]
Ignore `null` iterable in Map, Set, WeakMap and WeakSet constructors.

Review of attachment 8530324 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks :)

::: js/src/builtin/MapObject.cpp
@@ -1235,5 @@
>      if (!obj)
>          return false;
>  
>      CallArgs args = CallArgsFromVp(argc, vp);
> -    if (args.hasDefined(0)) {

please change all of these to !args.get(0).isNullOrUndefined()
Attachment #8530324 - Flags: review?(evilpies) → review+
thank you for reviewing :D

Changed those lines and pushed to m-i:
  https://hg.mozilla.org/integration/mozilla-inbound/rev/187125e5da10
https://hg.mozilla.org/mozilla-central/rev/187125e5da10
Assignee: nobody → arai_a
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Thanks, :arai! :)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: