blob: a128181e2615452da459c03c3d0593ea4ff8533a [file] [log] [blame]
collinj@webkit.org9c672f62008-09-19 04:15:14 +00001<html>
2<style>
3 iframe
4 {
5 height: 60px;
6 width: 200px;
7 }
8</style>
9<script>
rniwa@webkit.org14a295a2012-06-13 07:49:51 +000010 if (window.testRunner)
11 testRunner.dumpAsText();
collinj@webkit.org9c672f62008-09-19 04:15:14 +000012 function emitFrameWithContents(contents)
13 {
14 document.write("<iframe src=\"data:text/html," + contents + "\"></iframe>");
15 }
16 function getRandomHost()
17 {
18 return "www." + Math.floor(Math.random() * 10000000000) + ".invalid";
19 }
20 function emitFrameForScheme(scheme)
21 {
22 var host = getRandomHost();
23 var contents = "<meta http-equiv='x-dns-prefetch-control' content='on'>";
24 contents += "<a href='" + scheme + "//" + host + "'>" + host + "</a>";
25 emitFrameWithContents(contents);
26 }
eric@webkit.org9a588b12010-02-04 19:29:19 +000027 function emitFrameForHost(host)
28 {
29 var contents = "<meta http-equiv='x-dns-prefetch-control' content='on'>";
30 contents += "<a href='http:" + "//" + host + "'>" + host + "</a>";
31 emitFrameWithContents(contents);
32 }
collinj@webkit.org9c672f62008-09-19 04:15:14 +000033 function emitFrameForManualDNSPrefetch(dnsPrefetchControl)
34 {
35 var host = getRandomHost();
36 var contents = "";
37 if (dnsPrefetchControl)
38 contents += "<meta http-equiv='x-dns-prefetch-control' content='" + dnsPrefetchControl + "'>";
ap@webkit.orge7e20112009-01-25 11:59:14 +000039 contents += "<link rel='dns-prefetch' href='http://" + host + "'>" + host;
collinj@webkit.org9c672f62008-09-19 04:15:14 +000040 emitFrameWithContents(contents);
41 }
42</script>
43<body>
44<p>This is a test of DNS prefetch control. It's considered a pass if it doesn't crash. It can also be used as
45a manual test of DNS prefetch using a networking monitoring tool.</p>
46
47<p>The following frames contain links that are expected to trigger a DNS prefetch.</p>
48
49<div>
50 <script>emitFrameForManualDNSPrefetch("on")</script>
51 <script>emitFrameForManualDNSPrefetch("off")</script>
52 <script>emitFrameForScheme("http:")</script>
53 <script>emitFrameForScheme("https:")</script>
54 <script>emitFrameForScheme("ftp:")</script>
eric@webkit.org9a588b12010-02-04 19:29:19 +000055 <script>emitFrameForHost("%")</script>
cgambrell@apple.coma0495c12021-03-03 17:14:52 +000056 <iframe src="resources/dns-prefetch-control.py"></iframe>
57 <iframe src="resources/dns-prefetch-control.py?value=on"></iframe>
58 <iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=on"></iframe>
collinj@webkit.org9c672f62008-09-19 04:15:14 +000059</div>
60
61<p style='clear: left'>The following frames contain links that are not expected to cause a DNS prefetch.</p>
62
63<div>
cgambrell@apple.coma0495c12021-03-03 17:14:52 +000064 <iframe src="resources/dns-prefetch-control.py?value=off"></iframe>
65 <iframe src="resources/dns-prefetch-control.py?value=foo"></iframe>
66 <iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py"></iframe>
67 <iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=off"></iframe>
68 <iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=foo"></iframe>
69 <iframe src="data:text/html,<meta http-equiv='x-dns-prefetch-control' value='off'><iframe src='http://127.0.0.1:8000/misc/resources/dns-prefetch-control.py'></iframe>"></iframe>
70 <iframe src="data:text/html,<meta http-equiv='x-dns-prefetch-control' value='on'><iframe src='https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py'></iframe>"></iframe>
collinj@webkit.org9c672f62008-09-19 04:15:14 +000071</div>
72
73</body>
74</html>