summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/js/resources/script-line-number.js
blob: 09d9b1a3c4b15fff96969b2b1e88a81c7426ae0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
description(
"This test checks that line numbers are correctly reported for both inline scripts and inline event handlers."
);

function getLineFromError(e)
{
    // JSC
    if (e.line)
        return e.line;

    // V8
    if (e.stack) {
        // ErrorName: ErrorDescription at FileName:LineNumber:ColumnNumber
        parts = e.stack.split(":");
        return parts[parts.length - 2];
    }

    return -1;
}

function assertErrorOnLine(error, expectedLine)
{
    shouldBe(stringify(getLineFromError(error)), stringify(expectedLine));
}

var successfullyParsed = true;