blob: 93e65a53237d5bb7c41dfd79d852f55c6e623648 [file] [log] [blame]
<html>
<script>
var w1, w2;
var iframeXHRCount = 0;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows(true);
}
function log(message)
{
document.getElementById("log").innerText += message + "\n";
}
iframeXHRFinished = function()
{
log("FAIL: Iframe XHR request should never finish loading!");
notifyDone();
}
iframeXHRStarted = function()
{
log("Started loading iframe XHR request.");
++iframeXHRCount;
if (iframeXHRCount < 2)
return;
log("Beginning adoption sequence.");
// First adoptNode will have an id collision if resource ids are not
// unique across pages.
var f = w1.document.getElementsByTagName("iframe")[0];
w2.document.adoptNode(f);
w2.document.body.appendChild(f);
log("PASS: adopted node without id collision");
// Adopt node back to its original page to verify that the resource id
// for the iframe was properly removed from its original page.
w1.document.adoptNode(f);
w1.document.body.appendChild(f);
log("PASS: adopted back to original page without id collision");
notifyDone();
}
function notifyDone()
{
w1.close();
w2.close();
if (window.testRunner)
testRunner.notifyDone();
}
function test()
{
w1 = window.open("resources/iframe-reparenting-id-collision-page.html");
w2 = window.open("resources/iframe-reparenting-id-collision-page.html");
}
</script>
<body onload="test()">
<p>This test checks that resource ids are unique across pages by opening
two pages that both contain an iframe that loads the same number of
resources, then adopting the iframe from one page to the other. If resource
ids are not unique across pages, these pages will have the same resource ids
and the adoptNode will fail due to an id collision. The iframe is then
adopted back into its original page to check for id collision from failure
to properly remove its resource id from the original page. </p>
<pre id=log></pre>
</body>
</html>