author Emilio Cobos Álvarez <>
Tue, 07 May 2019 14:49:43 +0200
changeset 534763 cac07df678c379c2fed3e3a647e82214ef25f46e
parent 534762 85ca0fd33049018c147148a5a3b82898c01c1e9e
child 545681 60e865d21df584c61d07fa7119196bfd2932b1c7
permissions -rw-r--r--
Bug 1116016 - Make file_iframe_sandbox_e_if5.html navigate away reliably. Same fix as

  <meta charset="utf-8">
  <title>Test for Bug 341604</title>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript">
function navigateAway() {
  // Anchor clicks are only handled if we have a pres-context, and we may not
  // have one yet by the time this runs, and getBoundingClientRect() /
  // sendMouseEvent won't construct it after bug 1440537.
  // So we may need to wait a few frames to make this reliable.
  // FIXME(emilio, bug 1218456): This dance shouldn't be needed.
  let anchor = document.getElementById("anchor");
  if (anchor.getBoundingClientRect().width > 0);
<body onload="navigateAway()">
  I am sandboxed with 'allow-scripts and allow-top-navigation'

  <a href="file_iframe_sandbox_top_navigation_pass.html" target='_top' id='anchor'>Click me</a>