blob: c46d3839856ffdc75395aa1e29f3b76d5d50b7be [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script>
function runTest()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpChildFrames();
}
function removeFrameAndAddNewFrame(oldFrameId) {
body = document.getElementById('body');
oldFrame = document.getElementById(oldFrameId);
body.removeChild(oldFrame);
// newFrame is added to the frame tree when the parent has the same number of
// children as when frame5 was being added. This will make
// likelyUniqueSuffix the same for frame5 and newFrame - their unique
// name will have to be different in some other way.
newFrame = document.createElement('iframe');
newFrame.name = "sameName";
body.appendChild(newFrame);
}
removeFrameAndAddNewFrame('frame2')
removeFrameAndAddNewFrame('frame3')
}
</script>
</head>
<body onload="runTest()" id="body">
<!--
Before https://crrev.com/1968213002 the name generated by
FrameTree::generateOldStyleMaybeUniqueName would be assumed to be unique, but
in reality could conflict with other names. This scenario is similar, but not
the same as https://crbug.com/576969#c3.
Additionally, this test also exercises a scenario where the new
FrameTree::generateLikelyUniqueSuffix can generate a suffix that
is not really unique (and where uniquness comes from numberOfTries
in FrameTree::ensureUniquenessOfUniqueName).
-->
<iframe id="frame1" name="sameName"></iframe>
<iframe id="frame2" name="sameName"></iframe>
<iframe id="frame3" name="sameName"></iframe>
<iframe id="frame4" name="sameName"></iframe>
<iframe id="frame5" name="sameName"></iframe>
</body>
</html>