dom/tests/mochitest/general/test_497898.html
author Yoshi Huang <allstars.chh@mozilla.com>
Wed, 10 May 2017 11:52:33 +0800
changeset 358507 5cef191f7d10d22597d4696535e5b8b3426cc18f
parent 265753 7067747636ceb1fa293687ad9f80db3cd290d14c
child 469641 ba6f655fd68963530c866d0d4a48c3db3d307777
permissions -rw-r--r--
Bug 1363632 - rewrite test_497898.html. r=smaug test_497898.html uses encoded URI in data:text/html, so I am going to replace it with srcdoc attribute and also decode the URI into plain html.

<html>
<head>
<title>Crash [@ nsFocusManager::SendFocusOrBlurEvent] after switching focus to a different window in this case</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script>
SimpleTest.waitForExplicitFinish();

function done()
{
  is("passed", "passed", "test passed without crashing");
  SimpleTest.finish();
}

function switchFocus()
{
  setTimeout(() => window.open('497633.html', '_new', 'width=300,height=300'), 0);
}
</script>
</head>
<body>
  <iframe srcdoc="<html><meta charset='utf-8'>
      <head></head>
      <body>
        <button id='a' onfocus='parent.switchFocus()' onblur='window.frameElement.parentNode.removeChild(window.frameElement)'>Switching focus to a different program should not crash Mozilla</button>
        <script>
document.getElementById('a').focus();
        </script>
      </body>
    </html>">
  </iframe>

<p id="display"></p>
<div id="content" style="display: none"></div>

</body>
</html>