[Webkit-unassigned] [Bug 15450] New: Layout test fast/js/code-serialize-paren.html is incorrect

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 9 22:57:50 PDT 2007


           Summary: Layout test fast/js/code-serialize-paren.html is
           Product: WebKit
           Version: 522+ (nightly)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: mark.larson at gmail.com

I was comparing this test on Firefox, IE, and Safari Win32 and noticed that FF
and IE both fail, throwing exceptions.

Digging deeper, it looks to me like the test is incorrect. Here's the key line
from resources/code-serialize-paren.js:

  shouldBeTrue("(function () { return (x + y) * z;
}).toString().search('return.*\\(') < 0");

IE and FX choke on this because the reg exp in search() is not properly
escaped. As a string inside a string, it needs double escaping to get the
backslash in the final expression. Safari doesn't throw an error, but it
doesn't find a match either.

That's where I think this test is wrong. Search() should return a positive
number when a match is found, but this is testing for result < 0. 

If the expression for search() is changed to 'return.*\\\\(', then the regular
expression evaluates properly and the result is > 0 (17 on Safari, 18 on FF, 15
on IE). 

I think the line in the test should be changed to:

  shouldBeTrue("(function () { return (x + y) * z;
}).toString().search('return.*\\\\(') > 0");

Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list