<script src="/js-test-resources/ui-helper.js"></script>
<script>

if (window.testRunner) {
	testRunner.dumpAsText();
	testRunner.waitUntilDone();
}

function navigateFrame()
{
	window.location.href = 'resources/notify-done.html';
}

window.onload = function()
{
	// Simulate a user interaction with the page so that the beforeunload alert shows.
	const testButton = document.getElementById("testButton");
	UIHelper.activateAt(testButton.offsetLeft + 5, testButton.offsetTop + 5);
}

</script>
<body>
When viewed using the host 127.0.0.1, this page has a sandboxed iframe whose security origin matches the main frame.<br>
The iframe has a beforeunload handler, and that handler should not result in the display of the page dismissal dialog since allow-modals is not set.<br>
<input id="testButton" type="button" value="Click to navigate" onclick="navigateFrame()">
<iframe sandbox="allow-scripts allow-same-origin" src="http://127.0.0.1:8000/misc/resources/iframe-with-beforeunload.html"></iframe><br>
</body>
