Bug 55347

Summary: "name" and "message" enumerable on *Error.prototype
Product: WebKit Reporter: Mark S. Miller <erights>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Minor CC: barraclough, cmarcelo, erights, mathias
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Fix value of message. sam: review+

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!