Closed
Bug 56868
Opened 25 years ago
Closed 24 years ago
Error objects have wrong [[Class]] property
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla0.8.1
People
(Reporter: david, Assigned: rogerl)
Details
(Keywords: js1.5)
Attachments
(1 file)
|
565 bytes,
patch
|
Details | Diff | Splinter Review |
All NativeError objects, including Error, TypeError, etc. have
the wrong [[Class]] property. ECMA3 says it should be "Error"
But in js15rc1, Object.prototype.toString() reports it as "Exception".
| Reporter | ||
Comment 1•25 years ago
|
||
I forgot to cite what portions of the spec I'm referring to.
See 15.11.1.1 and 15.11.7.2
Comment 2•25 years ago
|
||
From ECMA3 document -
15.11.1.1 Error (message)
The [[Prototype]] property of the newly constructed object is set to the original
Error prototype object, the one that is the initial value of Error.prototype
(section 15.11.3.1).
The [[Class]] property of the newly constructed object is set to "Error".
If the argument message is not undefined, the message property of the newly
constructed object is set to ToString(message).
15.11.7.2 NativeError (message)
The [[Prototype]] property of the newly constructed object is set to the
prototype object for this error constructor.
The [[Class]] property of the newly constructed object is set to "Error".
If the argument message is not undefined, the message property of the newly
constructed object is set to ToString(message).
Comment 3•25 years ago
|
||
Roger may have missed this because it was UNCONFIRMED. It's real. Please fix
for js1.5 (with a patch attached, reviewed, and in the trunk, we can make a last
minute attempt for Netscape 6 rtm).
/be
| Assignee | ||
Comment 4•25 years ago
|
||
Comment 5•25 years ago
|
||
r=mccabe. Looks like we're OK in rhino.
| Assignee | ||
Comment 6•25 years ago
|
||
just need an sr= on the patch, it's trivial.
Comment 7•25 years ago
|
||
Marking 0.8.1, let's get some reviews quick!
Target Milestone: --- → mozilla0.8.1
Comment 8•25 years ago
|
||
Any such clearly conforming class name change in the future gets an automatic
sr=brendan@mozilla.org pre-approval.
/be
| Assignee | ||
Comment 9•24 years ago
|
||
Fix checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 10•24 years ago
|
||
Testcases added to JS test suite:
js/tests/ecma_3/Object/class-003.js
js/tests/ecma_3/Object/class-004.js
These check the [[Class]] property of all the NativeError objects,
where we expect [[Class]] = "Error"; and the NativeError constructors,
where we expect [[Class]] = "Function". Both tests pass in the current
debug and optimized JS shells on WinNT and Linux.
Marking bug VERIFIED FIXED.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•