<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>

<script>
var test = function()
{
    var scripts = [];
    InspectorTest.startDebuggerTest(step1);

    function step1()
    {
        WebInspector.debuggerModel.queryScripts(function(script) { step2({ data: script }) });
        WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, step2);
    }

    function step2(event)
    {
        var script = event.data;
        if (script.sourceURL !== WebInspector.mainResource.url)
            return;
        scripts.push(script);
        if (scripts.length === 5)
            step3();
    }

    function step3()
    {
        scripts.sort(function(x, y) { return x.lineOffset - y.lineOffset });
        for (var i = 0; i < scripts.length; ++i) {
            InspectorTest.addResult("script " + (i + 1) + ":");
            InspectorTest.addResult("    start: " + scripts[i].lineOffset + ":" + scripts[i].columnOffset);
            InspectorTest.addResult("    end: " + scripts[i].endLine + ":" + scripts[i].endColumn);
        }
        InspectorTest.completeDebuggerTest();
    }
}
</script>    <script>
function f1()
{
}

window.onload = runTest;</script>

   <script> function f2() {}    </script>
   <script>function f3() {}
</script>
   <script>
   function f4() {}
</script>

</head>

<p>
Tests that valid parsed script notifications are received by front-end.
<a href="https://bugs.webkit.org/show_bug.cgi?id=52721">Bug 52721</a>
</p>

</html>