<!DOCTYPE html>
<html>
<head>
  <script src="../../js-test-resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>

<script>
description('Tests that an onload handler that runs history.back() that\'s triggered by a history.back() doesn\'t crash the browser (see http://crbug.com/59554 for more details).');

onload = function()
{
  if (window.localStorage.started) {
      delete window.localStorage.started;
      finishJSTest();
  } else {
      // To make sure that we hit this branch, log this to the console so that 
      // it shows up in expected output (debug() will be blown away once we
      // navigate out).
      console.log('Starting test.');
      window.localStorage.started = true;
      // Navigate in a timeout to make sure we create a history entry.
      setTimeout(function() {
        window.location.href = 'resources/back-during-onload-container.html';
      }, 0);
 }
};

var jsTestIsAsync = true;
</script> 

<script src="../../js-test-resources/js-test-post.js"></script>
</body>
</html>
