Bug 70889

Summary: Result of Error.prototype.toString not ES5 conformant
Product: WebKit Reporter: mstarzinger
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Fix, needs testing, test case, Changelog.
none
Fix oliver: review+

Description mstarzinger 2011-10-26 02:06:32 PDT
The string representation of Error objects having their 'name' property set to the empty string is incorrect according to the ES5.1 spec. The built-in toString() method should just return the 'message' property for these cases. This is tested by a Test262 test case (i.e. 15.11.4.4-8-1) and can also be reproduced with the following JavaScript snippet.

function test() {
  var err = new Error("The description message");
  err.name = "";
  return err.toString() === "The description message";
}
Comment 1 Gavin Barraclough 2011-10-26 22:36:33 PDT
Created attachment 112640 [details]
Fix, needs testing, test case, Changelog.
Comment 2 Gavin Barraclough 2011-10-26 22:41:21 PDT
(ooops, ignore the config change!)
Comment 3 Gavin Barraclough 2011-11-15 11:57:38 PST
Created attachment 115213 [details]
Fix
Comment 4 Gavin Barraclough 2011-11-15 12:35:24 PST
Fixed in r100310