chromium/third_party/blink/web_tests/fast/dom/Window/resources/property-access-in-closure-after-navigation-child.html

<!DOCTYPE html>
<html>
<head>
<script>
function startTest()
{
  t = window.top;
  t.shouldBe("window", "self");
  t.shouldBe("window", "frames");
  t.shouldBe("parent", "top");
  t.savedClosure = () => {
    // The normal shouldBeNull() helpers don't work well here, since they don't
    // eval in the right context.
    function shouldBeNull(value, name)
    {
      if (value === null)
        t.testPassed(name + " is null.");
      else
        t.testFailed(name + " should be null. Was " + value);
    }
    function shouldBeNonNull(value, name) {
      if (value != null)
        t.testPassed(name + " is non-null.");
      else
        t.testFailed(name + " should be non-null. Was " + value);
    }

    // window, self and frames never be null.
    // https://html.spec.whatwg.org/multipage/browsers.html#dom-window
    shouldBeNonNull(window, "window");
    shouldBeNonNull(self, "self");
    shouldBeNonNull(frames, "frames");

    // top and parent are null if there is no browsing context with the
    // WindowProxy.
    // https://html.spec.whatwg.org/multipage/browsers.html#dom-top
    // https://html.spec.whatwg.org/multipage/browsers.html#dom-parent
    // However, when navigated, the WindowProxy's browsing context still exists.
    // When the iframe is removed, |parent| and |top| are null.
    shouldBeNonNull(parent, "parent");
    shouldBeNonNull(top, "top");
  };
  location = 'data:text/html,<body>Testing...</body>';
}
</script>
</head>
<body onload="startTest()">
</body>
</html>