blob: 14a1f1bbedd1211d365fdd35354a9c615db8df5a [file] [log] [blame]
<html>
<body onload="runTest()">
<div id="result"></div>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function done()
{
testRunner.notifyDone();
}
function iframeLoadFinished()
{
if (window.testRunner)
setTimeout(done, 0);
}
function loadAfterPrefetch()
{
var newIframe = document.createElement("iframe");
newIframe.src = "http://localhost:8000/cache/resources/prefetched-main-resource-iframe.php";
newIframe.onload = iframeLoadFinished;
document.body.appendChild(newIframe);
}
window.onmessage = function(message)
{
document.getElementById('result').textContent = message.data;
}
function runTest() {
var link = document.createElement("link");
link.rel = "prefetch";
link.href = "http://localhost:8000/cache/resources/prefetched-main-resource-iframe.php";
if (internals)
internals.addPrefetchLoadEventListener(link, () => { loadAfterPrefetch(); });
document.body.appendChild(link);
}
</script>
</body>
</html>