WebCore: https://bugs.webkit.org/show_bug.cgi?id=50758
[WebKit-https.git] / LayoutTests / http / tests / local / link-stylesheet-load-order-preload.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4   <script>
5     if (window.layoutTestController) {
6         layoutTestController.dumpAsText();
7         layoutTestController.waitUntilDone();
8         // Prevent networking layer from reordering loads.
9         if (layoutTestController.setSerializeHTTPLoads)
10             layoutTestController.setSerializeHTTPLoads();
11     }
12
13     function CallCommand(cmd)
14     {
15      try {
16          var req = new XMLHttpRequest;
17          req.open("GET", "http://127.0.0.1:8000/resources/network-simulator.php?command=" + cmd, false);
18          req.send(null);
19          return req.responseText;
20      } catch (ex) {
21          return "";
22      }
23     }
24
25     function endTest()
26     {
27         getResourceLog();
28         CallCommand("clear-resource-request-log");
29
30         if (window.layoutTestController)
31             layoutTestController.notifyDone();
32     }
33
34     function getResourceLog()
35     {
36         var log = CallCommand("get-resource-request-log");
37         var logLines = log.split('\n');
38         document.getElementById('result').innerText = logLines.join('\n');
39     }
40
41     CallCommand("start-resource-request-log");
42     window.addEventListener('load', endTest, false);
43   </script>
44   
45   <!-- This will trigger the preload scanner -->
46   <script src="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=script.js"></script>
47
48   <link rel=stylesheet href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=no-media.css">
49   <link rel=stylesheet media="" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-empty.css">
50   <link rel=stylesheet media="all" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-all.css">
51   <link rel=stylesheet media="print" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-print.css">
52   <link rel=stylesheet media="screen" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen.css">
53   <link rel=stylesheet media="screen and (min-width: 1px)" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen-query-success.css">
54   <link rel=stylesheet media="braille, screen" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-braille-screen.css">
55   <link rel=stylesheet media="screen and (min-width: 1000000px)" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen-query-fail.css">
56   <link rel=stylesheet media="aural" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-aural.css">
57   <link rel=stylesheet media="braille" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-braille.css">
58   <link rel=stylesheet media="handheld" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=median-handheld.css">
59   <link rel=stylesheet media="projection" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-projection.css">
60   <link rel=stylesheet media="tty" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-tty.css">
61   <link rel=stylesheet media="tv" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-tv.css">
62   <link rel=stylesheet href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=no-media-2.css">
63   <link rel=stylesheet media="" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-empty-2.css">
64   <link rel=stylesheet media="all" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-all-2.css">
65   <link rel=stylesheet media="print" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-print-2.css">
66   <link rel=stylesheet media="screen" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen-2.css">
67   <link rel=stylesheet media="screen and (min-width: 1px)" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen-query-success-2.css">
68   <link rel=stylesheet media="braille, screen" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-braille-screen-2.css">
69   <link rel=stylesheet media="screen and (min-width: 1000000px)" href="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=media-screen-query-fail-2.css">
70   
71 </head>
72 <body>
73   <img src="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=image.jpg">
74   <script src="http://127.0.0.1:8000/resources/network-simulator.php?command=log-resource-request&path=script-2.js"></script>
75
76   Test stylesheet load scheduling with preload scanner. Resource loads for screen stylesheets should be scheduled first, others should be scheduled last.
77
78   <h2>Resource requests:</h2>
79   <pre id="result">Request log goes here in DRT</pre>
80 </body>
81 </html>