collinj@webkit.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <style> |
| 3 | iframe |
| 4 | { |
| 5 | height: 60px; |
| 6 | width: 200px; |
| 7 | } |
| 8 | </style> |
| 9 | <script> |
rniwa@webkit.org | 14a295a | 2012-06-13 07:49:51 +0000 | [diff] [blame] | 10 | if (window.testRunner) |
| 11 | testRunner.dumpAsText(); |
collinj@webkit.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 12 | 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.org | 9a588b1 | 2010-02-04 19:29:19 +0000 | [diff] [blame] | 27 | 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.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 33 | 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.org | e7e2011 | 2009-01-25 11:59:14 +0000 | [diff] [blame] | 39 | contents += "<link rel='dns-prefetch' href='http://" + host + "'>" + host; |
collinj@webkit.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 40 | 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 |
| 45 | a 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.org | 9a588b1 | 2010-02-04 19:29:19 +0000 | [diff] [blame] | 55 | <script>emitFrameForHost("%")</script> |
cgambrell@apple.com | a0495c1 | 2021-03-03 17:14:52 +0000 | [diff] [blame] | 56 | <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.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 59 | </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.com | a0495c1 | 2021-03-03 17:14:52 +0000 | [diff] [blame] | 64 | <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.org | 9c672f6 | 2008-09-19 04:15:14 +0000 | [diff] [blame] | 71 | </div> |
| 72 | |
| 73 | </body> |
| 74 | </html> |