Closed
Bug 292215
Opened 20 years ago
Closed 20 years ago
Cannot set arguments[n] under certain circumstances
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.8beta4
People
(Reporter: jerfa, Assigned: brendan)
References
Details
(Keywords: js1.5, testcase, verified1.8)
Attachments
(2 files)
436 bytes,
text/html
|
Details | |
7.42 KB,
patch
|
shaver
:
review+
brendan
:
approval1.8b4+
|
Details | Diff | Splinter Review |
arguments[n] cannot be set if
1. n is a positive integer or 0
2. n is >= the number of the function's formal arguments
3. n is >= the number of the function's actual arguments
See the attached testcase. Expected output:
1337
1337
1337
1337
1337
Actual output:
undefined
undefined
1337
undefined
1337
Reporter | ||
Comment 1•20 years ago
|
||
Reporter | ||
Comment 2•20 years ago
|
||
This could be related: Given the following script
function fun (x) {
x = 4711
document.writeln( arguments[0] )
}
fun(1), fun()
SpiderMonkey and Navigator 3.04 output '4711 4711'. If I understand the last
point of ECMA262 10.1.8 correctly the right result is '4711 undefined' and that
is what I get in the other JS engines (IE, Opera, Rhino).
Assignee | ||
Comment 3•20 years ago
|
||
Old bug. Makes me regret conceding so much about arguments to MS back in the day.
/be
Assignee | ||
Comment 4•20 years ago
|
||
*** Bug 299645 has been marked as a duplicate of this bug. ***
Assignee | ||
Comment 5•20 years ago
|
||
This is an ECMA conformance issue that we can fix soon. I have a patch, and
it's safe for 1.8b4.
/be
Assignee: general → brendan
Flags: blocking1.8b4+
Keywords: js1.5
Priority: -- → P3
Target Milestone: --- → mozilla1.8beta4
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 6•20 years ago
|
||
ECMA-262 Ed. 3, 10.1.8 is hard to read in terms of SpiderMonkey. The key is
that only actual the k arguments are reflected into the arguments object as
indexed elements, and then only the first n, where n is the number of formal
parameters, share value storage with the formal parameters.
If k >= n, then it's of course perfectly fine in SpiderMonkey to use
fp->argv[k] for value storage (there's no formal to share with, but there's no
need for a full arguments object). If k < n, we may need an arguments object
to hold values indexed at i >= k. These would not be actual argument values (k
is the number of actuals), just values that the callee stores for grins.
/be
Attachment #189021 -
Flags: review?(shaver)
Comment 7•20 years ago
|
||
Comment on attachment 189021 [details] [diff] [review]
fix
r=shaver
Attachment #189021 -
Flags: review?(shaver) → review+
Assignee | ||
Comment 8•20 years ago
|
||
Comment on attachment 189021 [details] [diff] [review]
fix
Yet another nit-picky ECMA thing to get right with a spot fix.
/be
Attachment #189021 -
Flags: approval1.8b4+
Assignee | ||
Comment 9•20 years ago
|
||
Fixed.
/be
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Flags: testcase?
Comment 10•19 years ago
|
||
Checking in regress-292215.js;
/cvsroot/mozilla/js/tests/js1_5/Function/regress-292215.js,v <-- regress-292215.js
initial revision: 1.1
Flags: testcase? → testcase+
Comment 11•19 years ago
|
||
verified fixed on trunk and 1.8.x branches.
Status: RESOLVED → VERIFIED
Keywords: fixed1.8 → verified1.8
You need to log in
before you can comment on or make changes to this bug.
Description
•