chromium/third_party/blink/web_tests/external/wpt/html/browsers/windows/auxiliary-browsing-contexts/resources/close-opener.html

<!doctype html>
<meta charset="utf-8">
<html>
<body onload="closeOpener()">
<p>This window should close its opener.</p>
<script src="/common/PrefixedLocalStorage.js"></script>
<script>
var prefixedLocalStorage = new PrefixedLocalStorageResource({
  close_on_cleanup: true
});
var prefixedLocalStorage = new PrefixedLocalStorageResource({
  close_on_cleanup: true
});
function closeOpener () {
  if (window.opener) {
    window.opener.close();

    // Give the browsing context a chance to dispose of itself
    function waitForContextDiscard () {
      if (window.opener === null) {
        return prefixedLocalStorage.setItem('openerIsNull', 'true');
      }
      return setTimeout(waitForContextDiscard, 0);
    }
    waitForContextDiscard();
  }
}
</script>
</body>
</html>