chromium/ios/testing/data/http_server_files/window_proxy.html

<!DOCTYPE html>

<!--
Copyright 2016 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Window proxy object test page</title>
<script type="text/javascript">
  var namedWindow1;
  var namedWindow2;
  var unnamedWindow1;
  var unnamedWindow2;

  function openWindowNoName() {
    if (!unnamedWindow1)
      unnamedWindow1 = window.open('about:blank');
    else
      unnamedWindow2 = window.open('about:blank');
  };

  function openWindowWithName() {
    if (!namedWindow1)
      namedWindow1 = window.open('about:blank', 'named');
    else
      namedWindow2 = window.open('about:blank', 'named');
  };

  function compareUnnamedWindows() {
    var equal = !!unnamedWindow1 && !!unnamedWindow2 &&
        unnamedWindow1 == unnamedWindow2;
    document.getElementById('status').innerHTML =
        'unnamed windows equal: ' + equal;
  };

  function compareNamedWindows() {
    var equal = !!namedWindow1 && !!namedWindow2 &&
        namedWindow1 == namedWindow2;
    document.getElementById('status').innerHTML =
        'named windows equal: ' + equal;
  };

  function compareNamedAndUnnamedWindows() {
    var equal = !!unnamedWindow1 && !!namedWindow1 &&
        unnamedWindow1 == namedWindow1;
    document.getElementById('status').innerHTML =
        'named and unnamed equal: ' + equal;
  };

  function checkNamedWindow1Closed() {
    var closed = !!namedWindow1 ? namedWindow1.closed : 'never opened';
    document.getElementById('status').innerHTML = "window1.closed: " + closed;
  };

  function checkNamedWindow2Closed() {
    var closed = !!namedWindow2 ? namedWindow2.closed : 'never opened';
    document.getElementById('status').innerHTML = "window2.closed: " + closed;
  };

  function checkUnnamedWindow1Closed() {
    var closed = !!unnamedWindow1 ? unnamedWindow1.closed : 'never opened';
    document.getElementById('status').innerHTML = "window1.closed: " + closed;
  };

  function checkUnnamedWindow2Closed() {
    var closed = !!unnamedWindow2 ? unnamedWindow2.closed : 'never opened';
    document.getElementById('status').innerHTML = "window2.closed: " + closed;
  };

</script>
</head>
<body>
<br>
<div id='status'></div>
<br>
<a href='javascript:void(0);' id="openWindowNoName"
    onclick="openWindowNoName()">openWindowNoName</a><br />
<a href='javascript:void(0);' id="openWindowWithName"
    onclick="openWindowWithName()">openWindowWithName</a><br />
<a href='javascript:void(0);' id="compareUnnamedWindows"
    onclick="compareUnnamedWindows()">compareUnnamedWindows</a><br />
<a href='javascript:void(0);' id="compareNamedWindows"
    onclick="compareNamedWindows()">compareNamedWindows</a><br />
<a href='javascript:void(0);' id="compareNamedAndUnnamedWindows"
    onclick="compareNamedAndUnnamedWindows()">compareNamedAndUnnamedWindows</a>
<br /><br />
<a href='javascript:void(0);' id="checkNamedWindow1Closed"
    onclick="checkNamedWindow1Closed()">checkNamedWindow1Closed</a><br />
<a href='javascript:void(0);' id="checkNamedWindow2Closed"
    onclick="checkNamedWindow2Closed()">checkNamedWindow2Closed</a><br />
<a href='javascript:void(0);' id="checkUnnamedWindow1Closed"
    onclick="checkUnnamedWindow1Closed()">checkUnnamedWindow1Closed</a><br />
<a href='javascript:void(0);' id="checkUnnamedWindow2Closed"
    onclick="checkUnnamedWindow2Closed()">checkUnnamedWindow2Closed</a><br />

</body>
</html>