docshell/test/mochitest/test_bug1121701.html
author Byron Campen [:bwc] <docfaraday@gmail.com>
Mon, 29 Apr 2019 15:51:30 +0000
changeset 471964 f8a6a019f873aaebc47740ea1423c0985aaedf69
parent 469640 c9c0c6f2eed54a187e124942e53c3660b4cf17d8
permissions -rw-r--r--
Bug 1531803 - Part 3: Only set track id on JsepTrack if we're configured to emit track ids in SDP, and simplify some code. r=mjf Differential Revision: https://phabricator.services.mozilla.com/D25796

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1121701
-->
<head>
  <meta charset="utf-8">
  <title>Test for Bug 1121701</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">

  /** Test for Bug 1121701 **/

  var testUrl1 = "file_bug1121701_1.html";
  var testUrl2 = "file_bug1121701_2.html";
  var testWin;

  var page1LoadCount = 0;
  function child1PageShow(e) {
    ++page1LoadCount;
    if (page1LoadCount == 1) {
      SimpleTest.executeSoon(function() {
        is(e.persisted, false, "Initial page load shouldn't be persisted.");
        testWin.document.body.innerHTML = "modified";
        testWin.onpagehide = function(event) {
          testWin.onpagehide = null;
          ok(event.persisted, "test page 1 should have been persisted");
          is(testWin.document.body.innerHTML, "modified");
        };
        testWin.location.href = testUrl2;
      });
    } else if (page1LoadCount == 2) {
      is(e.persisted, true, "Page load from bfcache should be persisted.");
      is(testWin.document.body.innerHTML, "modified");
      testWin.close();
      SimpleTest.finish();
    }
  }

  function child2PageShow(e) {
    testWin.document.body.innerHTML = "<img>";
    SimpleTest.executeSoon(function() {
      testWin.onmessage = function() {
        ok(true, "Got message");
        testWin.document.body.firstChild.src = location.href;
      };
      testWin.onbeforeunload = function() {
        testWin.postMessage("foo", "*");
      };
      testWin.history.back();
    });
  }

  SimpleTest.waitForExplicitFinish();
  addLoadEvent(function() {
    testWin = window.open(testUrl1);
  });

  </script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1121701">Mozilla Bug 1121701</a>
<p id="display"></p>
<div id="content" style="display: none">

</div>
<pre id="test">
</pre>
</body>
</html>