Bug 15450
Summary: | Layout test fast/js/code-serialize-paren.html is incorrect | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mark Larson (Google) <mal> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | ahmad.saleem792, ashvayka |
Priority: | P2 | ||
Version: | 523.x (Safari 3) | ||
Hardware: | PC | ||
OS: | Windows XP |
Mark Larson (Google)
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");
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
shouldBeTrue("(function () { return (x + y) * z; }).toString().search('return.*\\(') < 0");
^ this got changed to below:
shouldBeTrue("(function () { return (x + y) * z; }).toString().search('return.*[(]') != -1");
___
in 2012 - 93488@main.
It is same as Blink / Chromium.
___
@Alexey - do we need to do anything here?
Alexey Shvayka
*** This bug has been marked as a duplicate of bug 76642 ***