Last Comment Bug 807001 - Map.prototype.size and Set.prototype.size should be accessor properties
: Map.prototype.size and Set.prototype.size should be accessor properties
: dev-doc-complete
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Other Branch
: All All
: -- normal (vote)
: mozilla19
Assigned To: Jason Orendorff [:jorendorff]
: general
: Jason Orendorff [:jorendorff]
: 801393 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2012-10-30 09:58 PDT by Jason Orendorff [:jorendorff]
Modified: 2012-11-25 23:42 PST (History)
7 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

v1 (31.47 KB, patch)
2012-10-30 10:17 PDT, Jason Orendorff [:jorendorff]
jwalden+bmo: review+
Details | Diff | Splinter Review

Description Jason Orendorff [:jorendorff] 2012-10-30 09:58:55 PDT
This is a breaking change for any code using .size() on Map or Set objects. The patch includes fixes for in-tree uses.
Comment 1 Jason Orendorff [:jorendorff] 2012-10-30 10:17:38 PDT
Created attachment 676658 [details] [diff] [review]

I considered changing JS_DefineProperty with JSPROP_NATIVE_ACCESSORS so as to make the getter function objects have == "size", but function object .name properties are totally unspecified. Some other time perhaps.
Comment 2 Jeff Walden [:Waldo] (remove +bmo to email) 2012-10-30 12:16:06 PDT
Comment on attachment 676658 [details] [diff] [review]

Review of attachment 676658 [details] [diff] [review]:

Given that the accessors in { get foo() { } } have no name, and perhaps we might want to self-host this or something at some point, it seems best to not have a name, definitely.

I completely agree with the logical argument for .size over .size(), as made in the es-discuss thread; it's totally rational and correct, and we should have .size, not .size().  But when I look at this, this irrationally looks weird and wrong to me.  Maybe it's just because I'm seeing both cases next to each other and there's cross-pollination of smell.  I dunno.  Forward!
Comment 3 Jason Orendorff [:jorendorff] 2012-11-02 15:44:27 PDT
Comment 5 Ryan VanderMeulen [:RyanVM] 2012-11-03 06:28:54 PDT
Comment 6 Mark Hammond [:markh] 2012-11-04 17:22:35 PST
I just updated the Map and Set documentation, including a note that it changed in FF19
Comment 7 Mark Hammond [:markh] 2012-11-04 17:40:39 PST
*** Bug 801393 has been marked as a duplicate of this bug. ***
Comment 8 Tom Schuster [:evilpie] 2012-11-07 07:21:02 PST
Looking at this diff from v8, they seem to set the getter name to "size".
Comment 9 Mark Hammond [:markh] 2012-11-25 23:28:56 PST
See comment 6 - I updates the docs on MDN ( and and cleared dev-doc-needed based on that.  If something else is necessary, please indicate it.
Comment 10 Kohei Yoshino [:kohei] 2012-11-25 23:31:47 PST
I think this should be mentioned in too.
Comment 11 Mark Hammond [:markh] 2012-11-25 23:41:00 PST
(In reply to Kohei Yoshino from comment #10)
> I think this should be mentioned in
> too.

Done :)
Comment 12 Kohei Yoshino [:kohei] 2012-11-25 23:42:46 PST

Note You need to log in before you can comment on or make changes to this bug.