author Kris Maglione <>
Mon, 10 Jun 2019 13:31:19 -0700
changeset 544097 c95e6e5998364d70a97651dea785d0ad5c31eff5
parent 543755 f9bf5e4b0b4f48302d560afb5307d57fbbab7c73
child 544113 f2c260cae4b51280b18ff67936c5a9ac79aed5eb
permissions -rw-r--r--
Bug 1558298: Part 3 - Always load specialpowers.js as a JSM. r=nika Differential Revision:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>

<window id="89419Test"
        onload="setTimeout(nextTest, 0);"
        title="bug 89419 test">

  <script type="application/javascript" src= "chrome://mochikit/content/chrome-harness.js" />
    ChromeUtils.import("resource://specialpowers/SpecialPowers.jsm", this);

    window.addMessageListener = function() {};
    window.removeMessageListener = function() {};
    window.SpecialPowers = new SpecialPowers(window, window);
  <script type="application/javascript" src="docshell_helpers.js" />
  <script src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>

  <script type="application/javascript"><![CDATA[
    // Define the generator-iterator for the tests.
    var tests = testIterator();

    // Execute the next test in the generator function.
    function nextTest() {;

    // Generator function for test steps for bug 89419:
    // A visited link should have the :visited style applied
    // to it when displayed on a page which was fetched from
    // the bfcache.
    function* testIterator()
      // Disable rcwn to make cache behavior deterministic.
      var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
      SpecialPowers.pushPrefEnv({"set":[["network.http.rcwn.enabled", false]]}, nextTest);
      yield undefined;

      // Load a test page containing an image referring to the sjs that returns
      // a different redirect every time it's loaded.
        uri: getHttpUrl("89419.html"),
        onNavComplete: nextTest,
        preventBFCache: true
      yield undefined;

      var first = snapshotWindow(TestWindow.getWindow());

        uri: "about:blank",
        onNavComplete: nextTest
      yield undefined;

      var second = snapshotWindow(TestWindow.getWindow());
      function snapshotsEqual(snap1, snap2) {
        return compareSnapshots(snap1, snap2, true)[0];
      ok(!snapshotsEqual(first, second), "about:blank should not be the same as the image web page");

        back: true,
        onNavComplete: nextTest
      yield undefined;

      var third = snapshotWindow(TestWindow.getWindow());
      ok(!snapshotsEqual(third, second), "going back should not be the same as about:blank");
      ok(snapshotsEqual(first, third), "going back should be the same as the initial load");

      // Tell the framework the test is finished.


  <browser type="content" primary="true" flex="1" id="content" src="about:blank"/>