Bug 3975 - JS test suite puts incorrect limitations on Function.toString()
Summary: JS test suite puts incorrect limitations on Function.toString()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-12 17:26 PDT by Geoffrey Garen
Modified: 2012-09-06 16:23 PDT (History)
1 user (show)

See Also:


Attachments
Patch (3.43 KB, patch)
2005-07-12 17:27 PDT, Geoffrey Garen
darin: review-
Details | Formatted Diff | Diff
new fix, added comments, added whitespace insensitive compare (44.42 KB, patch)
2012-09-06 15:18 PDT, Gavin Barraclough
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2005-07-12 17:26:04 PDT
Test failures:
        js1_2/function/tostring-1.js
        js1_2/function/tostring-2.js

These are false positives based on hard-coded results for Function.toString(). Our Function.toString() 
doesn't match Firefox's, but it doesn't seem worth the work to make it, since ECMA says 
Function.toString() is implementation dependent, and even the moz test says it is only trying to "verify 
that the result is something reasonable."

ECMA spec says:

15.3.4.2 Func t i o n. pr o t o t y pe . t o St r i ng ( ) 
An implementation-dependent representation of the function is returned... Note in particular that the 
use and placement of white space, line terminators, and semicolons within the representation string is 
implementation-dependent. 

The one ECMA requirement is: "This representation has the syntax of a FunctionDeclaration."
Comment 1 Geoffrey Garen 2005-07-12 17:27:37 PDT
Created attachment 2937 [details]
Patch

This patch replaces the mozilla format for Function.toString() in the test
suite's expected results with the JavaScriptCore format.
Comment 2 Darin Adler 2005-07-18 08:06:08 PDT
Comment on attachment 2937 [details]
Patch

This needs a comment at least, explaining why it's changed. Later when we merge
our test in with a newer version of the Mozilla tests, we'd like comments to
ease the merging.

An even better alternative would be to figure out a way to make the test
tolerant of the differences in whitespace.

We might even consider making our format more similar to the one from Mozilla
in cases where we like theirs better.
Comment 3 Gavin Barraclough 2012-09-06 15:18:08 PDT
Created attachment 162603 [details]
new fix, added comments, added whitespace insensitive compare
Comment 4 Geoffrey Garen 2012-09-06 16:02:19 PDT
Comment on attachment 162603 [details]
new fix, added comments, added whitespace insensitive compare

Throwback day.
Comment 5 Gavin Barraclough 2012-09-06 16:23:28 PDT
Fixed in r127797