<html>
<head>
<script>
if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.waitUntilDone();
}

document.cookie = 'cookie=parent';

function log(msg) {
  var line = document.createElement('div');
  line.appendChild(document.createTextNode(msg));
  document.getElementById('console').appendChild(line);
}

function doTest() {
  log('--- Test begins ---\n');
  log('* "about:blank"\n');
  log('document.URL = ' + frames[0].frames[0].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[0].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[0].document.cookie + '\n');
  log('* ""\n');
  log('document.URL = ' + frames[0].frames[1].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[1].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[1].document.cookie + '\n');
  log('--- After document.open() ---\n');
  frames[0].frames[0].document.open();
  frames[0].frames[1].document.open();
  log('* "about:blank"\n');
  log('document.URL = ' + frames[0].frames[0].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[0].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[0].document.cookie + '\n');
  log('* ""\n');
  log('document.URL = ' + frames[0].frames[1].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[1].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[1].document.cookie + '\n');
  log('--- After document.close() ---\n');
  frames[0].frames[0].document.close();
  frames[0].frames[1].document.close();
  log('* "about:blank"\n');
  log('document.URL = ' + frames[0].frames[0].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[0].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[0].document.cookie + '\n');
  log('* ""\n');
  log('document.URL = ' + frames[0].frames[1].document.URL + '\n');
  log('document.baseURI = ' + frames[0].frames[1].document.baseURI + '\n');
  log('document.cookie = ' + frames[0].frames[1].document.cookie + '\n');
  log('--- Test ends ---\n');

  testRunner.notifyDone();
}
</script>
</head>
<body>
<iframe 
  onload="doTest()"
  src="resources/iframe-with-about-blank-children.html">
</iframe>
<div id="console"></div>
</body>
</html>
