[Webkit-unassigned] [Bug 110569] [Progress Events] ProgressEvent.length returns wrong value.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 15 08:59:22 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=110569





--- Comment #2 from Christophe Dumez <dchris at gmail.com>  2013-04-15 08:57:37 PST ---
The ES6 spec (http://wiki.ecmascript.org/lib/exe/fetch.php?id=harmony%3Aspecification_drafts&cache=cache&media=harmony:working_draft_ecma-262_edition_6_03-08-13-nomarkup.pdf) actually says:
"""
15.3.5.1 length
The value of the length property is an integer that indicates the typical number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments.
The behaviour of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. This property has the attributes 
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
"""

Therefore, it is not clear to me that we should *not* count optional parameters.
The spec only refers to the *typical* number of arguments.

Actually, if I'm not mistaken, it is actually more common to count the optional parameters:
- JSC (e.g. Safari) will return 2 for ProgressEvent.length, not 1.
- ES6 states the Date constructor has a length of 7 (15.9.4):
  Date (year, month [, date [, hours [, minutes [, seconds [, ms ] ] ] ] ])
- ES6 states the TypedArray constructor has a length of 3 (15.13.6.3):
  TypedArray ( buffer, byteOffset=0, length=undefined )
- window.confirm.length returns 1 for both Safari and Firefox even though the argument is optional.

Jungkee, could you please clarify? Why do you expect ProgressEvent.length to return 1? and why do you expect optional arguments not to be counted?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list