Closed
Bug 508964
Opened 16 years ago
Closed 16 years ago
Update Arguments object to match ES5 spec
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: rspeyer, Assigned: norrisboyd)
References
Details
Attachments
(3 files, 1 obsolete file)
|
7.75 KB,
patch
|
Details | Diff | Splinter Review | |
|
12.98 KB,
patch
|
Details | Diff | Splinter Review | |
|
5.81 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.196 Safari/532.0
Build Identifier: Rhino 1.7 release 2 2009 03 22
As per 10.6 of the spec:
- arguments' prototype should be Array.prototype
- arguments.constructor should be Object
- arguments.toString and .toLocaleString should call the corresponding methods on Object.prototype, passing arguments as the 'this' value
- arguments' internal [[Class]] should be "Arguments"
Reproducible: Always
Summary: Make arguments inherit from Array, except constructor, toString and toLocaleString → Update Arguments object to match ES5 spec
Also refactored somewhat internally to make the code easier to follow.
| Assignee | ||
Updated•16 years ago
|
Assignee: nobody → norrisboyd
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
| Assignee | ||
Comment 3•16 years ago
|
||
Checking in src/org/mozilla/javascript/Arguments.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Arguments.java,v <-- Arguments.java
new revision: 1.35; previous revision: 1.34
done
Checking in src/org/mozilla/javascript/ScriptableObject.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptableObject.java,v <-- ScriptableObject.java
new revision: 1.159; previous revision: 1.158
done
Checking in testsrc/opt-1.tests;
/cvsroot/mozilla/js/rhino/testsrc/opt-1.tests,v <-- opt-1.tests
new revision: 1.9; previous revision: 1.8
done
Checking in testsrc/opt0.tests;
/cvsroot/mozilla/js/rhino/testsrc/opt0.tests,v <-- opt0.tests
new revision: 1.9; previous revision: 1.8
done
Checking in testsrc/opt9.tests;
/cvsroot/mozilla/js/rhino/testsrc/opt9.tests,v <-- opt9.tests
new revision: 1.9; previous revision: 1.8
done
RCS file: /cvsroot/mozilla/js/rhino/testsrc/doctests/arguments.doctest,v
done
Checking in testsrc/doctests/arguments.doctest;
/cvsroot/mozilla/js/rhino/testsrc/doctests/arguments.doctest,v <-- arguments.doctest
initial revision: 1.1
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
I think that this patch is wrong at least for one point. As far as I understand the spec, the prototype should NOT be Array prototype but Object prototype:
Point 6 of section 10.6:
"Set the [[Prototype]] internal property of obj to the standard built-in Object prototype object (15.2.4)."
I don't have the right to reopen this issue :-(
The spec changed since this bug was originally filed, such that the prototype of arguments objects is again Object.prototype. Changed the code to reflect that.
no need for special handling of toString or toLocaleString any more, as the prototype of arguments is Object.prototype
Attachment #420284 -
Attachment is obsolete: true
| Assignee | ||
Comment 7•16 years ago
|
||
Committed, thanks!
Checking in src/org/mozilla/javascript/Arguments.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/Arguments.java,v <-- Arguments.java
new revision: 1.36; previous revision: 1.35
done
Checking in testsrc/doctests/arguments.doctest;
/cvsroot/mozilla/js/rhino/testsrc/doctests/arguments.doctest,v <-- arguments.doctest
new revision: 1.2; previous revision: 1.1
done
You need to log in
before you can comment on or make changes to this bug.
Description
•