Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / debugger / debugger-scripts-reload.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
5
6 <script>
7
8 function test()
9 {
10     InspectorTest.evaluateInPage("function foo() {} //# sourceURL=dummyScript.js", step1);
11
12     function step1()
13     {
14         InspectorTest.startDebuggerTest(step2);
15     }
16
17     function step2()
18     {
19         InspectorTest.queryScripts(function(script) { step3({ data: script }) });
20         WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, step3);
21     }
22
23     function step3(event)
24     {
25         var script = event.data;
26         if (script.sourceURL.indexOf("dummyScript.js") !== -1) {
27             InspectorTest.addResult("Dummy script found: " + script.sourceURL);
28             // Let scripts dispatch and reload.
29             setTimeout(InspectorTest.reloadPage.bind(InspectorTest, afterReload), 0);
30         }
31     }
32
33     function afterReload()
34     {
35         var scripts = InspectorTest.queryScripts();
36         for (var i = 0; i < scripts.length; ++i) {
37             if (scripts[i].sourceURL.indexOf("dummyScript.js") !== -1)
38                 InspectorTest.addResult("FAILED: dummy script found after navigation");
39         }
40         InspectorTest.completeDebuggerTest();
41     }
42
43 }
44 </script>
45 </head>
46 <body onload="runTest()">
47 <p>
48 Tests that scripts list is cleared upon page reload.
49 </p>
50 </body>
51 </html>