<html>
<head>
<script src="/js-test-resources/js-test-pre.js"></script>
<script src="resources/cross-frame-access.js"></script>
</head>
<body>
<iframe src="http://localhost:8000/" style=""></iframe>
<pre id="console"></pre>
<script>
description("Tests that making other frame window a prototype doesn't expose that window methods");
jsTestIsAsync = true;

targetWindow = frames[0];

wasInvoked = false;

function callback(global) {
  global.wasInvoked = true;
}

function check() {
  shouldBeFalse('this.wasInvoked');
  finishJSTest();
}

window.onload = function() {
  originalSetTimeout = setTimeout;

  shouldThrowErrorName("__proto__ = targetWindow", "TypeError");

  var needsCheck = false;
  try {
    targetWindow.setTimeout(callback, 0, this);
    needsCheck = true;
  } catch (e) {
    console.log(e);
  }

  try {
    setTimeout.call(targetWindow, callback, 0, this);
    needsCheck = true;
  } catch(e) {
    console.log(e);
  }

  try {
    originalSetTimeout.call(targetWindow, callback, 0, this);
    needsCheck = true;
  } catch(e) {
    console.log(e);
  }

  if (needsCheck) {
    originalSetTimeout(check, 10);
  } else {
    finishJSTest();
  }
}
</script>
<script src="/js-test-resources/js-test-post.js"></script>
</body>
</html>
