Bug 55347 - "name" and "message" enumerable on *Error.prototype
Summary: "name" and "message" enumerable on *Error.prototype
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Minor
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-27 20:31 PST by Mark S. Miller
Modified: 2011-08-23 12:29 PDT (History)
4 users (show)

See Also:


Attachments
Fix value of message. (10.91 KB, patch)
2011-08-23 12:23 PDT, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark S. Miller 2011-02-27 20:31:48 PST
See https://bugzilla.mozilla.org/show_bug.cgi?id=637207 and
http://code.google.com/p/v8/issues/detail?id=1215

For all so-called NativeError.prototype objects, their "name" and "message"
properties are enumerable when they shouldn't be. Error itself has this problem for 'message' but not for 'name'.

The "message" property's value should be the empty string. But on all the NativeError.prototype objects its value is instead the same as "name" -- the name of the corresponding constructor.

I am classifying this as minor since an initialization script can easily repair
this using Object.defineProperty.
Comment 1 Gavin Barraclough 2011-06-10 13:34:17 PDT
Fixed in r88559
Comment 2 Mark S. Miller 2011-08-23 02:39:07 PDT
> Fixed in r88559

Not quite. In r93580 I get

RangeError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "RangeError"
TypeError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "TypeError"
EvalError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "EvalError"
URIError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "URIError"
ReferenceError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "ReferenceError"
SyntaxError.prototype 15.11.7.7 .message doesn't have expected value: should be "" but was "SyntaxError"

(From http://erights.org/tests/testjs/ )
Comment 3 Gavin Barraclough 2011-08-23 12:09:35 PDT
Ooops, scanned this bug too quickly, yep, incomplete job. Reopening.

Thanks for catching this Mark.
Comment 4 Gavin Barraclough 2011-08-23 12:23:35 PDT
Created attachment 104889 [details]
Fix value of message.
Comment 5 Gavin Barraclough 2011-08-23 12:29:00 PDT
Okay, hopefully really should be fixed in r93624!