Closed Bug 975412 Opened 10 years ago Closed 10 years ago

Length property of the (Weak){Map,Set} constructors should be 0

Categories

(Core :: JavaScript: Standard Library, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: fs, Assigned: sankha)

References

Details

Attachments

(1 file)

If I see it correctly, there are some inconsistencies with the length property of Map, Set, WeakMap, WeakSet constructors:

The latest ECMAScript6 specification says they all should be 0:

> Besides the length property (whose value is 0)

Map http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-constructor
Set http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-set-constructor
WeakMap http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakmap-constructor
WeakSet
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-weakset-constructor

It looks like it is only correct for WeakMap in Nightly:

Nightly 30.0a1 (2014-02-21) Ubuntu 13.10:
> Map.length
1
> Set.length
1
> WeakMap.length
0

Chromium Version 32.0.1700.107 Ubuntu 13.10:
> Map.length 
0
> Set.length
0
> WeakMap.length
0
> WeakSet.length
0

IE 11.0.9600.16428 Win7
> Map.length 
1
> Set.length 
1
> WeakMap.length
1
Attached patch patch v1Splinter Review
This should fix it.
Attachment #8379741 - Flags: review?(jorendorff)
Comment on attachment 8379741 [details] [diff] [review]
patch v1

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

Nice.
Attachment #8379741 - Flags: review?(jorendorff) → review+
Keywords: checkin-needed
Assignee: nobody → sankha93
https://hg.mozilla.org/mozilla-central/rev/724240c06850
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Blocks: 1007285
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: