summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/portals/history/history-manipulation-inside-portal-with-subframes.html
blob: cb4c8d0f914a0508656b4e8a95ef071da41869fe (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
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/run-test-in-portal.js"></script>
<body>
<script>
  var portalSrc =
      'resources/portal-manipulate-history-with-subframes.sub.html';

  // Runs before and after the history manipulation in the portal to confirm
  // that the session history of the portal host is not affected by any history
  // changes in the portal.
  function assertInitialHistoryState() {
    assert_equals(history.length, 1);
    assert_false(!!history.state);
  }

  promise_test(async () => {
    assertInitialHistoryState();
    await runTestInPortal(portalSrc, 'testIFrameSrcInPortal');
    assertInitialHistoryState();
  }, 'Setting iframe src navigates independently with replacement in a portal');

  promise_test(async () => {
    assertInitialHistoryState();
    await runTestInPortal(portalSrc, 'testCrossSiteIFrameSrcInPortal');
    assertInitialHistoryState();
  }, 'Setting cross site iframe src navigates independently with replacement in a portal');

  promise_test(async () => {
    assertInitialHistoryState();
    await runTestInPortal(portalSrc, 'testIFrameNavInPortal');
    assertInitialHistoryState();
  }, 'iframe navigates itself independently with replacement in a portal');

  promise_test(async () => {
    assertInitialHistoryState();
    await runTestInPortal(portalSrc, 'testCrossSiteIFrameNavInPortal');
    assertInitialHistoryState();
  }, 'Cross site iframe navigates itself independently with replacement in a portal');
</script>
</body>