[Webkit-unassigned] [Bug 52079] Syntax errors should be early errors.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 17 19:42:59 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=52079





--- Comment #15 from Gavin Barraclough <barraclough at apple.com>  2011-01-17 19:42:58 PST ---
We should probably change this test, to make it a little more tolerant.  The problem here is that GTK's results are a little too good. ;-)

This test is currently sensitive to stack depth, which can validly vary between platforms.  We should probably require the first couple of test cases to work (them throwing would probably indicate something is wrong), but for the latter two either throwing a SyntaxError or successfully completing could be considered a good result.


Something like this will probably work a little better:

function repeatedExpression(value, operator, count)
{
    var expression = value;
    for (var i = 1; i < count; ++i)
        expression += ' ' + operator + ' ' + value;
    return expression;
}

function testLargeExpression(count)
{
    try {
        return eval(repeatedExpression("letterA", "+", count)).length == count;
    } catch (e) {
        return count >= 10000 && String(e) == "SyntaxError: Expression too deep";
    }
}

shouldBeTrue('testLargeExpression(100)');
shouldBeTrue('testLargeExpression(1000)');
shouldBeTrue('testLargeExpression(10000)');
shouldBeTrue('testLargeExpression(100000)');

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



More information about the webkit-unassigned mailing list