summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/debugger/dynamic-scripts-breakpoints.html
blob: 231414756175470537701f35049fdb9741382b8c (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script src="../../http/tests/inspector/workspace-test.js"></script>
<script src="resources/load-dynamic-script.js"></script>
<script>
function foobar()
{
    var i = 0;
    var j = 0;
    var k = i + j;
}

foobar();
</script>
<script>
function test()
{
    WebInspector.breakpointManager._storage._breakpoints = {};
    var panel = WebInspector.showPanel("sources");

    InspectorTest.startDebuggerTest();

    InspectorTest.showScriptSource("dynamic-scripts-breakpoints.html", didShowScriptSource);

    function pathToFileName(path)
    {
        return path.substring(path.lastIndexOf("/") + 1);
    }

    function dumpBreakpointStorage()
    {
        var breakpointManager = WebInspector.breakpointManager;
        var breakpoints = breakpointManager._storage._setting.get();
        InspectorTest.addResult("    Dumping breakpoint storage");
        for (var i = 0; i < breakpoints.length; ++i)
            InspectorTest.addResult("        " + pathToFileName(breakpoints[i].sourceFileId) + ":" + breakpoints[i].lineNumber);
    }

    function didShowScriptSource(sourceFrame)
    {
        InspectorTest.addResult("Setting breakpoint:");
        InspectorTest.addSniffer(WebInspector.BreakpointManager.Breakpoint.prototype, "_addResolvedLocation", breakpointResolved);
        InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
    }

    function breakpointResolved(location)
    {
        InspectorTest.waitUntilPaused(paused);
        InspectorTest.addResult("Reloading page.");
        InspectorTest.reloadPage(onPageReloaded);
    }

    function paused()
    {
        dumpBreakpointStorage();
        InspectorTest.resumeExecution();
    }

    function onPageReloaded()
    {
        InspectorTest.completeDebuggerTest();
    }
}
</script>
</head>
<body onload="runTest()">
<p>Tests that there is no exception in front-end on page reload when breakpoint is set in HTML document and some dynamic scripts are loaded before the script with the breakpoint is loaded.</p>
<a href="https://bugs.webkit.org/show_bug.cgi?id=99598">Bug 99598</a>
</body>
</html>