summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-history-interface/joint_session_history/002-1.html
blob: ed69d679da1d931473b89d33b9ded4efc9f31735 (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
<!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);
    o.assert_equals(history.length, 1);
    frameloaded = o.t2.step_func(function() {
      iframe.contentDocument.open();
      iframe.contentDocument.write("3<script>onpageshow = function() {alert('pageshow'); parent.frameloaded()}<\/script>");
      iframe.contentDocument.close();
      frameloaded = o.t2.step_func(function () {
        o.assert_equals(history.length, 2);
        o.t2.done();
      });
    });
    o.t1.done();
  });

}
</script>

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