Closed Bug 145779 Opened 22 years ago Closed 22 years ago

Function.prototype.apply.length should return 2

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: pschwartau, Assigned: khanson)

References

Details

(Keywords: js1.5, Whiteboard: [Bug 145791 has been filed against Rhino for same issue])

Attachments

(1 file)

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.
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]
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'
Blocks: 149801
Proposed patch.
cc'ing reviewers to r= this patch
Keywords: js1.5
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+
Attachment #89193 - Flags: approval+
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
Closed: 22 years ago
Keywords: fixed1.0.1
Resolution: --- → FIXED
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
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: