dom/base/test/test_bug590812.html
author Kris Maglione <maglione.k@gmail.com>
Mon, 12 Aug 2019 12:56:25 -0700
changeset 488077 4b826e607ca87939b656b62836721973c67dac71
parent 488075 1d8042fdc2b8a6ec78169a33d2648db97b2131c4
child 494181 72ca7d0540618e415429186af9deaa719d7c308f
permissions -rw-r--r--
Bug 1573254: Part 2 - Update tests to await snapshotWindow when necessary. r=mccr8 This fixes several tests which snapshot remote windows under Fission. It also changes some other arbitrary tests that don't use remote windows, which I changed before I gave up on having an always-async API. Differential Revision: https://phabricator.services.mozilla.com/D41630

<!DOCTYPE HTML>
<html>
<head>
  <title>Test for XML pretty printing, bug 590812</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="runTest()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=590812">Mozilla Bug 590812</a>
<p id="display"></p>
<iframe src="http://noxul.example.com/tests/dom/base/test/file_bug590812.xml"></iframe>
<iframe src="file_bug590812.xml"></iframe>
<iframe src="file_bug590812-ref.xhtml"></iframe>
<pre id="test">
<script class="testbody" type="application/javascript">

SimpleTest.waitForExplicitFinish();

async function runTest() {
  // FIXME(Fission): The load event fires before cross-origin iframes have
  // loaded (bug 1559841).
  if (SpecialPowers.useRemoteSubframes) {
    for (let i = 0; i < 100; i++) {
      await new Promise(resolve => setTimeout(resolve, 0));
    }
  }

  let sNoXUL = await snapshotWindow(window.frames[0], false);
  let sWithXUL = await snapshotWindow(window.frames[1], false);
  let sRef = await snapshotWindow(window.frames[2], false);
  let res;
  ok(compareSnapshots(sNoXUL, sRef, true)[0],
     "noxul domain same as ref");
  ok(compareSnapshots(sWithXUL, sRef, true)[0],
     "xul supporting domain same as ref");

  SimpleTest.finish();
}

</script>
</pre>
</body>
</html>