blob: 30cbe4334ba680799c1cc4853c72495062d84ec5 [file] [log] [blame]
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
if (window.internals) {
// Decrease the state object total limit from 64MB to 4MB to speed up the test.
internals.setHistoryTotalStateObjectPayloadLimitOverride(4 * 1024 * 1024);
}
function log(msg) {
document.getElementById("logger").innerHTML += msg + "<br>";
}
var object = "aaaaaaaaaa";
for (var i = 0; i < 14; ++i)
object += object;
function click()
{
if (!eventSender)
return;
var button = document.getElementById("button");
eventSender.mouseMoveTo(button.offsetLeft + 5, button.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseUp();
}
window.onload = click;
var count = 1;
function clicked()
{
try {
history.pushState(object, object, "#" + object);
} catch (e) {
log("Unexpected exception: " + e);
if (window.testRunner)
testRunner.notifyDone();
}
++count;
if (count > 4) {
openFrame();
return;
}
setTimeout(click, 0);
}
function iframeLoaded()
{
document.getElementById("button").onclick = window.frames[0].iframeClicked;
click();
}
function openFrame()
{
var iframe = document.createElement('iframe');
iframe.src = 'resources/pushstate-iframe.html'
iframe.onload = iframeLoaded;
document.body.appendChild(iframe);
}
</script>
<body>
Test should not crash.<br>
Test does pushState both from the main frame and from an iframe and makes sure they both count against the main frame document's size limit.<br>
<button id="button" onclick="clicked();">Click to test pushState through a user gesture</button>
<div id="logger"></div>
</body>