blob: 51d1d6fade52ffd6294eed0c8cf3e9885d33e9a9 [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.py";
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.py";
if (internals)
internals.addPrefetchLoadEventListener(link, () => { loadAfterPrefetch(); });
document.body.appendChild(link);
}
</script>
</body>
</html>