<script>
// Test steps:
// 1. Start on a page with no frames (this page).
// 2. Navigate to a page with a frame tree (Grandparent, Parent, Child, Uncle).
// 3. Navigate child frame to a slowly loading URL.
// 4. Go back to about:blank in child frame.
//    Important to use about:blank, which can commit immediately while walking the tree.
// 5. Go forward to slow URL, but stop before the navigation commits.
//    Important to cancel the load and ensure the history is not corrupted.
// 6. Go forward and let slow URL load.
//    Important for testing that navigation state is reset after stopping.
if (window.testRunner) {
    testRunner.clearBackForwardList();
    testRunner.dumpBackForwardList();
    testRunner.dumpAsText();
    testRunner.queueLoad("resources/forward-and-cancel-frames-container.html");
    testRunner.queueLoadingScript("frames[0].clickLink();");
    testRunner.queueBackNavigation(1);

    // Go forward to slow URL in child frame, but stop right away.  This should
    // reset the backForward list to the previous entry.
    testRunner.queueNonLoadingScript("setTimeout('history.forward();',0); setTimeout('window.stop();',10);");

    // Now go back to make sure the backForwardList is not corrupted.
    testRunner.queueNonLoadingScript("setTimeout('history.forward();',50);");
    testRunner.queueNonLoadingScript("setTimeout('testRunner.notifyDone();',100);");

    // Wait until we get back to this page.
    testRunner.queueLoadingScript("testRunner.waitUntilDone();");
}
</script>
<p>This test checks that the backForward list is not corrupted when a frame load is canceled.
<p>If testing manually, <a href="resources/forward-and-cancel-frames-container.html">click here</a>.
