blob: a128181e2615452da459c03c3d0593ea4ff8533a [file] [log] [blame]
<html>
<style>
iframe
{
height: 60px;
width: 200px;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function emitFrameWithContents(contents)
{
document.write("<iframe src=\"data:text/html," + contents + "\"></iframe>");
}
function getRandomHost()
{
return "www." + Math.floor(Math.random() * 10000000000) + ".invalid";
}
function emitFrameForScheme(scheme)
{
var host = getRandomHost();
var contents = "<meta http-equiv='x-dns-prefetch-control' content='on'>";
contents += "<a href='" + scheme + "//" + host + "'>" + host + "</a>";
emitFrameWithContents(contents);
}
function emitFrameForHost(host)
{
var contents = "<meta http-equiv='x-dns-prefetch-control' content='on'>";
contents += "<a href='http:" + "//" + host + "'>" + host + "</a>";
emitFrameWithContents(contents);
}
function emitFrameForManualDNSPrefetch(dnsPrefetchControl)
{
var host = getRandomHost();
var contents = "";
if (dnsPrefetchControl)
contents += "<meta http-equiv='x-dns-prefetch-control' content='" + dnsPrefetchControl + "'>";
contents += "<link rel='dns-prefetch' href='http://" + host + "'>" + host;
emitFrameWithContents(contents);
}
</script>
<body>
<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
a manual test of DNS prefetch using a networking monitoring tool.</p>
<p>The following frames contain links that are expected to trigger a DNS prefetch.</p>
<div>
<script>emitFrameForManualDNSPrefetch("on")</script>
<script>emitFrameForManualDNSPrefetch("off")</script>
<script>emitFrameForScheme("http:")</script>
<script>emitFrameForScheme("https:")</script>
<script>emitFrameForScheme("ftp:")</script>
<script>emitFrameForHost("%")</script>
<iframe src="resources/dns-prefetch-control.py"></iframe>
<iframe src="resources/dns-prefetch-control.py?value=on"></iframe>
<iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=on"></iframe>
</div>
<p style='clear: left'>The following frames contain links that are not expected to cause a DNS prefetch.</p>
<div>
<iframe src="resources/dns-prefetch-control.py?value=off"></iframe>
<iframe src="resources/dns-prefetch-control.py?value=foo"></iframe>
<iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py"></iframe>
<iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=off"></iframe>
<iframe src="https://127.0.0.1:8443/misc/resources/dns-prefetch-control.py?value=foo"></iframe>
<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>
<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>
</div>
</body>
</html>