Closed Bug 56868 Opened 25 years ago Closed 24 years ago

Error objects have wrong [[Class]] property

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.8.1

People

(Reporter: david, Assigned: rogerl)

Details

(Keywords: js1.5)

Attachments

(1 file)

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".
I forgot to cite what portions of the spec I'm referring to. See 15.11.1.1 and 15.11.7.2
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).
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
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: js1.5
r=mccabe. Looks like we're OK in rhino.
just need an sr= on the patch, it's trivial.
Marking 0.8.1, let's get some reviews quick!
Target Milestone: --- → mozilla0.8.1
Any such clearly conforming class name change in the future gets an automatic sr=brendan@mozilla.org pre-approval. /be
Fix checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
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.

Attachment

General

Creator:
Created:
Updated:
Size: