Bug 70889 - Result of Error.prototype.toString not ES5 conformant
Summary: Result of Error.prototype.toString not ES5 conformant
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-26 02:06 PDT by mstarzinger
Modified: 2011-11-15 12:35 PST (History)
2 users (show)

See Also:


Attachments
Fix, needs testing, test case, Changelog. (4.20 KB, patch)
2011-10-26 22:36 PDT, Gavin Barraclough
no flags Details | Formatted Diff | Diff
Fix (7.81 KB, patch)
2011-11-15 11:57 PST, Gavin Barraclough
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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