Web Inspector: Create JavaScriptSources based on network resources.
[WebKit-https.git] / LayoutTests / http / tests / inspector / network / network-request-revision-content.html
1 <html>
2 <head>
3 <script src="../inspector-test.js"></script>
4 <script>
5 function loadStylesheet()
6 {
7     var css = document.createElement("link");
8     css.rel = "stylesheet";
9     css.type = "text/css";
10     css.href = "resource/style.css";
11     document.head.appendChild(css);
12 }
13
14 function test()
15 {
16     InspectorTest.addConsoleSniffer(step2, true);
17     InspectorTest.addSniffer(WebInspector.NetworkUISourceCodeProvider.prototype, "_resourceAdded", true);
18     InspectorTest.evaluateInPage("loadStylesheet()");
19
20     var resource;
21     function step2(event)
22     {
23         var request = WebInspector.panel("network").requests[WebInspector.panel("network").requests.length - 1];
24         uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(request.url);
25         if (!uiSourceCode)
26             return;
27         uiSourceCode.addRevision("");
28         uiSourceCode.history[0].requestContent(step3);
29     }
30
31     function step3(content)
32     {
33         InspectorTest.addResult(uiSourceCode.url);
34         InspectorTest.addResult(content);
35         InspectorTest.completeTest();
36     }
37 }
38 </script>
39 </head>
40 <body onload="runTest()">
41 <p>Tests how revision requests content if original content was not loaded yet.</p>
42 <a href="https://bugs.webkit.org/show_bug.cgi?id=63631">Bug 63631</a>
43 </body>
44 </html>