If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Function.prototype.apply.length should return 2

VERIFIED FIXED

Status

()

Core
JavaScript Engine
VERIFIED FIXED
16 years ago
13 years ago

People

(Reporter: Phil Schwartau, Assigned: Kenton Hanson (gone))

Tracking

({js1.5})

Trunk
x86
All
js1.5
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [Bug 145791 has been filed against Rhino for same issue])

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
Function.prototype.apply has a FormalParameterList of length two:

          Function.prototype.apply (thisArg, argArray)

Accordingly, Function.prototype.apply.length should return 2.
This is explicitly stated in Section 15.3.4.3 of ECMA-262 Edition 3.
See http://www.mozilla.org/js/language/ for a reference.

However, SpiderMonkey currently returns 1 instead of 2.
This was reported by igor3@apochta.com.
(Reporter)

Comment 1

16 years ago
Testcase added to JS testsuite:

          mozilla/js/tests/ecma_3/Function/regress-145779.js
OS: Windows NT → All
Whiteboard: [Bug 145791 has been filed against Rhino for same issue]
(Reporter)

Comment 2

16 years ago
Igor has provided many specific tests of EMCA conformance for
both Function.prototype.apply and Function.prototype.call.

Following prevailing custom in the JS testsuite, I have CVS-deleted
  mozilla/js/tests/ecma_3/Function/regress-145779.js

and added Igor's tests in the following two testcases:
  mozilla/js/tests/ecma_3/Function/15.3.4.3-1.js
  mozilla/js/tests/ecma_3/Function/15.3.4.4-1.js

which test ECMA-262 Edition 3
  Section 15.3.4.3 (Function.prototype.apply)
  Section 15.3.4.4 (Function.prototype.call)

In the current SpiderMonkey shell, test 15.3.4.4-1.js passes;
and test 15.3.4.3-1.js fails only on the section that tests
Function.prototype.apply.length:

  FAILED!: Section 1 of test -
  FAILED!: Expected value '2', Actual value '1'
(Reporter)

Updated

16 years ago
Blocks: 149801
(Assignee)

Comment 3

16 years ago
Created attachment 89193 [details] [diff] [review]
changes table entry to indicate 2 args for apply

Proposed patch.
(Reporter)

Comment 4

16 years ago
cc'ing reviewers to r= this patch 
(Reporter)

Updated

16 years ago
Keywords: js1.5

Comment 5

16 years ago
Comment on attachment 89193 [details] [diff] [review]
changes table entry to indicate 2 args for apply

r=rogerl
Attachment #89193 - Flags: review+
Comment on attachment 89193 [details] [diff] [review]
changes table entry to indicate 2 args for apply

sr=brendan@mozilla.org, please get drivers to approve this for the 1.0 branch.

/be
Attachment #89193 - Flags: superreview+

Updated

15 years ago
Attachment #89193 - Flags: approval+

Comment 7

15 years ago
Comment on attachment 89193 [details] [diff] [review]
changes table entry to indicate 2 args for apply

a=chofmann for 1.0.1  add fixed1.0.1 to the keywords after checking into the
branch
Checked into branch and trunk.

/be
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Keywords: fixed1.0.1
Resolution: --- → FIXED
(Reporter)

Comment 9

15 years ago
Verified Fixed. Both testcases in Comment #2 now pass in the
debug and optimized SpiderMonkey shell.

Have verified the fix on the 1.0 branch as well. Used a 
Mozilla 1.0 branch build from 2002-08-23, and javascript:URL

  javascript:alert(Function.prototype.apply.length) ---> 2
Status: RESOLVED → VERIFIED
Keywords: verified1.0.1

Updated

13 years ago
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.