summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/001-1.html
blob: 9aa5d30d16ecc48a7c503b34f0fb9e12d47fed83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!doctype html>
<script>
var o = opener;

var frameloaded = null;

o.t.step(function() {o.assert_equals(history.length, 1)});

onload = function () {
  o.t.step(function() {
    o.assert_equals(history.length, 1);
    o.t.done();
  });

  o.t1.step(function() {
    var iframe = document.createElement("iframe");
    iframe.src = "filler.html?id=2";
    document.body.appendChild(iframe);
    frameloaded = o.t1.step_func(function () {
      o.assert_equals(history.length, 1);
      setTimeout(o.t1.step_func(function () {
        o.assert_equals(history.length, 1);
        iframe.src = "filler.html?id=3";
        frameloaded = o.t2.step_func(function() {
          o.assert_equals(history.length, 2);
          history.go(-1);
          frameloaded = o.t3.step_func(function() {
            o.assert_equals(history.length, 2);
            var parts = iframe.contentWindow.location.href.split("/")
            o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
            o.t3.done();
            o.t4.step(function() {
              var iframe0 = document.getElementsByTagName("iframe")[0];
              iframe0.src = "filler.html?id=4"
              frameloaded = o.t4.step_func(function() {
                o.assert_equals(history.length, 2);
                var parts = iframe0.contentWindow.location.href.split("/")
                o.assert_equals(parts[parts.length - 1], "filler.html?id=4");
                //This is the point at which gecko and webkit stop running tests
                history.go(-1);
                frameloaded = o.t5.step_func(function() {
                  o.assert_equals(history.length, 2);
                  var parts = iframe0.contentWindow.location.href.split("/")
                  o.assert_equals(parts[parts.length - 1], "filler.html?id=1");
                  var parts = iframe.contentWindow.location.href.split("/")
                  o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
                  history.go(1);
                  frameloaded = o.t6.step_func(function() {
                    o.assert_equals(history.length, 2);
                    var parts = iframe0.contentWindow.location.href.split("/")
                    o.assert_equals(parts[parts.length - 1], "filler.html?id=4");
                    var parts = iframe.contentWindow.location.href.split("/")
                    o.assert_equals(parts[parts.length - 1], "filler.html?id=2");
                    o.t6.done();
                  });
                  o.t5.done();
                });
                o.t4.done();
              });
            });
          });
          o.t2.done();
        });
        o.t1.done();
      }, 500))
    });
  });

}
</script>

<iframe src="filler.html?id=1"></iframe>