8f2480e7b81bfb038ced6d8e089e1daab55d8913
[WebKit-https.git] / LayoutTests / http / tests / inspector / network / network-xhr-sync.html
1 <html>
2 <head>
3 <script src="../inspector-test.js"></script>
4 <script src="../network-test.js"></script>
5 <script>
6 function loadData()
7 {
8     doXHR("GET", "resources/resource.php", false, resourceLoaded);
9 }
10
11 function resourceLoaded()
12 {
13     console.log("Done.");
14 }
15
16 function test()
17 {
18     InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
19     InspectorTest.evaluateInPage("loadData()");
20
21     function step2()
22     {
23         var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
24         InspectorTest.addResult(resource1.url);
25         InspectorTest.addResult("resource.type: " + resource1.type);
26         InspectorTest.addResult("resource.content before requesting content: " + resource1.content);
27         resource1.requestContent(step3);
28     }
29
30     function step3()
31     {
32         var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
33         InspectorTest.addResult("resource.content after requesting content: " + resource1.content);
34
35         InspectorTest.completeTest();
36     }
37 }
38 </script>
39 </head>
40 <body onload="runTest()">
41  <p>
42  Tests XHR network resource type and content for synchronous requests.
43 <a href="https://bugs.webkit.org/show_bug.cgi?id=61205">Bug 61205</a>
44 </p>
45 </body>
46 </html>