RESOLVED DUPLICATE of bug 76642 15450
Layout test fast/js/code-serialize-paren.html is incorrect
https://bugs.webkit.org/show_bug.cgi?id=15450
Summary Layout test fast/js/code-serialize-paren.html is incorrect
Mark Larson (Google)
Reported 2007-10-09 22:57:49 PDT
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
Ahmad Saleem
Comment 1 2024-02-05 07:42:58 PST
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
Comment 2 2024-02-05 16:13:59 PST
*** This bug has been marked as a duplicate of bug 76642 ***
Note You need to log in before you can comment on or make changes to this bug.