Closed
Bug 562448
Opened 15 years ago
Closed 15 years ago
ES5 Function.prototype.apply does not require argArray be either Array or arguments
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla2.0b3
People
(Reporter: brendan, Assigned: Waldo)
References
Details
(Keywords: dev-doc-complete, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 1 obsolete file)
10.28 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
It treats the second parameter, if not null and not undefined, as an object from which to get "length" and index-named properties, i.e. a generic array-like.
/be
Updated•15 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 1•15 years ago
|
||
I have a query going on es5-discuss about whether it's really intended/desirable to apply ToNumber twice (once via ToUint32) to argsArray.length, but with spec text as it is now, this patch is correct.
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #457930 -
Attachment is obsolete: true
Attachment #459839 -
Flags: review?(brendan)
Attachment #457930 -
Flags: review?(brendan)
Reporter | ||
Comment 3•15 years ago
|
||
Comment on attachment 459839 [details] [diff] [review]
Patch and tests, now with less weird error-checking and double-evaluating
Nice, much improved and close to the spec.
>+ if (lenval.isInt32()) {
>+ length = jsuint(jsint(lenval.toInt32())); /* jsuint cast does ToUint32 */
Don't need the jsint case here.
r=me with that picked -- thanks.
/be
Attachment #459839 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 4•15 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/898b20672383
Picked that nit, added comments delineating algorithm steps for greater clarity and readability, and renamed a variable for the same reason -- pushed with those changes.
Whiteboard: fixed-in-tracemonkey
Target Milestone: --- → mozilla2.0b3
Assignee | ||
Comment 5•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 6•15 years ago
|
||
Added a note to:
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/apply
And to the New in JavaScript 1.8.5 page.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•