summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/history/the-location-interface/location_reload.html
blob: 78b3cc35eb4a549b3490e6d0f2d761cf2ca73b8e (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
<!DOCTYPE HTML>
<html>
  <head>
    <title>location_reload</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <div id="log"></div>

    <iframe></iframe>

    <script>
    var history_length;
    async_test(function(t) {

      var url = new URL("./location_reload-iframe.html", window.location).href;
      var pingCount = 0;

      window._ping = t.step_func(function(innerURL) {
          // Some browsers keep 'about:blank' in the session history
          if (pingCount == 0) {
            history_length = history.length;
          }
          assert_equals(url, innerURL, "iframe url (" + pingCount + ")");
          assert_equals(history_length, history.length, "history length (" + pingCount + ")");
          pingCount++;
          if (pingCount == 5) {
            iframe.src = 'about:blank';
            t.done();
          }
      });

      var iframe = document.querySelector("iframe");
      iframe.src = url;
      history_length = history.length;
    });
    </script>

  </body>
</html>